import 'package:flutter/material.dart'; import 'composition/demo_scheduler_composition.dart'; import 'theme/focus_flow_theme.dart'; import 'widgets/backlog_pane.dart'; import 'widgets/today_pane.dart'; class FocusFlowApp extends StatelessWidget { const FocusFlowApp({required this.composition, super.key}); final DemoSchedulerComposition composition; @override Widget build(BuildContext context) { return MaterialApp( title: 'FocusFlow', debugShowCheckedModeBanner: false, theme: FocusFlowTheme.dark(), home: SchedulerHome(composition: composition), ); } } class SchedulerHome extends StatefulWidget { const SchedulerHome({required this.composition, super.key}); final DemoSchedulerComposition composition; @override State createState() => _SchedulerHomeState(); } class _SchedulerHomeState extends State { late final todayController = widget.composition.createTodayController(); late final backlogController = widget.composition.createBacklogController(); late final commandController = widget.composition.createCommandController( refreshReads: () async { await Future.wait([todayController.load(), backlogController.load()]); }, ); int selectedIndex = 0; @override void initState() { super.initState(); todayController.load(); backlogController.load(); } @override void dispose() { todayController.dispose(); backlogController.dispose(); commandController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('FocusFlow')), body: IndexedStack( index: selectedIndex, children: [ TodayPane( controller: todayController, commandController: commandController, ), BacklogPane( controller: backlogController, commandController: commandController, ), ], ), bottomNavigationBar: NavigationBar( selectedIndex: selectedIndex, onDestinationSelected: (index) { setState(() { selectedIndex = index; }); }, destinations: const [ NavigationDestination( icon: Icon(Icons.today_outlined), selectedIcon: Icon(Icons.today), label: 'Today', ), NavigationDestination( icon: Icon(Icons.inbox_outlined), selectedIcon: Icon(Icons.inbox), label: 'Backlog', ), ], ), ); } }