import 'package:abawo_bt_app/pages/devices_page.dart'; import 'package:abawo_bt_app/util/sharedPrefs.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:logging/logging.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'pages/home_page.dart'; import 'pages/settings_page.dart'; Future main() async { Logger.root.level = Level.ALL; // defaults to Level.INFO Logger.root.onRecord.listen((record) { print('${record.level.name}: ${record.time}: ${record.message}'); }); WidgetsFlutterBinding.ensureInitialized(); final prefs = await SharedPreferences.getInstance(); runApp(ProviderScope(overrides: [ // Override the unimplemented provider with the actual instance sharedPreferencesProvider.overrideWithValue(prefs), ], child: const AbawoBtApp())); } class AbawoBtApp extends StatelessWidget { const AbawoBtApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp.router( title: 'Abawo BT App', theme: ThemeData( primarySwatch: Colors.blue, useMaterial3: true, brightness: Brightness.light, ), darkTheme: ThemeData( primarySwatch: Colors.blue, useMaterial3: true, brightness: Brightness.dark, ), themeMode: ThemeMode.system, routerConfig: _router, debugShowCheckedModeBanner: false, ); } } // Configure GoRouter final _router = GoRouter( initialLocation: '/', routes: [ GoRoute( path: '/', builder: (context, state) => const HomePage(), routes: [ GoRoute( path: 'settings', builder: (context, state) => const SettingsPage(), ), GoRoute( path: 'connect_device', builder: (context, state) => const ConnectDevicePage(), ) ], ), ], );