Skip to content

Commit

Permalink
Merge pull request #13 from Nailsonseat/admin-role
Browse files Browse the repository at this point in the history
Admin Functions
  • Loading branch information
henilp105 authored Jan 31, 2024
2 parents d399d7e + dcbd599 commit bb4fabc
Show file tree
Hide file tree
Showing 41 changed files with 4,125 additions and 42 deletions.
Binary file added frontend/lib/assets/fonts/google_sans_flex.ttf
Binary file not shown.
Binary file added frontend/lib/assets/fonts/roboto_flex.ttf
Binary file not shown.
Binary file added frontend/lib/assets/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions frontend/lib/components/borderless_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';

class BorderlessButton extends StatelessWidget {
const BorderlessButton(
{super.key,
required this.backgroundColor,
required this.onPressed,
required this.splashColor,
required this.label});

final Color backgroundColor;
final Color splashColor;
final Function() onPressed;
final Text label;

@override
Widget build(BuildContext context) {
return OutlinedButton(
style: OutlinedButton.styleFrom(
foregroundColor: splashColor,
backgroundColor: backgroundColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
side: const BorderSide(color: Colors.transparent, width: 0),
),
onPressed: onPressed,
child: label,
);
}
}
60 changes: 60 additions & 0 deletions frontend/lib/components/choice_selector.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
import 'package:search_choices/search_choices.dart';

class ChoiceSelector extends StatelessWidget {

const ChoiceSelector({super.key, required this.onChanged, required this.value,required this.items, required this.hint});

final Function onChanged;
final List<DropdownMenuItem<String>> items;
final String? value;
final String hint;

@override
Widget build(BuildContext context) {
return Theme(
data: Theme.of(context).copyWith(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
),
child: SearchChoices.single(
style: TextStyle(
color: Colors.teal.shade900,
fontSize: 15,
fontFamily: "RobotoFlex",
),
items: items,
value: value,
hint: hint,
searchHint: null,
onChanged: (value) => onChanged(value),
dialogBox: false,
isExpanded: true,
displayClearIcon: false,
fieldPresentationFn: (Widget fieldWidget, {bool? selectionIsValid}) {
return InputDecorator(
decoration: InputDecoration(
hintStyle: TextStyle(
color: Colors.teal.shade900,
fontSize: 15,
fontFamily: "RobotoFlex",
),
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
isDense: true,
filled: true,
fillColor: Colors.tealAccent.withOpacity(0.4),
border: const OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.all(Radius.circular(15)),
),
),
child: fieldWidget,
);
},
menuConstraints: BoxConstraints.tight(const Size.fromHeight(350)),
validator:null,
menuBackgroundColor: Colors.tealAccent.shade100,
),
);
}
}
32 changes: 32 additions & 0 deletions frontend/lib/components/collapsing_app_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';

class CollapsingAppBar extends StatelessWidget {
const CollapsingAppBar({super.key, required this.bottom, this.height, this.leading, required this.body, this.title});

final Widget bottom;
final double? height;
final Widget? leading;
final Widget body;
final Text? title;

@override
Widget build(BuildContext context) {
return SliverAppBar(
title: title,
titleSpacing: 0,
leading: leading,
backgroundColor: Colors.white,
surfaceTintColor: Colors.white,
expandedHeight: height ?? 300,
floating: true,
pinned: true,
bottom: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: bottom,
),
flexibleSpace: FlexibleSpaceBar(
background: body,
),
);
}
}
54 changes: 54 additions & 0 deletions frontend/lib/components/material_textformfield.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';

