add github action
This commit is contained in:
@ -1,63 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum ButtonType { PRIMARY, PLAIN }
|
||||
|
||||
class AppButton extends StatelessWidget {
|
||||
final ButtonType? type;
|
||||
final VoidCallback? onPressed;
|
||||
final String? text;
|
||||
|
||||
AppButton({this.type, this.onPressed, this.text});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: this.onPressed,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 45,
|
||||
decoration: BoxDecoration(
|
||||
color: getButtonColor(context, type!),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
//color: Color.fromRGBO(169, 176, 185, 0.42),
|
||||
//spreadRadius: 0,
|
||||
//blurRadius: 3.0,
|
||||
//offset: Offset(0, 2),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Text(this.text!,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.subtitle1!
|
||||
.copyWith(color: getTextColor(context, type!))),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Color getButtonColor(context, ButtonType type) {
|
||||
switch (type) {
|
||||
case ButtonType.PRIMARY:
|
||||
return Theme.of(context).buttonTheme.colorScheme!.background;
|
||||
case ButtonType.PLAIN:
|
||||
return Colors.white;
|
||||
default:
|
||||
return Theme.of(context).primaryColor;
|
||||
}
|
||||
}
|
||||
|
||||
Color getTextColor(context, ButtonType type) {
|
||||
switch (type) {
|
||||
case ButtonType.PLAIN:
|
||||
return Theme.of(context).primaryColor;
|
||||
case ButtonType.PRIMARY:
|
||||
return Colors.white;
|
||||
default:
|
||||
return Theme.of(context).buttonTheme.colorScheme!.background;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import 'package:aurcache/api/builds.dart';
|
||||
import 'package:aurcache/models/build.dart';
|
||||
import 'package:aurcache/components/dashboard/your_packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../api/API.dart';
|
||||
import '../../constants/color_constants.dart';
|
||||
@ -82,7 +83,7 @@ class _RecentBuildsState extends State<RecentBuilds> {
|
||||
.toList(),
|
||||
);
|
||||
} else {
|
||||
return Text("no data");
|
||||
return const Text("no data");
|
||||
}
|
||||
}),
|
||||
),
|
||||
@ -102,7 +103,9 @@ class _RecentBuildsState extends State<RecentBuilds> {
|
||||
switchSuccessIcon(build.status),
|
||||
color: switchSuccessColor(build.status),
|
||||
),
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
context.push("/build/${build.id}");
|
||||
},
|
||||
)),
|
||||
],
|
||||
);
|
||||
|
@ -1,94 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../constants/color_constants.dart';
|
||||
|
||||
class InputWidget extends StatelessWidget {
|
||||
final String? hintText;
|
||||
final String? errorText;
|
||||
final Widget? prefixIcon;
|
||||
final double? height;
|
||||
final String? topLabel;
|
||||
final bool? obscureText;
|
||||
final FormFieldSetter<String>? onSaved;
|
||||
final ValueChanged<String>? onChanged;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final TextInputType? keyboardType;
|
||||
final Key? kKey;
|
||||
final TextEditingController? kController;
|
||||
final String? kInitialValue;
|
||||
|
||||
InputWidget({
|
||||
this.hintText,
|
||||
this.prefixIcon,
|
||||
this.height = 48.0,
|
||||
this.topLabel = "",
|
||||
this.obscureText = false,
|
||||
required this.onSaved,
|
||||
this.keyboardType,
|
||||
this.errorText,
|
||||
this.onChanged,
|
||||
this.validator,
|
||||
this.kKey,
|
||||
this.kController,
|
||||
this.kInitialValue,
|
||||
});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(this.topLabel!),
|
||||
SizedBox(height: 4.0),
|
||||
Container(
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: secondaryColor,
|
||||
//color: Theme.of(context).buttonColor,
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
child: TextFormField(
|
||||
initialValue: this.kInitialValue,
|
||||
controller: this.kController,
|
||||
key: this.kKey,
|
||||
keyboardType: this.keyboardType,
|
||||
onSaved: this.onSaved,
|
||||
onChanged: this.onChanged,
|
||||
validator: this.validator,
|
||||
obscureText: this.obscureText!,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: this.prefixIcon,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(74, 77, 84, 0.2),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
//gapPadding: 16,
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
errorStyle: TextStyle(height: 0, color: Colors.transparent),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).errorColor,
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
//gapPaddings: 16,
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).errorColor,
|
||||
),
|
||||
),
|
||||
hintText: this.hintText,
|
||||
hintStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1!
|
||||
.copyWith(color: Colors.white54),
|
||||
errorText: this.errorText),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
36
frontend/lib/components/menu_shell.dart
Normal file
36
frontend/lib/components/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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
37
frontend/lib/components/router.dart
Normal file
37
frontend/lib/components/router.dart
Normal file
@ -0,0 +1,37 @@
|
||||
import 'package:aurcache/screens/build_screen.dart';
|
||||
import 'package:aurcache/screens/dashboard_screen.dart';
|
||||
import 'package:aurcache/components/menu_shell.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(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'build/:id',
|
||||
builder: (context, state) {
|
||||
final id = int.parse(state.pathParameters['id']!);
|
||||
return BuildScreen(buildID: id);
|
||||
},
|
||||
),
|
||||
]
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../constants/color_constants.dart';
|
||||
|
||||
@ -35,7 +36,9 @@ class SideMenu extends StatelessWidget {
|
||||
DrawerListTile(
|
||||
title: "Dashboard",
|
||||
svgSrc: "assets/icons/menu_dashbord.svg",
|
||||
press: () {},
|
||||
press: () {
|
||||
context.go("/");
|
||||
},
|
||||
),
|
||||
DrawerListTile(
|
||||
title: "Builds",
|
||||
|
@ -1,34 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../constants/color_constants.dart';
|
||||
|
||||
class Wrapper extends StatelessWidget {
|
||||
final Widget? title;
|
||||
final Widget child;
|
||||
|
||||
const Wrapper({Key? key, this.title, required this.child}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(defaultPadding),
|
||||
decoration: BoxDecoration(
|
||||
color: Palette.wrapperBg,
|
||||
borderRadius: BorderRadius.circular(defaultBorderRadius),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (title != null)
|
||||
Column(
|
||||
children: [
|
||||
title!,
|
||||
const SizedBox(height: defaultPadding),
|
||||
],
|
||||
),
|
||||
child
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user