pikapika/lib/main.dart

48 lines
1.1 KiB
Dart

import 'package:event/event.dart';
import 'package:flutter/material.dart';
import 'package:pikapika/screens/InitScreen.dart';
import 'package:pikapika/basic/Navigator.dart';
import 'package:pikapika/screens/components/MouseAndTouchScrollBehavior.dart';
import 'basic/config/Themes.dart';
void main() {
runApp(PikapikaApp());
}
class PikapikaApp extends StatefulWidget {
const PikapikaApp({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _PikapikaAppState();
}
class _PikapikaAppState extends State<PikapikaApp> {
@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(
scrollBehavior: mouseAndTouchScrollBehavior,
theme: currentThemeData(),
darkTheme: currentDarkTheme(),
navigatorObservers: [navigatorObserver, routeObserver],
home: InitScreen(),
);
}
}