+137
-131
lib/main.dart
+137
-131
lib/main.dart
···
493
493
494
494
@override
495
495
Widget build(BuildContext context) {
496
-
return MaterialApp(
497
-
navigatorKey: _navigatorKey,
498
-
title: 'Toadist',
499
-
debugShowCheckedModeBanner: false,
500
-
theme: ThemeData(
501
-
colorScheme: ColorScheme.fromSeed(
502
-
seedColor: Colors.teal,
503
-
brightness: Brightness.light,
504
-
),
505
-
useMaterial3: true,
506
-
appBarTheme: const AppBarTheme(
507
-
centerTitle: true,
508
-
elevation: 0,
509
-
),
510
-
cardTheme: const CardThemeData(
511
-
elevation: 2,
512
-
),
513
-
floatingActionButtonTheme: FloatingActionButtonThemeData(
514
-
shape: RoundedRectangleBorder(
515
-
borderRadius: BorderRadius.circular(16),
496
+
return ListenableBuilder(
497
+
listenable: _appService,
498
+
builder: (context, _) {
499
+
return MaterialApp(
500
+
navigatorKey: _navigatorKey,
501
+
title: 'Toadist',
502
+
debugShowCheckedModeBanner: false,
503
+
theme: ThemeData(
504
+
colorScheme: ColorScheme.fromSeed(
505
+
seedColor: Colors.teal,
506
+
brightness: Brightness.light,
507
+
),
508
+
useMaterial3: true,
509
+
appBarTheme: const AppBarTheme(
510
+
centerTitle: true,
511
+
elevation: 0,
512
+
),
513
+
cardTheme: const CardThemeData(
514
+
elevation: 2,
515
+
),
516
+
floatingActionButtonTheme: FloatingActionButtonThemeData(
517
+
shape: RoundedRectangleBorder(
518
+
borderRadius: BorderRadius.circular(16),
519
+
),
520
+
),
516
521
),
517
-
),
518
-
),
519
-
darkTheme: ThemeData(
520
-
colorScheme: ColorScheme.fromSeed(
521
-
seedColor: Colors.teal,
522
-
brightness: Brightness.dark,
523
-
),
524
-
useMaterial3: true,
525
-
appBarTheme: const AppBarTheme(
526
-
centerTitle: true,
527
-
elevation: 0,
528
-
),
529
-
cardTheme: const CardThemeData(
530
-
elevation: 2,
531
-
),
532
-
),
533
-
themeMode: ThemeMode.system,
534
-
// home: _buildHome(), // REMOVED to force onGenerateRoute usage
535
-
initialRoute: '/',
536
-
onGenerateRoute: (settings) {
537
-
Widget page;
538
-
switch (settings.name) {
539
-
case '/':
540
-
case '/views':
541
-
page = NootDashboard(
542
-
appService: _appService,
543
-
title: 'Toadist',
544
-
welcomeTitle: 'Welcome to Toadist',
545
-
welcomeMessage: 'Choose a view to get started',
546
-
defaultNewNootActivities: const ['todo'],
547
-
allowedNewNootActivities: const [
548
-
'todo',
549
-
'note',
550
-
'schedule',
551
-
'link',
552
-
'location',
553
-
'list',
554
-
'category',
555
-
'file'
556
-
],
557
-
);
558
-
break;
559
-
case '/todo':
560
-
case 'todo':
561
-
case '/toadist/todo':
562
-
case 'toadist/todo':
563
-
page = TodoView(appService: _appService);
564
-
break;
565
-
case '/journal':
566
-
case 'journal':
567
-
page = JournalView(appService: _appService);
568
-
break;
569
-
case '/daily-log':
570
-
case 'daily-log':
571
-
page = DailyLogView(appService: _appService);
572
-
break;
573
-
case '/pomodoro':
574
-
case 'pomodoro':
575
-
page = PomodoroView(appService: _appService);
576
-
break;
577
-
case '/files':
578
-
case 'files':
579
-
page = FilesView(appService: _appService);
580
-
break;
581
-
case '/noots':
582
-
case 'noots':
583
-
page = NootViewer(appService: _appService);
584
-
break;
585
-
case '/noot/new':
586
-
final args = settings.arguments as Map<String, dynamic>?;
587
-
page = NootCreationView(
588
-
appService: _appService,
589
-
allowedActivities: args?['allowedActivities'] as List<String>?,
590
-
preSelectedActivities:
591
-
args?['preSelectedActivities'] as List<String>?,
592
-
prefillNoot: args?['prefillNoot'] as Noot?,
593
-
);
594
-
break;
595
-
case '/noot/edit':
596
-
final args = settings.arguments as Map<String, dynamic>;
597
-
page = NootCreationView(
598
-
appService: _appService,
599
-
existingNootId: args['nootId'] as String,
600
-
allowedActivities: args['allowedActivities'] as List<String>?,
601
-
);
602
-
break;
603
-
case '/auth':
604
-
page = AuthScreen(
605
-
appService: _appService,
606
-
onAuthenticated: _onAuthenticated,
607
-
onSkipped: _onSkipped,
608
-
);
609
-
break;
610
-
default:
611
-
page = NootDashboard(
612
-
appService: _appService,
613
-
title: 'Toadist',
614
-
);
615
-
}
616
-
617
-
// Wrap with Auth/Loading check
618
-
return MaterialPageRoute(
619
-
builder: (_) {
620
-
if (_isLoading) return const _LoadingScreen();
621
-
if (_showAuth && settings.name != '/auth') {
622
-
return AuthScreen(
623
-
appService: _appService,
624
-
onAuthenticated: _onAuthenticated,
625
-
onSkipped: _onSkipped,
626
-
);
522
+
darkTheme: ThemeData(
523
+
colorScheme: ColorScheme.fromSeed(
524
+
seedColor: Colors.teal,
525
+
brightness: Brightness.dark,
526
+
),
527
+
useMaterial3: true,
528
+
appBarTheme: const AppBarTheme(
529
+
centerTitle: true,
530
+
elevation: 0,
531
+
),
532
+
cardTheme: const CardThemeData(
533
+
elevation: 2,
534
+
),
535
+
),
536
+
themeMode: _appService.themeMode,
537
+
// home: _buildHome(), // REMOVED to force onGenerateRoute usage
538
+
initialRoute: '/',
539
+
onGenerateRoute: (settings) {
540
+
Widget page;
541
+
switch (settings.name) {
542
+
case '/':
543
+
case '/views':
544
+
page = NootDashboard(
545
+
appService: _appService,
546
+
title: 'Toadist',
547
+
welcomeTitle: 'Welcome to Toadist',
548
+
welcomeMessage: 'Choose a view to get started',
549
+
defaultNewNootActivities: const ['todo'],
550
+
allowedNewNootActivities: const [
551
+
'todo',
552
+
'note',
553
+
'schedule',
554
+
'link',
555
+
'location',
556
+
'list',
557
+
'category',
558
+
'file'
559
+
],
560
+
);
561
+
break;
562
+
case '/todo':
563
+
case 'todo':
564
+
case '/toadist/todo':
565
+
case 'toadist/todo':
566
+
page = TodoView(appService: _appService);
567
+
break;
568
+
case '/journal':
569
+
case 'journal':
570
+
page = JournalView(appService: _appService);
571
+
break;
572
+
case '/daily-log':
573
+
case 'daily-log':
574
+
page = DailyLogView(appService: _appService);
575
+
break;
576
+
case '/pomodoro':
577
+
case 'pomodoro':
578
+
page = PomodoroView(appService: _appService);
579
+
break;
580
+
case '/files':
581
+
case 'files':
582
+
page = FilesView(appService: _appService);
583
+
break;
584
+
case '/noots':
585
+
case 'noots':
586
+
page = NootViewer(appService: _appService);
587
+
break;
588
+
case '/noot/new':
589
+
final args = settings.arguments as Map<String, dynamic>?;
590
+
page = NootCreationView(
591
+
appService: _appService,
592
+
allowedActivities:
593
+
args?['allowedActivities'] as List<String>?,
594
+
preSelectedActivities:
595
+
args?['preSelectedActivities'] as List<String>?,
596
+
prefillNoot: args?['prefillNoot'] as Noot?,
597
+
);
598
+
break;
599
+
case '/noot/edit':
600
+
final args = settings.arguments as Map<String, dynamic>;
601
+
page = NootCreationView(
602
+
appService: _appService,
603
+
existingNootId: args['nootId'] as String,
604
+
allowedActivities: args['allowedActivities'] as List<String>?,
605
+
);
606
+
break;
607
+
case '/auth':
608
+
page = AuthScreen(
609
+
appService: _appService,
610
+
onAuthenticated: _onAuthenticated,
611
+
onSkipped: _onSkipped,
612
+
);
613
+
break;
614
+
default:
615
+
page = NootDashboard(
616
+
appService: _appService,
617
+
title: 'Toadist',
618
+
);
627
619
}
628
-
return page;
620
+
621
+
// Wrap with Auth/Loading check
622
+
return MaterialPageRoute(
623
+
builder: (_) {
624
+
if (_isLoading) return const _LoadingScreen();
625
+
if (_showAuth && settings.name != '/auth') {
626
+
return AuthScreen(
627
+
appService: _appService,
628
+
onAuthenticated: _onAuthenticated,
629
+
onSkipped: _onSkipped,
630
+
);
631
+
}
632
+
return page;
633
+
},
634
+
);
629
635
},
630
636
);
631
637
},
+3
-1
pubspec.yaml
+3
-1
pubspec.yaml
History
1 round
0 comments
pada.tngl.sh
submitted
#0
1 commit
expand
collapse
dark mode and better dependeies
expand 0 comments
pull request successfully merged