Ref: Extrahiert den accountSelect in eine eigene Funktion
This commit is contained in:
@@ -28,7 +28,43 @@ class _HomePageState extends State<HomePage> {
|
||||
titleSpacing: 0,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: DropdownSearch<String>(
|
||||
child: _accountSelect(),
|
||||
),
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: TabBarView(
|
||||
controller: tabPage.controller,
|
||||
children: <Widget>[
|
||||
for (final PageStack stack in tabPage.stacks)
|
||||
PageStackNavigator(stack: stack),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
bottomNavigationBar: _bottomNav(tabPage),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _bottomNav(final TabPageState tabPage) =>
|
||||
BottomNavigationBar(
|
||||
currentIndex: tabPage.index,
|
||||
onTap: tabPage.controller.animateTo,
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(icon: Icon(Icons.dashboard), label: 'Dashboard'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'Verlauf'),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.settings),
|
||||
label: 'Einstellungen',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _accountSelect() =>
|
||||
DropdownSearch<String>(
|
||||
items:
|
||||
(final String filter, final LoadProps? infiniteScrollProps) =>
|
||||
<String>['Konto 1', 'Konto 2', 'Konto 3', 'Konto 4'],
|
||||
@@ -47,37 +83,5 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: TabBarView(
|
||||
controller: tabPage.controller,
|
||||
children: <Widget>[
|
||||
for (final PageStack stack in tabPage.stacks)
|
||||
PageStackNavigator(stack: stack),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
bottomNavigationBar: _buildBottomNav(tabPage),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomNav(final TabPageState tabPage) => BottomNavigationBar(
|
||||
currentIndex: tabPage.index,
|
||||
onTap: tabPage.controller.animateTo,
|
||||
items: const <BottomNavigationBarItem>[
|
||||
BottomNavigationBarItem(icon: Icon(Icons.dashboard), label: 'Dashboard'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'Verlauf'),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.settings),
|
||||
label: 'Einstellungen',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user