157 lines
4.8 KiB
Dart
157 lines
4.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:hiddingsel_app/appflow/view/menu_pages/article_list.dart';
|
|
import 'package:hiddingsel_app/appflow/view/menu_pages/pois.dart';
|
|
import 'package:hiddingsel_app/appflow/view/menu_pages/companies.dart';
|
|
import 'package:hiddingsel_app/appflow/view/menu_pages/das_dorf.dart';
|
|
import 'package:hiddingsel_app/todo/calendar.dart';
|
|
import 'package:hiddingsel_app/constants/constant.dart';
|
|
|
|
import 'menu_pages/contact.dart';
|
|
import 'menu_pages/search.dart';
|
|
import 'menu_pages/buerger_fuer_buerger.dart';
|
|
import 'menu_pages/organisations.dart';
|
|
import 'menu_pages/settings.dart';
|
|
import 'widgets/app_bar.dart';
|
|
import 'menu_pages/imprint.dart';
|
|
|
|
class NavigationDrawer extends StatelessWidget with NavigationDrawerItem {
|
|
final Function(PreferredSizeWidget appBar, Widget body) _onChange;
|
|
|
|
const NavigationDrawer(this._onChange);
|
|
|
|
@override
|
|
String get title => 'Menü';
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
appBar: this.getAppBar(),
|
|
body: Container(
|
|
padding: EdgeInsets.all(UIShapes.paddingMax),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
_getListTile(Search(_onChange), null, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(ArticleListView(_onChange), null, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(CalendarListPage(), null, context),
|
|
Spacer(
|
|
flex: 3,
|
|
),
|
|
_getListTile(DasDorfListView(_onChange), Icons.arrow_forward_ios, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(PoiListView(_onChange), Icons.arrow_forward_ios, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(OrganisationListView(_onChange), Icons.arrow_forward_ios, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(CompanyListView(_onChange), Icons.arrow_forward_ios, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(BuergerFuerBuergerView(), null, context),
|
|
Spacer(
|
|
flex: 3,
|
|
),
|
|
_getListTile(SettingsView(), null, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(ImprintView(), null, context),
|
|
Spacer(
|
|
flex: 1,
|
|
),
|
|
_getListTile(ContactView(), null, context),
|
|
Spacer(
|
|
flex: 7,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
|
|
Widget _getListTile(NavigationDrawerItem item, IconData? icon, BuildContext context) =>
|
|
GestureDetector(
|
|
child: Row(children:
|
|
[
|
|
Expanded(
|
|
child:Text(
|
|
item.title.toUpperCase(),
|
|
style:
|
|
UITheme.theme.textTheme.headlineSmall?.apply(color: UIColors.grey4),
|
|
),),
|
|
Icon(icon, color: UIColors.grey4,),
|
|
]
|
|
),
|
|
onTap: () {
|
|
_onChange(
|
|
item.getAppBar(),
|
|
item,
|
|
);
|
|
Navigator.pop(context);
|
|
},
|
|
);
|
|
}
|
|
|
|
class NavigationBottomBar extends StatelessWidget {
|
|
final Function(PreferredSizeWidget appBar, Widget body) _onChange;
|
|
|
|
const NavigationBottomBar(onChange) : _onChange = onChange;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Container(
|
|
padding: EdgeInsets.fromLTRB(UIShapes.paddingMax, UIShapes.paddingMax,
|
|
UIShapes.paddingMax, UIShapes.paddingMax),
|
|
color: UIColors.grey6,
|
|
child: SafeArea( child: Row(
|
|
children: [
|
|
Spacer(),
|
|
_getListTile(ArticleListView(_onChange)),
|
|
Spacer(),
|
|
Text(
|
|
'|',
|
|
style: UITheme.theme.textTheme.titleLarge,
|
|
),
|
|
Spacer(),
|
|
_getListTile(CalendarListPage()),
|
|
Spacer(),
|
|
Text(
|
|
'|',
|
|
style: UITheme.theme.textTheme.titleLarge,
|
|
),
|
|
Spacer(),
|
|
_getListTile(ContactView()),
|
|
Spacer(),
|
|
],
|
|
),
|
|
),);
|
|
|
|
Widget _getListTile(NavigationDrawerItem item) =>
|
|
GestureDetector(
|
|
child: Text(
|
|
item.title.toUpperCase(),
|
|
style: UITheme.theme.textTheme.titleLarge,
|
|
),
|
|
onTap: () {
|
|
_onChange(
|
|
item.getAppBar(),
|
|
item,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
mixin NavigationDrawerItem on Widget {
|
|
String get title;
|
|
|
|
PreferredSizeWidget getAppBar({String? optionalTitle}) => HiddingselAppBar(Text(optionalTitle??title.toUpperCase()));
|
|
} |