class MaterialTextFormField extends StatelessWidget {
const MaterialTextFormField(
{super.key,
this.controller,
this.validator,
required this.hintText,
this.onChanged,
this.onSubmitted,
this.contentPadding,
this.hintColor});

final TextEditingController? controller;
final String? Function(String?)? validator;
final Function? onChanged;
final Function? onSubmitted;
final String hintText;
final Color? hintColor;
final EdgeInsets? contentPadding;

@override
Widget build(BuildContext context) {
return TextFormField(
controller: controller,
maxLines: 1,
onChanged: (value) => onChanged != null ? onChanged!(value) : null,
validator: (value) => validator != null ? validator!(value) : null,
onFieldSubmitted: (value) => onSubmitted != null ? onSubmitted!(value) : null,
cursorColor: Colors.teal.shade900,
style: TextStyle(
color: Colors.teal.shade900,
fontSize: 15,
fontFamily: "RobotoFlex",
decoration: TextDecoration.none,
),
decoration: InputDecoration(
contentPadding: contentPadding ?? const EdgeInsets.all(20),
hintText: hintText,
filled: true,
hintStyle: TextStyle(
color: hintColor ?? Colors.teal.shade900,
fontSize: 15,
fontFamily: "RobotoFlex",
),
fillColor: Colors.tealAccent.withOpacity(0.4),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
borderSide: BorderSide.none,
),
),
);
}
}
45 changes: 45 additions & 0 deletions frontend/lib/components/menu_tile.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';

class MenuTile extends StatelessWidget {
const MenuTile(
{super.key, required this.title, this.icon, required this.onTap, this.primaryColor ,this.secondaryColor });

final String title;
final IconData? icon;
final Function onTap;
final Color? primaryColor;
final Color? secondaryColor;

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10),
child: Material(
borderRadius: BorderRadius.circular(15),
child: Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color:primaryColor ?? Colors.grey[100],
),
child: InkWell(
overlayColor: MaterialStateProperty.all<Color?>(secondaryColor ?? Colors.grey[300]),
borderRadius: BorderRadius.circular(15),
splashColor: secondaryColor ?? Colors.grey[200],
onTap: () => onTap(),
child: Center(
child: Text(
title,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.black,
fontSize: 21,
fontFamily: "GoogleSansFlex",
),
),
),
),
),
),
);
}
}
14 changes: 14 additions & 0 deletions frontend/lib/components/multiple_choice_selector.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
import 'package:search_choices/search_choices.dart';




class MultipleChoiceSelector extends StatelessWidget {
const MultipleChoiceSelector({super.key});

@override
Widget build(BuildContext context) {
return SearchChoices.multiple();
}
}
26 changes: 26 additions & 0 deletions frontend/lib/components/rounded_chip.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';

class RoundedChip extends StatelessWidget {
const RoundedChip({super.key, required this.label, required this.onDeleted, required this.color});

final String label;
final Function() onDeleted;
final Color color;

@override
Widget build(BuildContext context) {
return Theme(
data: ThemeData(splashFactory: InkRipple.splashFactory,splashColor: color.withOpacity(0.5)),
child: Chip(
label: Text(label),
onDeleted: () => onDeleted(),
side: BorderSide.none,
color: MaterialStateProperty.all<Color>(color),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: BorderSide.none,
),
),
);
}
}
52 changes: 52 additions & 0 deletions frontend/lib/components/suggestion_text_field.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:logger/logger.dart';

class SuggestionTextField extends StatelessWidget {
const SuggestionTextField({super.key, required this.controller});

final TextEditingController controller;

@override
Widget build(BuildContext context) {
return TypeAheadField<String?>(
builder: (context, controller, focusNode) {
return TextFormField(
controller: controller,
focusNode: focusNode,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter branch';
}
return null;
},
decoration: InputDecoration(
contentPadding: const EdgeInsets.all(20),
hintText: "Enter branch",
filled: true,
hintStyle: TextStyle(
color: Colors.teal.shade900,
fontSize: 15,
fontFamily: "RobotoFlex",
),
fillColor: Colors.tealAccent.withOpacity(0.4),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
borderSide: BorderSide.none,
),
),
);
},
itemBuilder: (BuildContext context, value) {
return ListTile(title: Text(value ?? "Null"));
},
onSelected: (Object? value) {
final logger = Logger();
logger.i(value.toString());
},
suggestionsCallback: (String search) {
return [];
},
);
}
}
27 changes: 27 additions & 0 deletions frontend/lib/components/text_divider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';

class TextDivider extends StatelessWidget {
const TextDivider({super.key, required this.text});

final String text;

@override
Widget build(BuildContext context) {
return Row(children: <Widget>[
const Expanded(child: Divider(color: Colors.black,thickness: 0.1,)),
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.black,
width: 0.5,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(text),
)),
const Expanded(child: Divider(color: Colors.black,thickness: 0.1,)),
]);
}
}
Loading

0 comments on commit bb4fabc

Please sign in to comment.