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:
Reginaldo
2023-03-24 22:54:42 -03:00
parent 9677a9ce71
commit 13e9eb4b24
13 changed files with 1550 additions and 40 deletions

View File

@@ -3,6 +3,7 @@ import 'package:intl/intl.dart';
import 'package:rkm/utils/const_variable.dart'; import 'package:rkm/utils/const_variable.dart';
import 'package:rkm/widgets/appbar_default.dart'; import 'package:rkm/widgets/appbar_default.dart';
import 'package:rkm/widgets/input_text.dart'; import 'package:rkm/widgets/input_text.dart';
import 'package:rkm/widgets/onbackbutton.dart';
import 'package:rkm/widgets/text_default.dart'; import 'package:rkm/widgets/text_default.dart';
import '../utils/color_palette.dart'; import '../utils/color_palette.dart';
import '../widgets/button_default.dart'; import '../widgets/button_default.dart';
@@ -44,34 +45,7 @@ class _EditProceduresScreenState extends State<EditProceduresScreen> {
String formattedDate = DateFormat('dd/MM/yyyy').format(data); String formattedDate = DateFormat('dd/MM/yyyy').format(data);
return formattedDate; return formattedDate;
} }
onBackButton(BuildContext 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,
),
],
);
}
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -79,7 +53,7 @@ class _EditProceduresScreenState extends State<EditProceduresScreen> {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return WillPopScope( return WillPopScope(
onWillPop: ()=> onBackButton(context), onWillPop: ()=> OnBackButton().onBackButton(context),
child: Scaffold( child: Scaffold(
appBar: AppBarDefault().appbar(context, 'RKM AB - Procedimentos Consolidados'), appBar: AppBarDefault().appbar(context, 'RKM AB - Procedimentos Consolidados'),
body: Container( body: Container(
@@ -316,7 +290,7 @@ class _EditProceduresScreenState extends State<EditProceduresScreen> {
width: width, width: width,
), ),
ButtonDefault( ButtonDefault(
onPressed: (){}, onPressed: ()=>Navigator.pop(context),
title: 'Cancelar', title: 'Cancelar',
background: ColorPalette.blackButton, background: ColorPalette.blackButton,
borderColor: ColorPalette.blackButton, borderColor: ColorPalette.blackButton,

View File

@@ -1,12 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rkm/utils/color_palette.dart';
import 'package:rkm/utils/const_variable.dart'; import 'package:rkm/utils/const_variable.dart';
import 'package:rkm/widgets/icon_button_default.dart'; import 'package:rkm/widgets/icon_button_default.dart';
import 'package:rkm/widgets/input_search_text.dart'; import 'package:rkm/widgets/input_search_text.dart';
import 'package:rkm/widgets/input_text.dart';
import '../widgets/appbar_default.dart'; import '../widgets/appbar_default.dart';
import '../widgets/item_citizen.dart'; import '../widgets/item_citizen.dart';
import 'main_register_citizen_screen.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key); const HomeScreen({Key? key}) : super(key: key);
@@ -42,7 +40,10 @@ class _HomeScreenState extends State<HomeScreen> {
), ),
IconButtonDefault( IconButtonDefault(
icon: Icons.person_add, icon: Icons.person_add,
onPressed: (){} onPressed: ()=> Navigator.push(
context,
MaterialPageRoute(builder: (context) => MainRegisterCitizenScreen(screens: 1,)),
)
), ),
IconButtonDefault( IconButtonDefault(
icon: Icons.article, icon: Icons.article,

View File

@@ -69,7 +69,7 @@ class _MainProceduresScreenState extends State<MainProceduresScreen> {
), ),
Divider(color: ColorPalette.black54,endIndent: 10,indent: 10,height: 1), Divider(color: ColorPalette.black54,endIndent: 10,indent: 10,height: 1),
GestureDetector( GestureDetector(
onTap: ()=>AlertDialogDefault().alert( onTap: ()=>AlertDialogDefault().alert_with_search(
context, context,
controllerProceduresSearch, controllerProceduresSearch,
ListView.separated( ListView.separated(
@@ -123,7 +123,7 @@ class _MainProceduresScreenState extends State<MainProceduresScreen> {
SubtitleContainers(title: 'Procedimento') SubtitleContainers(title: 'Procedimento')
), ),
GestureDetector( GestureDetector(
onTap: ()=>AlertDialogDefault().alert( onTap: ()=>AlertDialogDefault().alert_with_search(
context, context,
controllerCBOSearch, controllerCBOSearch,
ListView.separated( ListView.separated(

View File

@@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:rkm/screens/register_citizen_screen.dart';
import 'package:rkm/utils/color_palette.dart';
import 'package:rkm/widgets/text_default.dart';
import '../widgets/alert_dialog_settings.dart';
import '../widgets/icon_button_default.dart';
class MainRegisterCitizenScreen extends StatefulWidget {
int screens;
MainRegisterCitizenScreen({
required this.screens
});
@override
State<MainRegisterCitizenScreen> createState() => _MainRegisterCitizenScreenState();
}
class _MainRegisterCitizenScreenState extends State<MainRegisterCitizenScreen> {
int index = 1;
TabBar get _tabBar => TabBar(
labelColor: index==1?ColorPalette.gray:ColorPalette.blackButton,
unselectedLabelColor: ColorPalette.gray,
indicatorColor: ColorPalette.white,
tabs: [
Tab(text: 'Cadastro Cidadão',icon: Icon(Icons.person),iconMargin: EdgeInsets.zero,height: 50,),
Tab(text: 'Cadastro Individual',icon: Icon(Icons.article),iconMargin: EdgeInsets.zero,height: 40,),
Tab(text: 'Cadastro Domiciliar',icon: Icon(Icons.home),iconMargin: EdgeInsets.zero,height: 40,)
],
);
updateIndex(){
setState(() {
index = widget.screens;
});
}
@override
void initState() {
super.initState();
updateIndex();
}
@override
Widget build(BuildContext context) =>DefaultTabController(
length: 1,
child: Scaffold(
appBar: AppBar(
title: TextDefault(text: 'RKM AB - Cadastro Cidadão',color: ColorPalette.white,),
centerTitle: true,
actions: [
IconButtonDefault(
icon: Icons.settings,
color: ColorPalette.white,
onPressed: ()=>AlertDialogSettings().alert(context)
),
IconButtonDefault(
icon: Icons.logout,
color: ColorPalette.white,
onPressed: ()=>Navigator.pushNamedAndRemoveUntil(context, '/login',(Route<dynamic> route) => false)),
],
bottom: PreferredSize(
preferredSize: _tabBar.preferredSize,
child: Material(
color: ColorPalette.white, //<-- SEE HERE
child: _tabBar,
),
),
),
body:index==1 ?
TabBarView(
children: [
RegisterCitizenScreen(),
],
):TabBarView(
children: [
RegisterCitizenScreen(),
Center(child: Text('2'),),
Center(child: Text('3'),),
],
),
)
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,53 @@ class ConstVariable{
'ATENDIMENTO INDIVIDUAL', 'ATENDIMENTO INDIVIDUAL',
'VISTA DOMICILIAR' 'VISTA DOMICILIAR'
]; ];
List<String> listNationality =[
'BRASILEIRO',
'ESTRANGEIRO',
'NATURALIZADO',
];
List<String> listBreed = [
'AMARELA',
'BRANCA',
'INDIGENA',
'NEGRA',
'PARDA',
];
List<String> listScooling = [
'ENSINO FUNDAMENTAL',
'ENSINO MEDIO',
'ENSINO MEDIO INCOMPLETO',
'NAO DEFINIDO',
'SUPERIOR',
'SUPERIOR INCOMPLETO',
];
List<String> listDeficiency = [
'AFONICA',
'AUDITIVA',
'FISICA',
'IGNORADO',
'INTELECTUAL',
'MOTORA',
'MULTIPLA',
'NENHUMA',
'VISUAL',
];
List<String> listTeam = [ List<String> listTeam = [
'INE: 0001558536 / Área: 4 - Microárea: --' 'INE: 0001558536 / Área: 4 - Microárea: --'
]; ];
List<String> listMaritalStatus = [
'CASADO(A)',
'DESQUITADO(A)',
'DIVORCIADO(A)',
'NAO DEFINIDO',
'SEPARADO(A)',
'SOLTEIRO(A)',
'UNIAO ESTAVEL',
'VIUVO(A)',
];
List<String> listGender = [
'FEMININO','MASCULINO'
];
List<String> listProcedures = [ List<String> listProcedures = [
'Aferição de PA', 'Aferição de PA',
'Curativo Simples', 'Curativo Simples',

View File

@@ -6,6 +6,7 @@ import '../screens/clear_data_screen.dart';
import '../screens/edit_procedures_screen.dart'; import '../screens/edit_procedures_screen.dart';
import '../screens/import_sigtap_screen.dart'; import '../screens/import_sigtap_screen.dart';
import '../screens/main_procedures_screen.dart'; import '../screens/main_procedures_screen.dart';
import '../screens/main_register_citizen_screen.dart';
import '../screens/register_citizen_screen.dart'; import '../screens/register_citizen_screen.dart';
import '../screens/sinc_data_screen.dart'; import '../screens/sinc_data_screen.dart';

View File

@@ -10,7 +10,7 @@ import 'input_search_text.dart';
class AlertDialogDefault { class AlertDialogDefault {
@override @override
alert(BuildContext context,controller,Widget list,) { alert_with_search(BuildContext context,controller,Widget list,) {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height; 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,
)
],
);
}
);
}
} }

View 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,
),
),
],
),
);
}
}

View File

@@ -10,6 +10,9 @@ class InputText extends StatelessWidget {
double width; double width;
String label; String label;
String error; String error;
bool enable;
TextInputType textInputType;
int maxLines;
InputText({ InputText({
required this.controller, required this.controller,
@@ -19,6 +22,9 @@ class InputText extends StatelessWidget {
this.hint = '', this.hint = '',
this.label = '', this.label = '',
this.error = '', this.error = '',
this.enable = true,
this.textInputType = TextInputType.text,
this.maxLines = 1,
}); });
@override @override
@@ -28,6 +34,8 @@ class InputText extends StatelessWidget {
margin: ConstVariable().marginHightInput, margin: ConstVariable().marginHightInput,
width: width, width: width,
child: TextFormField( child: TextFormField(
keyboardType: textInputType,
maxLines: maxLines,
validator: (value) { validator: (value) {
if (value!=null && value!.length==0) { if (value!=null && value!.length==0) {
return error; return error;
@@ -45,6 +53,7 @@ class InputText extends StatelessWidget {
labelText: label, labelText: label,
border: OutlineInputBorder(), border: OutlineInputBorder(),
hintText: this.hint, hintText: this.hint,
enabled: enable,
hintStyle: TextStyle( hintStyle: TextStyle(
color: ColorPalette.gray, color: ColorPalette.gray,
fontSize: this.fontSize, fontSize: this.fontSize,

View 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,)
],
);
}
}

View 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,
),
],
);
}
);
}
}

View 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
)
],
),
);
}
}