import 'package:get_it/get_it.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:yokutango_mobile_reader/router.dart'; import 'package:flutter/material.dart'; import 'service/theme_bloc.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); GetIt.instance.registerSingleton( await SharedPreferences.getInstance()); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({ super.key, }); @override Widget build(BuildContext context) => BlocProvider( create: (context) => ThemeBloc( init: (GetIt.instance.get().getBool('darkTheme') ?? false) ? Brightness.dark : Brightness.light), child: BlocBuilder( builder: (context, state) => MaterialApp( title: 'Tangocard Reader', theme: ThemeData( fontFamily: 'Noto Sans CJK', primarySwatch: Colors.blue, brightness: state, ), initialRoute: '/', onGenerateRoute: PageRouter.generateRoute, ), ), ); }