criado widgets dropdown_with_subtitle.dart, input_with_subtitle.dart, onbackbutton.dart, switch_with_subtitle.dart
criada as telas main_register_citizen_screen.dart e main_procedures_screen.dart
This commit is contained in:
@@ -10,7 +10,7 @@ import 'input_search_text.dart';
|
||||
class AlertDialogDefault {
|
||||
|
||||
@override
|
||||
alert(BuildContext context,controller,Widget list,) {
|
||||
alert_with_search(BuildContext context,controller,Widget list,) {
|
||||
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
@@ -40,4 +40,39 @@ class AlertDialogDefault {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
alert(BuildContext context,String title,String subtitle,String textButtom) {
|
||||
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context){
|
||||
return AlertDialog(
|
||||
title: TextDefault(
|
||||
text: title,
|
||||
color: ColorPalette.black54,
|
||||
textAlign: TextAlign.center,
|
||||
fontWeigth: FontWeight.bold,
|
||||
),
|
||||
content: TextDefault(
|
||||
text: subtitle,
|
||||
color: ColorPalette.black54,
|
||||
maxLines: 4,
|
||||
),
|
||||
actions: [
|
||||
ButtonDefault(
|
||||
onPressed: ()=>Navigator.pop(context),
|
||||
title: textButtom,
|
||||
width: width*0.85,
|
||||
textColor: ColorPalette.white,
|
||||
borderColor: ColorPalette.appBar,
|
||||
background: ColorPalette.appBar,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
68
lib/widgets/dropdown_with_subtitle.dart
Normal file
68
lib/widgets/dropdown_with_subtitle.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import '../utils/color_palette.dart';
|
||||
import '../utils/const_variable.dart';
|
||||
import 'dropdown_button_default.dart';
|
||||
import 'input_text.dart';
|
||||
|
||||
class DropdownWithSubtitle extends StatelessWidget {
|
||||
String subtitle;
|
||||
String hintDropdown;
|
||||
String? select;
|
||||
double widthSubtitle;
|
||||
double widthDropdown;
|
||||
double widthContainerDropdown;
|
||||
List<String> list;
|
||||
var onChanged;
|
||||
|
||||
DropdownWithSubtitle({
|
||||
required this.subtitle,
|
||||
required this.select,
|
||||
required this.widthDropdown,
|
||||
required this.widthContainerDropdown,
|
||||
required this.widthSubtitle,
|
||||
required this.hintDropdown,
|
||||
required this.onChanged,
|
||||
required this.list,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 10),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||
child: Column(
|
||||
children: [
|
||||
// Container(
|
||||
// width: widthSubtitle,
|
||||
// height: 40,
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: TextDefault(
|
||||
// text: subtitle,
|
||||
// color: ColorPalette.black54,
|
||||
// fontSize: 18,
|
||||
// fontWeigth: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: ColorPalette.black54)
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 5),
|
||||
padding: EdgeInsets.symmetric(horizontal: 2),
|
||||
child: DropDownButtonDefault(
|
||||
title: hintDropdown,
|
||||
fontSize: 15,
|
||||
width: widthDropdown,
|
||||
widthContainer: widthContainerDropdown,
|
||||
select: select,
|
||||
list: list,
|
||||
onChanged: onChanged,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ class InputText extends StatelessWidget {
|
||||
double width;
|
||||
String label;
|
||||
String error;
|
||||
bool enable;
|
||||
TextInputType textInputType;
|
||||
int maxLines;
|
||||
|
||||
InputText({
|
||||
required this.controller,
|
||||
@@ -19,6 +22,9 @@ class InputText extends StatelessWidget {
|
||||
this.hint = '',
|
||||
this.label = '',
|
||||
this.error = '',
|
||||
this.enable = true,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines = 1,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -28,6 +34,8 @@ class InputText extends StatelessWidget {
|
||||
margin: ConstVariable().marginHightInput,
|
||||
width: width,
|
||||
child: TextFormField(
|
||||
keyboardType: textInputType,
|
||||
maxLines: maxLines,
|
||||
validator: (value) {
|
||||
if (value!=null && value!.length==0) {
|
||||
return error;
|
||||
@@ -45,6 +53,7 @@ class InputText extends StatelessWidget {
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(),
|
||||
hintText: this.hint,
|
||||
enabled: enable,
|
||||
hintStyle: TextStyle(
|
||||
color: ColorPalette.gray,
|
||||
fontSize: this.fontSize,
|
||||
|
||||
60
lib/widgets/input_with_subtitle.dart
Normal file
60
lib/widgets/input_with_subtitle.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import '../utils/color_palette.dart';
|
||||
import 'input_text.dart';
|
||||
|
||||
class InputWithSubtitle extends StatelessWidget {
|
||||
String subtitle;
|
||||
String hintInput;
|
||||
String errorInput;
|
||||
String labelInput;
|
||||
double widthSubtitle;
|
||||
double widthInput;
|
||||
var controller;
|
||||
bool enable;
|
||||
TextInputType textInputType;
|
||||
int maxLines;
|
||||
|
||||
InputWithSubtitle({
|
||||
required this.subtitle,
|
||||
required this.hintInput,
|
||||
required this.errorInput,
|
||||
required this.labelInput,
|
||||
required this.widthSubtitle,
|
||||
required this.widthInput,
|
||||
required this.controller,
|
||||
this.enable = true,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines = 1,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Container(
|
||||
// width: widthSubtitle,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 8.0,vertical: 3),
|
||||
// child: TextDefault(
|
||||
// text: subtitle,
|
||||
// color: ColorPalette.black54,
|
||||
// fontSize: 18,
|
||||
// fontWeigth: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
InputText(
|
||||
controller: controller,
|
||||
width: widthInput,
|
||||
hint: hintInput,
|
||||
error: errorInput,
|
||||
label: labelInput,
|
||||
enable: enable,
|
||||
textInputType: textInputType,
|
||||
maxLines:maxLines
|
||||
),
|
||||
Divider(color: ColorPalette.black54,height: 5,endIndent: 10,)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
35
lib/widgets/onbackbutton.dart
Normal file
35
lib/widgets/onbackbutton.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
|
||||
import '../utils/color_palette.dart';
|
||||
import 'button_default.dart';
|
||||
|
||||
class OnBackButton{
|
||||
onBackButton(context)async {
|
||||
bool exiApp = await showDialog(
|
||||
context: context,
|
||||
builder: (context){
|
||||
return AlertDialog(
|
||||
title: TextDefault(text: 'Aviso',color: ColorPalette.black54,textAlign: TextAlign.center,),
|
||||
content: TextDefault(text: 'Deseja sair e descartar as alterações?',color: ColorPalette.black54,),
|
||||
actions: [
|
||||
ButtonDefault(
|
||||
onPressed: ()=>Navigator.pushNamedAndRemoveUntil(context, '/home', (route) => false),
|
||||
title: 'Sim',
|
||||
background: ColorPalette.appBar,
|
||||
borderColor: ColorPalette.appBar,
|
||||
textColor: ColorPalette.white,
|
||||
),
|
||||
ButtonDefault(
|
||||
onPressed: ()=>Navigator.of(context).pop(false),
|
||||
title: 'Não',
|
||||
background: ColorPalette.white,
|
||||
borderColor: ColorPalette.white,
|
||||
textColor: ColorPalette.black54,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/widgets/switch_with_subtitle.dart
Normal file
34
lib/widgets/switch_with_subtitle.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/utils/color_palette.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
|
||||
class SwitchWithSubtitle extends StatelessWidget {
|
||||
double width;
|
||||
bool value;
|
||||
var onChanged;
|
||||
String title;
|
||||
|
||||
SwitchWithSubtitle({
|
||||
required this.onChanged,
|
||||
required this.value,
|
||||
required this.width,
|
||||
required this.title
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: width,
|
||||
child: Row(
|
||||
children: [
|
||||
TextDefault(text: title,color: ColorPalette.black54,),
|
||||
Spacer(),
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged:onChanged
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user