From 13e9eb4b241f6d8b73c453584b052af0aad22ac1 Mon Sep 17 00:00:00 2001 From: Reginaldo Date: Fri, 24 Mar 2023 22:54:42 -0300 Subject: [PATCH] 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 --- lib/screens/edit_procedures_screen.dart | 34 +- lib/screens/home_screen.dart | 9 +- lib/screens/main_procedures_screen.dart | 4 +- lib/screens/main_register_citizen_screen.dart | 85 ++ lib/screens/register_citizen_screen.dart | 1170 ++++++++++++++++- lib/utils/const_variable.dart | 44 + lib/utils/routes.dart | 1 + lib/widgets/alert_dialog_default.dart | 37 +- lib/widgets/dropdown_with_subtitle.dart | 68 + lib/widgets/input_text.dart | 9 + lib/widgets/input_with_subtitle.dart | 60 + lib/widgets/onbackbutton.dart | 35 + lib/widgets/switch_with_subtitle.dart | 34 + 13 files changed, 1550 insertions(+), 40 deletions(-) create mode 100644 lib/screens/main_register_citizen_screen.dart create mode 100644 lib/widgets/dropdown_with_subtitle.dart create mode 100644 lib/widgets/input_with_subtitle.dart create mode 100644 lib/widgets/onbackbutton.dart create mode 100644 lib/widgets/switch_with_subtitle.dart diff --git a/lib/screens/edit_procedures_screen.dart b/lib/screens/edit_procedures_screen.dart index e235bff..b4047f6 100644 --- a/lib/screens/edit_procedures_screen.dart +++ b/lib/screens/edit_procedures_screen.dart @@ -3,6 +3,7 @@ import 'package:intl/intl.dart'; import 'package:rkm/utils/const_variable.dart'; import 'package:rkm/widgets/appbar_default.dart'; import 'package:rkm/widgets/input_text.dart'; +import 'package:rkm/widgets/onbackbutton.dart'; import 'package:rkm/widgets/text_default.dart'; import '../utils/color_palette.dart'; import '../widgets/button_default.dart'; @@ -44,34 +45,7 @@ class _EditProceduresScreenState extends State { String formattedDate = DateFormat('dd/MM/yyyy').format(data); 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 Widget build(BuildContext context) { @@ -79,7 +53,7 @@ class _EditProceduresScreenState extends State { double height = MediaQuery.of(context).size.height; return WillPopScope( - onWillPop: ()=> onBackButton(context), + onWillPop: ()=> OnBackButton().onBackButton(context), child: Scaffold( appBar: AppBarDefault().appbar(context, 'RKM AB - Procedimentos Consolidados'), body: Container( @@ -316,7 +290,7 @@ class _EditProceduresScreenState extends State { width: width, ), ButtonDefault( - onPressed: (){}, + onPressed: ()=>Navigator.pop(context), title: 'Cancelar', background: ColorPalette.blackButton, borderColor: ColorPalette.blackButton, diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 92f8002..1286a3e 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -1,12 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:rkm/utils/color_palette.dart'; import 'package:rkm/utils/const_variable.dart'; import 'package:rkm/widgets/icon_button_default.dart'; import 'package:rkm/widgets/input_search_text.dart'; -import 'package:rkm/widgets/input_text.dart'; - import '../widgets/appbar_default.dart'; import '../widgets/item_citizen.dart'; +import 'main_register_citizen_screen.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({Key? key}) : super(key: key); @@ -42,7 +40,10 @@ class _HomeScreenState extends State { ), IconButtonDefault( icon: Icons.person_add, - onPressed: (){} + onPressed: ()=> Navigator.push( + context, + MaterialPageRoute(builder: (context) => MainRegisterCitizenScreen(screens: 1,)), + ) ), IconButtonDefault( icon: Icons.article, diff --git a/lib/screens/main_procedures_screen.dart b/lib/screens/main_procedures_screen.dart index e76dcca..73a387a 100644 --- a/lib/screens/main_procedures_screen.dart +++ b/lib/screens/main_procedures_screen.dart @@ -69,7 +69,7 @@ class _MainProceduresScreenState extends State { ), Divider(color: ColorPalette.black54,endIndent: 10,indent: 10,height: 1), GestureDetector( - onTap: ()=>AlertDialogDefault().alert( + onTap: ()=>AlertDialogDefault().alert_with_search( context, controllerProceduresSearch, ListView.separated( @@ -123,7 +123,7 @@ class _MainProceduresScreenState extends State { SubtitleContainers(title: 'Procedimento') ), GestureDetector( - onTap: ()=>AlertDialogDefault().alert( + onTap: ()=>AlertDialogDefault().alert_with_search( context, controllerCBOSearch, ListView.separated( diff --git a/lib/screens/main_register_citizen_screen.dart b/lib/screens/main_register_citizen_screen.dart new file mode 100644 index 0000000..f8801b9 --- /dev/null +++ b/lib/screens/main_register_citizen_screen.dart @@ -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 createState() => _MainRegisterCitizenScreenState(); +} + +class _MainRegisterCitizenScreenState extends State { + + 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 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'),), + ], + ), + ) + ); +} diff --git a/lib/screens/register_citizen_screen.dart b/lib/screens/register_citizen_screen.dart index b0c3ff8..8143940 100644 --- a/lib/screens/register_citizen_screen.dart +++ b/lib/screens/register_citizen_screen.dart @@ -1,5 +1,15 @@ import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:rkm/utils/color_palette.dart'; import 'package:rkm/utils/const_variable.dart'; +import 'package:rkm/widgets/alert_dialog_default.dart'; +import 'package:rkm/widgets/button_default.dart'; +import 'package:rkm/widgets/title_containers.dart'; +import '../widgets/dropdown_with_subtitle.dart'; +import '../widgets/input_with_subtitle.dart'; +import '../widgets/onbackbutton.dart'; +import '../widgets/switch_with_subtitle.dart'; +import '../widgets/text_default.dart'; class RegisterCitizenScreen extends StatefulWidget { const RegisterCitizenScreen({Key? key}) : super(key: key); @@ -8,12 +18,1166 @@ class RegisterCitizenScreen extends StatefulWidget { } class _RegisterCitizenScreenState extends State { + + var nameController = TextEditingController(); + var nameSocialController = TextEditingController(); + var spouseController = TextEditingController(); + var cityBirthController = TextEditingController(); + var cityController = TextEditingController(); + var searchCityBirthController = TextEditingController(); + var searchCityController = TextEditingController(); + var nameMotherController = TextEditingController(); + var nameFatherController = TextEditingController(); + var codIBGEController = TextEditingController(); + var unitController = TextEditingController(text: 'USF PINHAL - EMILIA STEPHANI SIMIONATO'); + var medicalRecordController = TextEditingController(); + var medicalRecordProvController = TextEditingController(); + var classificationProvController = TextEditingController(); + var numberFamilyController = TextEditingController(); + var cepController = TextEditingController(); + var numberController = TextEditingController(); + var complementController = TextEditingController(); + var referencePointController = TextEditingController(); + var foneDDDController = TextEditingController(); + var foneController = TextEditingController(); + var mobileDDDController = TextEditingController(); + var mobileController = TextEditingController(); + var messageDDDController = TextEditingController(); + var messageController = TextEditingController(); + var emailController = TextEditingController(); + var observationController = TextEditingController(); + var CPFController = TextEditingController(); + var CNSController = TextEditingController(); + var voterController = TextEditingController(); + var RGController = TextEditingController(); + var RGComplementController = TextEditingController(); + var RGOrganController = TextEditingController(); + var RGDateController = TextEditingController(); + var numberCertificateController = TextEditingController(); + var nameCertificateController = TextEditingController(); + var bookCertificateController = TextEditingController(); + var sheetCertificateController = TextEditingController(); + var termCertificateController = TextEditingController(); + var dateCertificateController = TextEditingController(); + var CTPSController = TextEditingController(); + var numberCTPSController = TextEditingController(); + var PISController = TextEditingController(); + var NISController = TextEditingController(); + var incomeController = TextEditingController(); + var professionalController = TextEditingController(); + var dateDeathController = TextEditingController(); + + String? selectTypeCertificate; + String? selectCTPSUF; + String? selectRGUF; + String? selectTypeStreet; + String? selectStreet; + String? selectSubdivision; + String? selectZone; + String? selectVillage; + String? selectCountry; + String? selectClassification; + String? selectGender; + String? selectMaritalStatus; + String? selectBreed; + String? selectScooling; + String? selectDeficiency; + String? selectNaturality; + bool enableSpouse = false; + bool enableMother = false; + bool enableFather = false; + bool enableCityCard = false; + bool enableBlocked = false; + bool checkBoxNumber = false; + String date = 'Data de Nascimento'; + + escolherprazoInicio(BuildContext context) async { + var pickDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2022), + lastDate: DateTime(2025)); + if (pickDate != null) { + setState(() { + date = formatData(year: pickDate.year, month: pickDate.month, day: pickDate.day); + }); + } + } + + String formatData({int? year, int? month, int? day}) { + DateTime data = DateTime(year!, month!, day!); + String formattedDate = DateFormat('dd/MM/yyyy').format(data); + return formattedDate; + } + @override Widget build(BuildContext context) { - return Scaffold( - body: Container( - decoration: ConstVariable().backgroundGradient, + double heigth = MediaQuery.of(context).size.height; + double width = MediaQuery.of(context).size.width; + + return WillPopScope( + onWillPop: ()=> OnBackButton().onBackButton(context), + child: Scaffold( + body: Container( + height: double.infinity, + width: double.infinity, + decoration: ConstVariable().backgroundGradient, + child: ListView( + children: [ + Card( + margin: EdgeInsets.all(10), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + ButtonDefault( + onPressed: (){}, + title: 'Salvar', + borderColor: ColorPalette.appBar, + background: ColorPalette.appBar, + textColor: ColorPalette.white, + width: double.infinity, + ), + ButtonDefault( + onPressed: ()=>Navigator.pop(context), + title: 'Cancelar', + borderColor: ColorPalette.blackButton, + background: ColorPalette.blackButton, + textColor: ColorPalette.white, + width: double.infinity, + ) + ], + ), + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Indentificação'), + Row( + children: [ + Container( + height: heigth*0.5, + width: width*0.2, + child: Icon(Icons.person,size: 80,), + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: nameController, + subtitle: 'Nome', + errorInput: 'Campo Obrigatório', + labelInput: 'Nome', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: nameSocialController, + subtitle: 'Nome Social', + errorInput: 'Campo Obrigatório', + labelInput: 'Nome Social', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + DropdownWithSubtitle( + list: ConstVariable().listGender, + widthSubtitle: width*0.7, + subtitle: 'Sexo', + hintDropdown: 'Sexo', + select: selectGender, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.6, + onChanged: (value){ + setState(() { + selectGender = value!; + }); + }, + ), + Container( + width: width*0.75, + child: Row( + children: [ + // Padding( + // padding: const EdgeInsets.symmetric(horizontal: 5.0,vertical: 15), + // child: TextDefault( + // text: 'Data de Nascimento', + // color: ColorPalette.black54, + // fontWeigth: FontWeight.bold, + // fontSize: 18, + // ), + // ), + // Spacer(), + GestureDetector( + onTap: ()=>escolherprazoInicio(context), + child: Container( + height: 50, + margin: EdgeInsets.symmetric(horizontal: 10), + padding: EdgeInsets.symmetric(horizontal: 8,vertical: 10), + decoration: BoxDecoration( + border: Border.all(color: ColorPalette.black54), + borderRadius: BorderRadius.all( + Radius.circular(5.0) // <--- border radius here + ), + ), + width: width*0.7, + child: TextDefault( + text: date, + color: ColorPalette.black54, + fontSize: 18, + ), + ), + ) + ], + ), + ), + DropdownWithSubtitle( + list: ConstVariable().listMaritalStatus, + widthSubtitle: width*0.2, + subtitle: 'Estado Civil', + hintDropdown: 'Selecione', + select: selectMaritalStatus, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.4, + onChanged: (value){ + setState(() { + selectMaritalStatus = value!; + if(selectMaritalStatus=='CASADO(A)'){ + enableSpouse = true; + }else{ + enableSpouse = false; + } + }); + }, + ), + InputWithSubtitle( + controller: spouseController, + subtitle: 'Cônjuge', + errorInput: 'Campo Obrigatório', + labelInput: 'Cônjuge', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: enableSpouse, + ), + DropdownWithSubtitle( + list: ConstVariable().listNationality, + widthSubtitle: width*0.2, + subtitle: 'Naturalidade', + hintDropdown: 'Selecione', + select: selectNaturality, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.4, + onChanged: (value){ + setState(() { + selectNaturality = value!; + if(selectNaturality!='BRASILEIRO'){ + cityBirthController.text = 'MUNICIPIO IGNORADO - SP'; + }else{ + cityBirthController.text = ''; + } + }); + }, + ), + GestureDetector( + onTap: ()=>cityBirthController.text == 'MUNICIPIO IGNORADO - SP'?null:AlertDialogDefault().alert_with_search( + context, searchCityBirthController, + ListView.separated( + separatorBuilder:(context,index)=> Divider(color: ColorPalette.black54,height: 5,), + itemCount: ConstVariable().itensCity.length, + itemBuilder: (context,index){ + return Container( + width: width*0.8, + color: ColorPalette.white, + child: ListTile( + onTap: (){ + setState(() { + cityBirthController.text = ConstVariable().itensCity[index]; + Navigator.pop(context); + }); + }, + title: TextDefault( + color: ColorPalette.black54, + text: ConstVariable().itensCity[index], + fontSize: 16, + maxLines: 2, + ), + ), + ); + } + ), + ), + child: InputWithSubtitle( + controller: cityBirthController, + subtitle: 'Município de Nascimento', + errorInput: 'Campo Obrigatório', + labelInput: 'Município de Nascimento', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: false, + ), + ), + DropdownWithSubtitle( + list: ConstVariable().listBreed, + widthSubtitle: width*0.2, + subtitle: 'Raça/Cor', + hintDropdown: 'Raça/Cor', + select: selectBreed, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.4, + onChanged: (value){ + setState(() { + selectBreed = value!; + }); + }, + ), + DropdownWithSubtitle( + list: ConstVariable().listScooling, + widthSubtitle: width*0.2, + subtitle: 'Escolaridade', + hintDropdown: 'Escolaridade', + select: selectScooling, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.4, + onChanged: (value){ + setState(() { + selectScooling = value!; + }); + }, + ), + DropdownWithSubtitle( + list: ConstVariable().listDeficiency, + widthSubtitle: width*0.2, + subtitle: 'Deficiência', + hintDropdown: 'Deficiência', + select: selectDeficiency, + widthDropdown: width*0.7, + widthContainerDropdown: width*0.4, + onChanged: (value){ + setState(() { + selectDeficiency = value!; + }); + }, + ), + InputWithSubtitle( + controller: nameMotherController, + subtitle: 'Nome da Mãe', + errorInput: 'Campo Obrigatório', + labelInput: 'Nome da Mãe', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: !enableMother, + ), + SwitchWithSubtitle( + width: width*0.7, + title: 'Desconhece Mãe', + value: enableMother, + onChanged: (value){ + setState(() { + enableMother = value; + if(enableMother){ + nameMotherController.text = ''; + } + }); + }, + ), + InputWithSubtitle( + controller: nameFatherController, + subtitle: 'Nome do Pai', + errorInput: 'Campo Obrigatório', + labelInput: 'Nome do Pai', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: !enableFather, + ), + SwitchWithSubtitle( + width: width*0.7, + title: 'Desconhece Pai', + value: enableFather, + onChanged: (value){ + setState(() { + enableFather = value; + if(enableFather){ + nameFatherController.text = ''; + } + }); + }, + ), + ], + ) + ], + ) + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Identificação da Saúde'), + Row( + children: [ + Container( + height: heigth*0.4, + width: width*0.2, + child: Icon(Icons.medical_services_rounded,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: unitController, + subtitle: 'Unidade', + errorInput: 'Campo Obrigatório', + labelInput: 'Unidade', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + enable: false, + ), + InputWithSubtitle( + controller: medicalRecordController, + subtitle: 'Prontuário', + errorInput: 'Campo Obrigatório', + labelInput: 'Prontuário', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + enable: false, + ), + InputWithSubtitle( + controller: medicalRecordProvController, + subtitle: 'Prontuário Provisório', + errorInput: 'Campo Obrigatório', + labelInput: 'Prontuário Provisório', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + enable: false, + ), + DropdownWithSubtitle( + subtitle: 'Classificação', + select: selectClassification, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Número da Família', + onChanged: (value){ + setState(() { + selectClassification = value; + if(selectClassification=='OUTRO MUNICIPIO'){ + AlertDialogDefault().alert( + context, + 'Aviso', + 'As informações dos campos Bairro, Tipo Logradouro, Nome Logradouro, CEP,' + 'Número, Loteamento e Complemento deverão ser inseridos no campo Observações!', + 'OK' + ); + } + }); + }, + list: [ + 'MUNICIPE', + 'PROVISORIO', + 'OUTRO MUNICIPIO', + ] + ), + InputWithSubtitle( + controller: numberFamilyController, + subtitle: 'Número da Família', + errorInput: 'Campo Obrigatório', + labelInput: 'Número da Família', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + ], + ), + ), + ] + ), + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Endereço'), + Row( + children: [ + Container( + height: heigth*0.4, + width: width*0.2, + child: Icon(Icons.map_outlined,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + DropdownWithSubtitle( + subtitle: 'Pais de Residência', + select: selectCountry, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Pais de Residência', + onChanged: (value){ + setState(() { + selectCountry = value; + if(selectCountry=='OUTRO'){ + cityController.text= 'MUNICIPIO IGNORADO - SP'; + codIBGEController.text = '000000'; + AlertDialogDefault().alert( + context, + 'Aviso', + 'As informações dos campos Bairro, Tipo Logradouro, Nome Logradouro, CEP,' + 'Número, Loteamento e Complemento deverão ser inseridos no campo Observações!', + 'OK' + ); + }else{ + cityController.text = ''; + codIBGEController.text = ''; + } + }); + }, + list: [ + 'BRASIL', + 'OUTRO', + ] + ), + GestureDetector( + onTap: ()=>cityController.text == 'MUNICIPIO IGNORADO - SP'?null:AlertDialogDefault().alert_with_search( + context, searchCityController, + ListView.separated( + separatorBuilder:(context,index)=> Divider(color: ColorPalette.black54,height: 5,), + itemCount: ConstVariable().itensCity.length, + itemBuilder: (context,index){ + return Container( + width: width*0.8, + color: ColorPalette.white, + child: ListTile( + onTap: (){ + setState(() { + cityController.text = ConstVariable().itensCity[index]; + codIBGEController.text = '353870'; + Navigator.pop(context); + }); + }, + title: TextDefault( + color: ColorPalette.black54, + text: ConstVariable().itensCity[index], + fontSize: 16, + maxLines: 2, + ), + ), + ); + } + ), + ), + child: InputWithSubtitle( + controller: cityController, + subtitle: 'Município de Residência', + errorInput: 'Campo Obrigatório', + labelInput: 'Município de Residência', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: false, + ), + ), + InputWithSubtitle( + controller: codIBGEController, + subtitle: 'Cód. IBGE', + errorInput: 'Campo Obrigatório', + labelInput: 'Cód. IBGE', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: false, + ), + DropdownWithSubtitle( + subtitle: 'Bairro', + select: selectVillage, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Bairro', + onChanged: (value){ + setState(() { + selectVillage = value; + }); + }, + list: [] + ), + DropdownWithSubtitle( + subtitle: 'Tipo de Logradouro', + select: selectTypeStreet, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Tipo de Logradouro', + onChanged: (value){ + setState(() { + selectTypeStreet = value; + }); + }, + list: [] + ), + DropdownWithSubtitle( + subtitle: 'Nome do Logradouro', + select: selectStreet, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Nome do Logradouro', + onChanged: (value){ + setState(() { + selectStreet = value; + }); + }, + list: [] + ), + InputWithSubtitle( + controller: cepController, + subtitle: 'CEP(só números)', + errorInput: 'Campo Obrigatório', + labelInput: 'CEP(só números)', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: false, + ), + Container( + width: width*0.7, + child: Row( + children: [ + InputWithSubtitle( + controller: numberController, + subtitle: 'Número', + errorInput: 'Campo Obrigatório', + labelInput: 'Número', + widthInput: width*0.4, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + enable: false, + ), + Checkbox( + value: checkBoxNumber, + onChanged: (value){ + setState(() { + checkBoxNumber = value!; + }); + } + ), + Spacer(), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: TextDefault(text: 'SEM NÚMERO',fontSize: 15,), + ) + ], + ), + ), + DropdownWithSubtitle( + subtitle: 'Loteamento/Subdistrito', + select: selectSubdivision, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Loteamento/Subdistrito', + onChanged: (value){ + setState(() { + selectSubdivision = value; + }); + }, + list: [] + ), + InputWithSubtitle( + controller: complementController, + subtitle: 'Complemento', + errorInput: 'Campo Obrigatório', + labelInput: 'Complemento', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: referencePointController, + subtitle: 'Ponto de Referência', + errorInput: 'Campo Obrigatório', + labelInput: 'Ponto de Referência', + widthInput: width*0.7, + widthSubtitle: width*0.2, + hintInput: 'Escreva aqui', + ), + DropdownWithSubtitle( + subtitle: 'Zona', + select: selectZone, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Zona', + onChanged: (value){ + setState(() { + selectZone = value; + }); + }, + list: ['URBANA','RURAL'] + ), + ], + ), + ), + ] + ), + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Contato'), + Row( + children: [ + Container( + height: heigth*0.4, + width: width*0.2, + child: Icon(Icons.medical_services_rounded,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: foneDDDController, + subtitle: 'Telefone - DDD', + errorInput: 'Campo Obrigatório', + labelInput: 'Telefone - DDD', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: foneController, + subtitle: 'Telefone (Só Números)', + errorInput: 'Campo Obrigatório', + labelInput: 'Telefone(Só Números)', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: mobileDDDController, + subtitle: 'Celular - DDD', + errorInput: 'Campo Obrigatório', + labelInput: 'Celular - DDD', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: mobileController, + subtitle: 'Celular (Só Números)', + errorInput: 'Campo Obrigatório', + labelInput: 'Celular (Só Números)', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: messageDDDController, + subtitle: 'Recado - DDD', + errorInput: 'Campo Obrigatório', + labelInput: 'Recado - DDD', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: messageController, + subtitle: 'Recado (Só Números)', + errorInput: 'Campo Obrigatório', + labelInput: 'Recado (Só Números)', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: emailController, + subtitle: 'E-mail', + errorInput: 'Campo Obrigatório', + labelInput: 'E-mail', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + ], + ), + ), + ] + ), + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Observações'), + Row( + children: [ + Container( + height: heigth*0.2, + width: width*0.2, + child: Icon(Icons.sell,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: observationController, + subtitle: 'Observação', + errorInput: 'Campo Obrigatório', + labelInput: 'Observação', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + textInputType: TextInputType.multiline, + maxLines: 5, + ), + ], + ), + ), + ] + ), + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Documentos'), + Row( + children: [ + Container( + height: heigth*0.4, + width: width*0.2, + child: Icon(Icons.description_outlined,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: CPFController, + subtitle: 'CPF (Só Números)', + errorInput: 'Campo Obrigatório', + labelInput: 'CPF (Só Números)', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: CNSController, + subtitle: 'CNS', + errorInput: 'Campo Obrigatório', + labelInput: 'CNS', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: voterController, + subtitle: 'Título de Eleitor', + errorInput: 'Campo Obrigatório', + labelInput: 'Título de Eleitor', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: RGController, + subtitle: 'RG', + errorInput: 'Campo Obrigatório', + labelInput: 'RG', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: RGComplementController, + subtitle: 'RG - Complemento', + errorInput: 'Campo Obrigatório', + labelInput: 'RG - Complemento', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + DropdownWithSubtitle( + subtitle: 'RG - UF', + select: selectRGUF, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'RG - UF', + onChanged: (value){ + setState(() { + selectRGUF = value; + }); + }, + list: [] + ), + InputWithSubtitle( + controller: RGOrganController, + subtitle: 'RG - Órgão', + errorInput: 'Campo Obrigatório', + labelInput: 'RG - Órgão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: RGDateController, + subtitle: 'RG - Data de Emissão', + errorInput: 'Campo Obrigatório', + labelInput: 'RG - Data de Emissão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + DropdownWithSubtitle( + subtitle: 'Tipo de certidão', + select: selectTypeCertificate, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'Tipo de certidão', + onChanged: (value){ + setState(() { + selectTypeCertificate = value; + }); + }, + list: [ + 'NASCIMENTO', + 'CASAMENTO', + 'DIVÓRCIO', + 'ADMINISTRATIVA - ÍNDIO', + 'NASCIMENTO - N', + 'CASAMENTO - N', + 'DIVÓRCIO - N', + 'ADMINISTRATIVA - ÍNDIO - N', + ] + ), + InputWithSubtitle( + controller: numberCertificateController, + subtitle: 'Número da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Número da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: nameCertificateController, + subtitle: 'Nome do Cartório da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Nome do Cartório da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: bookCertificateController, + subtitle: 'Livro da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Livro da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: sheetCertificateController, + subtitle: 'Folha da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Folha da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: termCertificateController, + subtitle: 'Termo da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Termo da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: dateCertificateController, + subtitle: 'Data de Emissão da Certidão', + errorInput: 'Campo Obrigatório', + labelInput: 'Data de Emissão da Certidão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: CTPSController, + subtitle: 'CTPS', + errorInput: 'Campo Obrigatório', + labelInput: 'CTPS', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: numberCTPSController, + subtitle: 'Número de Série CTPS', + errorInput: 'Campo Obrigatório', + labelInput: 'Número de Série CTPS', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + DropdownWithSubtitle( + subtitle: 'CTPS - UF', + select: selectCTPSUF, + widthDropdown: width*0.672, + widthContainerDropdown: width*0.5, + widthSubtitle: width*0.3, + hintDropdown: 'CTPS - UF', + onChanged: (value){ + setState(() { + selectCTPSUF = value; + }); + }, + list: [] + ), + InputWithSubtitle( + controller: PISController, + subtitle: 'PIS/PASEP', + errorInput: 'Campo Obrigatório', + labelInput: 'PIS/PASEP', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + Container( + width: width*0.7, + child: Row( + children: [ + TextDefault(text: 'Retirou cartão municipal da cidade?'), + Spacer(), + Switch(value: enableCityCard, onChanged: (value)=>setState(()=>enableCityCard=value!) + ) + ], + ), + ), + InputWithSubtitle( + controller: NISController, + subtitle: 'Identificação da saúde - NIS', + errorInput: 'Campo Obrigatório', + labelInput: 'Identificação da saúde - NIS', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + ], + ), + ), + ] + ), + ], + ), + ), + Card( + margin: EdgeInsets.all(10), + child: Column( + children: [ + TitleContainers(title: 'Outros'), + Row( + children: [ + Container( + height: heigth*0.3, + width: width*0.2, + child: Icon(Icons.tag,size: 80,), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + InputWithSubtitle( + controller: incomeController, + subtitle: 'Renda Mensal', + errorInput: 'Campo Obrigatório', + labelInput: 'Renda Mensal', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: professionalController, + subtitle: 'Profissão', + errorInput: 'Campo Obrigatório', + labelInput: 'Profissão', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + InputWithSubtitle( + controller: dateDeathController, + subtitle: 'Data Óbito', + errorInput: 'Campo Obrigatório', + labelInput: 'Data Óbito', + widthInput: width*0.7, + widthSubtitle: width*0.7, + hintInput: 'Escreva aqui', + ), + Container( + width: width*0.7, + child: Row( + children: [ + TextDefault(text: 'Bloqueado'), + Spacer(), + Switch(value: enableBlocked, onChanged: (value)=>setState(()=>enableBlocked=value!)), + ], + ), + ) + ], + ), + ), + ] + ), + ], + ), + ), + ] + ) + ), ), ); } diff --git a/lib/utils/const_variable.dart b/lib/utils/const_variable.dart index 039dd1d..ecd342d 100644 --- a/lib/utils/const_variable.dart +++ b/lib/utils/const_variable.dart @@ -11,9 +11,53 @@ class ConstVariable{ 'ATENDIMENTO INDIVIDUAL', 'VISTA DOMICILIAR' ]; + List listNationality =[ + 'BRASILEIRO', + 'ESTRANGEIRO', + 'NATURALIZADO', + ]; + List listBreed = [ + 'AMARELA', + 'BRANCA', + 'INDIGENA', + 'NEGRA', + 'PARDA', + ]; + List listScooling = [ + 'ENSINO FUNDAMENTAL', + 'ENSINO MEDIO', + 'ENSINO MEDIO INCOMPLETO', + 'NAO DEFINIDO', + 'SUPERIOR', + 'SUPERIOR INCOMPLETO', + ]; + List listDeficiency = [ + 'AFONICA', + 'AUDITIVA', + 'FISICA', + 'IGNORADO', + 'INTELECTUAL', + 'MOTORA', + 'MULTIPLA', + 'NENHUMA', + 'VISUAL', + ]; List listTeam = [ 'INE: 0001558536 / Área: 4 - Microárea: --' ]; + List listMaritalStatus = [ + 'CASADO(A)', + 'DESQUITADO(A)', + 'DIVORCIADO(A)', + 'NAO DEFINIDO', + 'SEPARADO(A)', + 'SOLTEIRO(A)', + 'UNIAO ESTAVEL', + 'VIUVO(A)', + ]; + List listGender = [ + 'FEMININO','MASCULINO' + ]; List listProcedures = [ 'Aferição de PA', 'Curativo Simples', diff --git a/lib/utils/routes.dart b/lib/utils/routes.dart index fc89753..f1e12c8 100644 --- a/lib/utils/routes.dart +++ b/lib/utils/routes.dart @@ -6,6 +6,7 @@ import '../screens/clear_data_screen.dart'; import '../screens/edit_procedures_screen.dart'; import '../screens/import_sigtap_screen.dart'; import '../screens/main_procedures_screen.dart'; +import '../screens/main_register_citizen_screen.dart'; import '../screens/register_citizen_screen.dart'; import '../screens/sinc_data_screen.dart'; diff --git a/lib/widgets/alert_dialog_default.dart b/lib/widgets/alert_dialog_default.dart index d745303..4194c0c 100644 --- a/lib/widgets/alert_dialog_default.dart +++ b/lib/widgets/alert_dialog_default.dart @@ -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, + ) + ], + ); + } + ); + } } diff --git a/lib/widgets/dropdown_with_subtitle.dart b/lib/widgets/dropdown_with_subtitle.dart new file mode 100644 index 0000000..843b3c4 --- /dev/null +++ b/lib/widgets/dropdown_with_subtitle.dart @@ -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 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, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/input_text.dart b/lib/widgets/input_text.dart index 4789e95..b5c609e 100644 --- a/lib/widgets/input_text.dart +++ b/lib/widgets/input_text.dart @@ -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, diff --git a/lib/widgets/input_with_subtitle.dart b/lib/widgets/input_with_subtitle.dart new file mode 100644 index 0000000..aca774a --- /dev/null +++ b/lib/widgets/input_with_subtitle.dart @@ -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,) + ], + ); + } +} diff --git a/lib/widgets/onbackbutton.dart b/lib/widgets/onbackbutton.dart new file mode 100644 index 0000000..46d8204 --- /dev/null +++ b/lib/widgets/onbackbutton.dart @@ -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, + ), + ], + ); + } + ); + } +} \ No newline at end of file diff --git a/lib/widgets/switch_with_subtitle.dart b/lib/widgets/switch_with_subtitle.dart new file mode 100644 index 0000000..fc17ac9 --- /dev/null +++ b/lib/widgets/switch_with_subtitle.dart @@ -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 + ) + ], + ), + ); + } +}