Skip to content
Snippets Groups Projects
Commit 09beb524 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

do not let drawer appbar scroll

parent cf1b0a57
No related branches found
No related tags found
No related merge requests found
......@@ -78,16 +78,19 @@ class _RootPageState extends State<RootPage> {
return FadeRoute(
builder: (BuildContext context) =>
PrinterDetailsPage(printer: args.printer),
settings: settings,
);
} else if (settings.name == UserDetailsPage.routeName) {
final args = settings.arguments as UserDetailsArguments;
return FadeRoute(
builder: (BuildContext context) => UserDetailsPage(user: args.user),
settings: settings,
);
} else if (settings.name == AdminDetailsPage.routeName) {
final args = settings.arguments as AdminDetailsArguments;
return FadeRoute(
builder: (BuildContext context) => AdminDetailsPage(admin: args.admin),
settings: settings,
);
} else {
return FadeRoute(builder: routes[settings.name], settings: settings);
......
......@@ -16,73 +16,78 @@ class MainDrawer extends StatelessWidget {
Widget build(BuildContext context) {
final AuthBloc authBloc = BlocProvider.of<AuthBloc>(context);
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
AppBar(),
drawer.DrawerHeader(),
ListTile(
title: Text('Dashboard'),
trailing: Icon(Icons.dashboard_rounded),
onTap: () => _popAndPushNamed(DashboardPage.routeName)),
ListTile(
title: Text('Benutzer'),
trailing: Icon(Icons.person_rounded),
onTap: () => _popAndPushNamed(UserListPage.routeName),
),
ListTile(
title: Text('Drucker'),
trailing: Icon(Icons.print_rounded),
onTap: () => _popAndPushNamed(PrinterListPage.routeName),
),
ListTile(
title: Text('Transaktionen'),
trailing: Icon(Icons.history_edu_rounded),
onTap: () => _popAndPushNamed(JournalListPage.routeName),
),
ListTile(
title: Text('Dokumentenverarbeitung'),
trailing: Icon(Icons.task_rounded),
onTap: () => _popAndPushNamed(DispatcherListPage.routeName),
),
ListTile(
title: Text('Admins'),
trailing: Icon(Icons.supervised_user_circle_rounded),
onTap: () => _popAndPushNamed(AdminListPage.routeName),
),
Divider(),
ListTile(
title: Text('Über'),
trailing: Icon(Icons.help),
onTap: () async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
showDialog(
context: context,
builder: (BuildContext context) {
return AboutDialog(
applicationName: 'AStAPrint Admin',
applicationVersion: '${packageInfo.version}+${packageInfo.buildNumber}',
applicationLegalese: '© AStA Paderborn 2022',
child: Column(
children: [
AppBar(),
Expanded(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
drawer.DrawerHeader(),
ListTile(
title: Text('Dashboard'),
trailing: Icon(Icons.dashboard_rounded),
onTap: () => _popAndPushNamed(DashboardPage.routeName)),
ListTile(
title: Text('Benutzer'),
trailing: Icon(Icons.person_rounded),
onTap: () => _popAndPushNamed(UserListPage.routeName),
),
ListTile(
title: Text('Drucker'),
trailing: Icon(Icons.print_rounded),
onTap: () => _popAndPushNamed(PrinterListPage.routeName),
),
ListTile(
title: Text('Transaktionen'),
trailing: Icon(Icons.history_edu_rounded),
onTap: () => _popAndPushNamed(JournalListPage.routeName),
),
ListTile(
title: Text('Dokumentenverarbeitung'),
trailing: Icon(Icons.task_rounded),
onTap: () => _popAndPushNamed(DispatcherListPage.routeName),
),
ListTile(
title: Text('Admins'),
trailing: Icon(Icons.supervised_user_circle_rounded),
onTap: () => _popAndPushNamed(AdminListPage.routeName),
),
Divider(),
ListTile(
title: Text('Über'),
trailing: Icon(Icons.help),
onTap: () async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
showDialog(
context: context,
builder: (BuildContext context) {
return AboutDialog(
applicationName: 'AStAPrint Admin',
applicationVersion: '${packageInfo.version}+${packageInfo.buildNumber}',
applicationLegalese: '© AStA Paderborn 2022',
);
},
);
},
);
},
),
Divider(),
ListTile(
title: Text('Logout'),
trailing: Icon(Icons.exit_to_app),
onTap: () async {
authBloc.logout();
(await SharedPreferences.getInstance())
..remove('token')
..remove('username');
Navigator.of(navigatorKey.currentContext).popUntil(ModalRoute.withName('/'));
},
),
Divider(),
ListTile(
title: Text('Logout'),
trailing: Icon(Icons.exit_to_app),
onTap: () async {
authBloc.logout();
(await SharedPreferences.getInstance())
..remove('token')
..remove('username');
Navigator.of(navigatorKey.currentContext).popUntil(ModalRoute.withName('/'));
},
),
],
),
],
),
);
),
],
));
}
void _popAndPushNamed(String name) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment