add frontend and put backend in seperate folder

This commit is contained in:
2023-12-27 16:45:55 +01:00
parent d409d08572
commit 6faa995b19
88 changed files with 2993 additions and 12 deletions

View File

@ -0,0 +1,63 @@
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;
}
}

View File

@ -0,0 +1,94 @@
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),
),
)
],
);
}
}

View File

@ -0,0 +1,34 @@
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
],
),
);
}
}