flutter/examples/api/lib/widgets/text/text.0.dart
Greg Spencer e3bc8efd39
Rename Sample classes (#124080)
Rename Sample classes
2023-04-04 20:34:29 +00:00

47 lines
1.2 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
/// Flutter code sample for [DefaultTextStyle].
void main() => runApp(const DefaultTextStyleApp());
class DefaultTextStyleApp extends StatelessWidget {
const DefaultTextStyleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
useMaterial3: true,
brightness: Brightness.light,
colorSchemeSeed: Colors.purple,
),
home: const DefaultTextStyleExample(),
);
}
}
class DefaultTextStyleExample extends StatelessWidget {
const DefaultTextStyleExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('DefaultTextStyle.merge Sample')),
// Inherit MaterialApp text theme and override font size and font weight.
body: DefaultTextStyle.merge(
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
child: const Center(
child: Text('Flutter'),
),
),
);
}
}