aurcache/frontend/lib/components/routing/side_menu.dart

94 lines
2.3 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
2023-12-30 15:46:13 +00:00
import 'package:go_router/go_router.dart';
import '../../constants/color_constants.dart';
class SideMenu extends StatelessWidget {
const SideMenu({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
child: SingleChildScrollView(
// it enables scrolling
child: Column(
children: [
2023-12-29 17:13:51 +00:00
const DrawerHeader(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SizedBox(
// height: defaultPadding * 3,
// ),
// Image.asset(
// "assets/logo/logo_icon.png",
// scale: 5,
// ),
SizedBox(
height: defaultPadding,
),
2023-12-29 17:13:51 +00:00
Text("AURCache")
],
)),
DrawerListTile(
title: "Dashboard",
svgSrc: "assets/icons/menu_dashbord.svg",
2023-12-30 15:46:13 +00:00
press: () {
context.go("/");
},
),
DrawerListTile(
title: "Builds",
svgSrc: "assets/icons/menu_tran.svg",
press: () {},
),
DrawerListTile(
title: "AUR",
svgSrc: "assets/icons/menu_task.svg",
press: () {},
),
DrawerListTile(
title: "Settings",
svgSrc: "assets/icons/menu_setting.svg",
press: () {},
),
],
),
),
);
}
}
class DrawerListTile extends StatelessWidget {
const DrawerListTile({
Key? key,
// For selecting those three line once press "Command+D"
required this.title,
required this.svgSrc,
required this.press,
}) : super(key: key);
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),
),
);
}
}