Themes
Class SampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Sample App',
theme: ThemeData(
primarySwatch: Colors.blue,
textSelectionColor: Colors.red
),
home: SampleAppPage(),
);
}
}
- In Flutter you declare themes in the top level widget.
- To take full advantage of Material Components in your app, you can declare a top level widget MaterialApp as the entry point to your application.
- You can also use a WidgetApp as your app widget.
- To customize the colors and styles of any child components, pass a ThemeData object to the MaterialApp widget.
- To customize the colors and styles of any child components, pass a ThemeData object to the MaterialApp widget.
MaterialApp
Is a convenience widget that wraps a number of widgets that are commonly required for applications implementing Material Design.
It builds upon a WidgetsApp by adding Material specific functionality.