make appbar title change dynamically
parent
fade190d08
commit
40018431dd
|
@ -14,6 +14,13 @@ class MyHomePage extends StatefulWidget {
|
||||||
|
|
||||||
class MyHomePageState extends State<MyHomePage> {
|
class MyHomePageState extends State<MyHomePage> {
|
||||||
int _selectedIndex = 2;
|
int _selectedIndex = 2;
|
||||||
|
final List<String> _titles = [
|
||||||
|
'Stimmung',
|
||||||
|
'Schlaf',
|
||||||
|
'Timer',
|
||||||
|
'Rückfall',
|
||||||
|
'Einstellungen'
|
||||||
|
];
|
||||||
static const List<Widget> _widgetOptions = <Widget>[
|
static const List<Widget> _widgetOptions = <Widget>[
|
||||||
MoodPage(),
|
MoodPage(),
|
||||||
SleepPage(),
|
SleepPage(),
|
||||||
|
@ -29,7 +36,7 @@ class MyHomePageState extends State<MyHomePage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('ZI Rauchentwöhnung')),
|
appBar: AppBar(title: Text(_titles[_selectedIndex])),
|
||||||
body: _widgetOptions.elementAt(_selectedIndex),
|
body: _widgetOptions.elementAt(_selectedIndex),
|
||||||
bottomNavigationBar: NavigationBar(
|
bottomNavigationBar: NavigationBar(
|
||||||
onDestinationSelected: _onItemTapped,
|
onDestinationSelected: _onItemTapped,
|
||||||
|
|
Loading…
Reference in New Issue