flutter_elinux/lib/common/widgets/menu_drawer.dart
2024-03-09 14:29:48 +01:00

68 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../routing/routes.dart';
class MenuDrawer extends StatelessWidget {
const MenuDrawer({super.key});
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: <Widget>[
const DrawerHeader(
child: Column(
children: [],
)),
ListTile(
selected: GoRouterState.of(context).uri.toString() ==
GoRouter.of(context).namedLocation(RoutesHome.home.name),
title: const Text('Home'),
leading: const Icon(Icons.home),
onTap: () {
context.replaceNamed(RoutesHome.home.name);
},
),
ListTile(
selected: GoRouterState.of(context).uri.toString() ==
GoRouter.of(context).namedLocation(RoutesHome.news.name),
title: const Text('News'),
leading: const Icon(Icons.newspaper),
onTap: () {
context.replaceNamed(RoutesHome.news.name);
},
),
ListTile(
selected: GoRouterState.of(context).uri.toString() ==
GoRouter.of(context).namedLocation(RoutesHome.news.name),
title: const Text('Led'),
leading: const Icon(Icons.newspaper),
onTap: () {
context.replaceNamed(RoutesHome.led.name);
},
),
ListTile(
selected: GoRouterState.of(context).uri.toString() ==
GoRouter.of(context).namedLocation(RoutesHome.news.name),
title: const Text('Matrix'),
leading: const Icon(Icons.newspaper),
onTap: () {
context.replaceNamed(RoutesHome.matrix.name);
},
),
ListTile(
selected: GoRouterState.of(context).uri.toString() ==
GoRouter.of(context).namedLocation(RoutesHome.settings.name),
title: const Text('Settings'),
leading: const Icon(Icons.settings),
onTap: () {
context.replaceNamed(RoutesHome.settings.name);
},
),
],
),
);
}
}