import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:sendtrain/models/activity_timer_model.dart';
import 'package:sendtrain/screens/activities_screen.dart';
import 'package:sendtrain/screens/sessions_screen.dart';

class SendTrain extends StatelessWidget {
  const SendTrain({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: "Sendtrain",
        theme: ThemeData.dark(useMaterial3: true),
        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>[
              const 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.landscape), 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: () {
            // Add your onPressed code here!
          },
          label: const Text('New Session'),
          icon: const Icon(Icons.add_chart),
          backgroundColor: Colors.deepPurple,
        ));
  }
}

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (context) => ActivityTimerModel(),
      child: const SendTrain(),
    ),
  );
}