remove builds from db if pkg is deleted
fix apibuilder interval refreshes refreshing widgets not visible
This commit is contained in:
36
frontend/lib/components/routing/menu_shell.dart
Normal file
36
frontend/lib/components/routing/menu_shell.dart
Normal file
@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../utils/responsive.dart';
|
||||
import '../../screens/dashboard_screen.dart';
|
||||
import 'side_menu.dart';
|
||||
|
||||
class MenuShell extends StatelessWidget {
|
||||
const MenuShell({super.key, required this.child});
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: const SideMenu(),
|
||||
body: SafeArea(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// We want this side menu only for large screen
|
||||
if (Responsive.isDesktop(context))
|
||||
const Expanded(
|
||||
// default flex = 1
|
||||
// and it takes 1/6 part of the screen
|
||||
child: SideMenu(),
|
||||
),
|
||||
Expanded(
|
||||
// It takes 5/6 part of the screen
|
||||
flex: 5,
|
||||
child: child,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
48
frontend/lib/components/routing/router.dart
Normal file
48
frontend/lib/components/routing/router.dart
Normal file
@ -0,0 +1,48 @@
|
||||
import 'package:aurcache/screens/build_screen.dart';
|
||||
import 'package:aurcache/screens/builds_screen.dart';
|
||||
import 'package:aurcache/screens/dashboard_screen.dart';
|
||||
import 'package:aurcache/components/routing/menu_shell.dart';
|
||||
import 'package:aurcache/screens/package_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>();
|
||||
final GlobalKey<NavigatorState> _shellNavigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
|
||||
final appRouter = GoRouter(
|
||||
navigatorKey: _rootNavigatorKey,
|
||||
initialLocation: '/',
|
||||
routes: [
|
||||
ShellRoute(
|
||||
navigatorKey: _shellNavigatorKey,
|
||||
builder: (context, state, child) {
|
||||
return MenuShell(child: child);
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (context, state) => DashboardScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/build/:id',
|
||||
builder: (context, state) {
|
||||
final id = int.parse(state.pathParameters['id']!);
|
||||
return BuildScreen(buildID: id);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/builds',
|
||||
builder: (context, state) => const BuildsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/package/:id',
|
||||
builder: (context, state) {
|
||||
final id = int.parse(state.pathParameters['id']!);
|
||||
return PackageScreen(pkgID: id);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
93
frontend/lib/components/routing/side_menu.dart
Normal file
93
frontend/lib/components/routing/side_menu.dart
Normal file
@ -0,0 +1,93 @@
|
||||
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({
|
||||
Key? key,
|
||||
}) : super(key: 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 * 3,
|
||||
// ),
|
||||
// Image.asset(
|
||||
// "assets/logo/logo_icon.png",
|
||||
// scale: 5,
|
||||
// ),
|
||||
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: () {},
|
||||
),
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user