pikapika/lib/main.dart

46 lines
996 B
Dart
Raw Normal View History

2021-09-29 23:57:09 +00:00
import 'package:event/event.dart';
import 'package:flutter/material.dart';
2021-11-11 03:00:38 +00:00
import 'package:pikapika/screens/InitScreen.dart';
import 'package:pikapika/basic/Navigatior.dart';
2021-09-29 23:57:09 +00:00
import 'basic/config/Themes.dart';
void main() {
2021-11-30 02:23:49 +00:00
runApp(PikapikaApp());
2021-09-29 23:57:09 +00:00
}
2021-11-30 02:23:49 +00:00
class PikapikaApp extends StatefulWidget {
const PikapikaApp({Key? key}) : super(key: key);
2021-09-29 23:57:09 +00:00
@override
2021-11-30 02:23:49 +00:00
State<StatefulWidget> createState() => _PikapikaAppState();
2021-09-29 23:57:09 +00:00
}
2021-11-30 02:23:49 +00:00
class _PikapikaAppState extends State<PikapikaApp> {
2021-09-29 23:57:09 +00:00
@override
void initState() {
themeEvent.subscribe(_onChangeTheme);
super.initState();
}
@override
void dispose() {
themeEvent.unsubscribe(_onChangeTheme);
super.dispose();
}
void _onChangeTheme(EventArgs? args) {
setState(() {});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: currentThemeData(),
2021-10-15 06:18:29 +00:00
darkTheme: currentDarkTheme(),
2021-09-29 23:57:09 +00:00
navigatorObservers: [navigatorObserver, routeObserver],
home: InitScreen(),
);
}
}