132 lines
4.4 KiB
Dart
132 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:sendtrain/database/database.dart';
|
|
import 'package:sendtrain/models/activity_timer_model.dart';
|
|
import 'package:sendtrain/widgets/screens/activities_screen.dart';
|
|
import 'package:sendtrain/widgets/screens/sessions_screen.dart';
|
|
// ignore: unused_import
|
|
import 'package:sendtrain/database/seed.dart';
|
|
import 'package:sendtrain/widgets/sessions/session_editor.dart';
|
|
|
|
class SendTrain extends StatelessWidget {
|
|
const SendTrain({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ThemeData themeData = ThemeData.dark(useMaterial3: true);
|
|
return MaterialApp(
|
|
title: "Sendtrain",
|
|
theme: themeData.copyWith(
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12))),
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
fillColor: themeData.colorScheme.surface,
|
|
),
|
|
),
|
|
home: const App());
|
|
}
|
|
}
|
|
|
|
class App extends StatefulWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
State<App> createState() => _AppState();
|
|
}
|
|
|
|
class _AppState extends State<App> {
|
|
int currentPageIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
// appBar: AppBar(
|
|
// toolbarOpacity: 0,
|
|
// centerTitle: true,
|
|
// title: const Text('SENDTRAIN'),
|
|
// scrolledUnderElevation: 0,
|
|
// actions: <Widget>[
|
|
// IconButton(
|
|
// // highlightColor: Colors.deepPurple,
|
|
// icon: const Icon(Icons.settings),
|
|
// tooltip: 'Application Settings',
|
|
// onPressed: () {})
|
|
// ]),
|
|
body: Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 50, 0, 0),
|
|
child: <Widget>[
|
|
SessionsScreen(),
|
|
const ActivitiesScreen(),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
child: const Text('In Progress...'),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
child: const Text('In Progress...'),
|
|
),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
child: const Text('In Progress...'),
|
|
),
|
|
][currentPageIndex]),
|
|
bottomNavigationBar: NavigationBar(
|
|
onDestinationSelected: (int index) {
|
|
setState(() {
|
|
currentPageIndex = index;
|
|
});
|
|
},
|
|
selectedIndex: currentPageIndex,
|
|
destinations: const <Widget>[
|
|
NavigationDestination(
|
|
icon: Icon(Icons.sports), label: "Sessions"),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.sports_gymnastics_rounded), label: "Activities"),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.calendar_month_rounded), label: "Plan"),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.group), label: "Team Send"),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.analytics), label: "Progress")
|
|
]),
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
onPressed: () {
|
|
showModalBottomSheet<void>(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
),
|
|
context: context,
|
|
showDragHandle: true,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
builder: (BuildContext context) {
|
|
return SessionEditor();
|
|
});
|
|
},
|
|
label: const Text('New Session'),
|
|
icon: const Icon(Icons.add_chart),
|
|
// backgroundColor: Colors.deepPurple,
|
|
));
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
runApp(MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider(create: (context) => ActivityTimerModel()),
|
|
Provider<AppDatabase>(
|
|
create: (context) => AppDatabase(),
|
|
dispose: (context, db) => db.close()),
|
|
],
|
|
child: const SendTrain(),
|
|
));
|
|
}
|