flutter set light and dark theme code example
Example: dark mode in flutter packages
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return new DynamicTheme(
defaultBrightness: Brightness.light,
data: (brightness) => new ThemeData(
primarySwatch: Colors.indigo,
brightness: brightness,
),
themedWidgetBuilder: (context, theme) {
return new MaterialApp(
title: 'Flutter Demo',
theme: theme,
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
);
}
}