import 'package:dynamic_color/dynamic_color.dart'; import 'package:flutter/material.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:tstor_ui/api/client.dart'; import 'package:tstor_ui/screens/downloads.dart'; import 'package:tstor_ui/screens/file_view.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return DynamicColorBuilder(builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) { return MaterialApp( title: 'tStor', theme: lightDynamic != null ? ThemeData.from(colorScheme: lightDynamic) : ThemeData.light(), darkTheme: darkDynamic != null ? ThemeData.from(colorScheme: darkDynamic) : ThemeData.dark(), routes: { "/home": (context) => const HomePage(), // "/files": (context) => const FileViewScreen(), }, initialRoute: "/home", home: GraphQLProvider( client: ValueNotifier(client), child: const HomePage(), ), ); }); } } class HomePage extends StatefulWidget { const HomePage({super.key}); @override State createState() => _HomePageState(); } class _HomePageState extends State { int currentPageIndex = 0; @override Widget build(BuildContext context) { return Scaffold( body: [ const FileViewScreen(), const DownloadsScreen(), ][currentPageIndex], bottomNavigationBar: BottomNavigationBar( currentIndex: currentPageIndex, onTap: (i) => setState(() { currentPageIndex = i; }), items: const [ BottomNavigationBarItem( icon: Icon(Icons.folder_copy_outlined), activeIcon: Icon(Icons.folder_copy), label: 'Files', ), BottomNavigationBarItem( icon: Icon(Icons.download_outlined), activeIcon: Icon(Icons.download), label: 'Downloads', ), ], ), ); } }