2023-02-14 14:02:26 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:smoke_cess_app/pages/mood_page.dart';
|
|
|
|
import 'package:smoke_cess_app/pages/relapse_page.dart';
|
|
|
|
import 'package:smoke_cess_app/pages/settings_page.dart';
|
|
|
|
import 'package:smoke_cess_app/pages/sleep_page.dart';
|
|
|
|
import 'package:smoke_cess_app/pages/timer_page.dart';
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
|
|
const MyHomePage({super.key});
|
|
|
|
|
|
|
|
@override
|
2023-02-14 14:13:32 +01:00
|
|
|
MyHomePageState createState() => MyHomePageState();
|
2023-02-14 14:02:26 +01:00
|
|
|
}
|
|
|
|
|
2023-02-14 14:13:32 +01:00
|
|
|
class MyHomePageState extends State<MyHomePage> {
|
2023-02-14 14:02:26 +01:00
|
|
|
int _selectedIndex = 2;
|
2023-02-15 14:30:25 +01:00
|
|
|
final List<String> _titles = [
|
|
|
|
'Stimmung',
|
|
|
|
'Schlaf',
|
|
|
|
'Timer',
|
|
|
|
'Rückfall',
|
|
|
|
'Einstellungen'
|
|
|
|
];
|
2023-02-14 14:13:32 +01:00
|
|
|
static const List<Widget> _widgetOptions = <Widget>[
|
|
|
|
MoodPage(),
|
|
|
|
SleepPage(),
|
2023-02-14 14:02:26 +01:00
|
|
|
StopWatchTimerPage(),
|
2023-02-14 14:13:32 +01:00
|
|
|
RelapsePage(),
|
|
|
|
SettingsPage(),
|
2023-02-14 14:02:26 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
void _onItemTapped(int index) {
|
|
|
|
setState(() => _selectedIndex = index);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2023-02-15 14:30:25 +01:00
|
|
|
appBar: AppBar(title: Text(_titles[_selectedIndex])),
|
2023-02-14 14:02:26 +01:00
|
|
|
body: _widgetOptions.elementAt(_selectedIndex),
|
|
|
|
bottomNavigationBar: NavigationBar(
|
|
|
|
onDestinationSelected: _onItemTapped,
|
|
|
|
selectedIndex: _selectedIndex,
|
|
|
|
destinations: const <Widget>[
|
|
|
|
NavigationDestination(
|
|
|
|
icon: Icon(Icons.mood_outlined, color: Colors.black),
|
|
|
|
label: 'Stimmung'),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: Icon(Icons.bedtime_outlined, color: Colors.black),
|
|
|
|
label: 'Schlaf'),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: Icon(
|
|
|
|
Icons.timer_outlined,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
label: 'Timer'),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: Icon(Icons.smoke_free_outlined, color: Colors.black),
|
|
|
|
label: 'Rückfall'),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: Icon(Icons.settings, color: Colors.black),
|
|
|
|
label: 'Settings'),
|
|
|
|
],
|
|
|
|
|
|
|
|
//onTap: _onItemTapped,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|