2024-04-24 17:36:33 +00:00
|
|
|
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(),
|
2024-05-13 16:56:20 +00:00
|
|
|
routes: {
|
|
|
|
"/home": (context) => const HomePage(),
|
|
|
|
// "/files": (context) => const FileViewScreen(),
|
|
|
|
},
|
|
|
|
initialRoute: "/home",
|
2024-04-24 17:36:33 +00:00
|
|
|
home: GraphQLProvider(
|
|
|
|
client: ValueNotifier(client),
|
2024-05-13 16:56:20 +00:00
|
|
|
child: const HomePage(),
|
2024-04-24 17:36:33 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-13 16:56:20 +00:00
|
|
|
class HomePage extends StatefulWidget {
|
|
|
|
const HomePage({super.key});
|
2024-04-24 17:36:33 +00:00
|
|
|
|
|
|
|
@override
|
2024-05-13 16:56:20 +00:00
|
|
|
State<HomePage> createState() => _HomePageState();
|
2024-04-24 17:36:33 +00:00
|
|
|
}
|
|
|
|
|
2024-05-13 16:56:20 +00:00
|
|
|
class _HomePageState extends State<HomePage> {
|
2024-04-24 17:36:33 +00:00
|
|
|
int currentPageIndex = 0;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: <Widget>[
|
|
|
|
const FileViewScreen(),
|
|
|
|
const DownloadsScreen(),
|
|
|
|
][currentPageIndex],
|
|
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
|
|
currentIndex: currentPageIndex,
|
|
|
|
onTap: (i) => setState(() {
|
|
|
|
currentPageIndex = i;
|
|
|
|
}),
|
|
|
|
items: const <BottomNavigationBarItem>[
|
|
|
|
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',
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|