Skip to content

Commit 1c79ddf

Browse files
committed
feat: can change theme
1 parent 1740d38 commit 1c79ddf

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

examples/generator_example/generator_app/lib/main_catalog.dart

+16-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@ void main() {
66
runApp(MyApp());
77
}
88

9-
class MyApp extends StatelessWidget {
9+
class MyApp extends StatefulWidget {
10+
@override
11+
State<MyApp> createState() => _MyAppState();
12+
}
13+
14+
class _MyAppState extends State<MyApp> {
15+
var _isDark = false;
16+
final controller = TextEditingController();
17+
1018
@override
1119
Widget build(BuildContext context) {
1220
return MaterialApp(
1321
title: 'Playbook Demo',
14-
theme: ThemeData.light(),
22+
theme: _isDark ? ThemeData.dark() : ThemeData.light(),
1523
home: PlaybookGallery(
16-
title: 'Sample app',
24+
title: 'Generator app',
25+
searchTextController: controller,
26+
checkeredColor: null,
27+
onCustomActionPressed: () => setState(() {
28+
_isDark = !_isDark;
29+
}),
1730
playbook: playbook,
1831
),
1932
);

0 commit comments

Comments
 (0)