aurcache/frontend/lib/components/routing/side_menu.dart
2024-02-24 23:48:16 +01:00

94 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import '../../constants/color_constants.dart';
class SideMenu extends StatelessWidget {
const SideMenu({
super.key,
});
@override
Widget build(BuildContext context) {
return Drawer(
child: SingleChildScrollView(
// it enables scrolling
child: Column(
children: [
const DrawerHeader(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: defaultPadding,
),
Icon(Icons.storage_sharp, size: 60, color: Colors.white54),
SizedBox(
height: defaultPadding,
),
Text("AURCache")
],
)),
DrawerListTile(
title: "Dashboard",
svgSrc: "assets/icons/menu_dashbord.svg",
press: () {
context.go("/");
},
),
DrawerListTile(
title: "Builds",
svgSrc: "assets/icons/menu_tran.svg",
press: () {
context.go("/builds");
},
),
DrawerListTile(
title: "AUR",
svgSrc: "assets/icons/menu_task.svg",
press: () {
context.go("/aur");
},
),
DrawerListTile(
title: "Settings",
svgSrc: "assets/icons/menu_setting.svg",
press: () {},
),
],
),
),
);
}
}
class DrawerListTile extends StatelessWidget {
const DrawerListTile({
super.key,
required this.title,
required this.svgSrc,
required this.press,
});
final String title, svgSrc;
final VoidCallback press;
@override
Widget build(BuildContext context) {
return ListTile(
onTap: press,
horizontalTitleGap: 0.0,
leading: SvgPicture.asset(
svgSrc,
color: Colors.white54,
height: 16,
),
title: Text(
title,
style: const TextStyle(color: Colors.white54),
),
);
}
}