-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Nailsonseat/admin-role
Admin Functions
- Loading branch information
Showing
41 changed files
with
4,125 additions
and
42 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
), | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 []; | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,)), | ||
]); | ||
} | ||
} |
Oops, something went wrong.