diff --git a/lib/screens/edit_procedures_screen.dart b/lib/screens/edit_procedures_screen.dart new file mode 100644 index 0000000..e235bff --- /dev/null +++ b/lib/screens/edit_procedures_screen.dart @@ -0,0 +1,336 @@ +import 'package:flutter/material.dart'; +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/text_default.dart'; +import '../utils/color_palette.dart'; +import '../widgets/button_default.dart'; +import '../widgets/dropdown_button_default.dart'; +import '../widgets/subtitle_containers.dart'; +import '../widgets/title_containers.dart'; + +class EditProceduresScreen extends StatefulWidget { + const EditProceduresScreen({Key? key}) : super(key: key); + + @override + State createState() => _EditProceduresScreenState(); +} + +class _EditProceduresScreenState extends State { + + var controllerProfessional = TextEditingController(); + var controllerUnit = TextEditingController(); + String? selectCBO; + String? selectTeam; + String? date; + + escolherprazoInicio(BuildContext context) async { + var pickDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2022), + lastDate: DateTime(2025)); + if (pickDate != null) { + setState(() { + date=null; + 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; + } + 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) { + + double width = MediaQuery.of(context).size.width; + double height = MediaQuery.of(context).size.height; + + return WillPopScope( + onWillPop: ()=> onBackButton(context), + child: Scaffold( + appBar: AppBarDefault().appbar(context, 'RKM AB - Procedimentos Consolidados'), + body: Container( + decoration: ConstVariable().backgroundGradient, + width: width, + height: height, + padding: EdgeInsets.all(10), + child: ListView( + children: [ + Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TitleContainers(title: 'Procedimentos',), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.center, + height: height*0.32, + width: width*0.2, + child: Icon(Icons.info_outlined,size: 100,color: ColorPalette.black54,) + ), + Container( + height: height*0.32, + width: width*0.75, + child: ListView.separated( + itemCount: ConstVariable().listProcedures.length, + separatorBuilder: (context,index)=>Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + itemBuilder: (context,index){ + return Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: ConstVariable().listProcedures[index], + color: ColorPalette.black54, + fontSize: 18 + ), + ); + }, + ), + ) + ], + ), + ], + ), + ), + Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TitleContainers(title: 'Outros',), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.center, + height: height*0.24, + width: width*0.2, + child: Icon(Icons.tag,size: 100,color: ColorPalette.black54,) + ), + Container( + height: height*0.25, + width: width*0.75, + child: ListView( + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'Profissional', + color: ColorPalette.black54, + fontSize: 18, + ), + ), + Spacer(), + Container( + margin: EdgeInsets.symmetric(horizontal: 5,vertical: 10), + padding: EdgeInsets.all(5), + width: width*0.5, + color: ColorPalette.titleContainer, + child: TextDefault(text: 'ADMINISTRADOR',color: ColorPalette.black54,fontSize: 15,), + ) + ], + ), + Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'Unidade', + color: ColorPalette.black54, + fontSize: 18, + ), + ), + Spacer(), + Container( + margin: EdgeInsets.symmetric(horizontal: 5), + padding: EdgeInsets.all(5), + width: width*0.5, + color: ColorPalette.titleContainer, + child: TextDefault( + text: 'USF PINHAL - EMILIA STEPHANI SIMIONATO', + color: ColorPalette.black54, + fontSize: 15, + ), + ) + ], + ), + Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'CBO', + color: ColorPalette.black54, + fontWeigth: FontWeight.bold, + fontSize: 18, + ), + ), + Spacer(), + Container( + margin: EdgeInsets.symmetric(horizontal: 0), + padding: EdgeInsets.all(0), + child: DropDownButtonDefault( + title: '', + fontSize: 15, + width: width*0.50, + widthContainer: width*0.45, + select: selectCBO, + list: ConstVariable().itensCBO, + onChanged: (value){ + setState(() { + selectCBO = value!; + }); + }, + ), + ) + ], + ), + Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'Código Equipe', + color: ColorPalette.black54, + fontSize: 18, + ), + ), + Spacer(), + Container( + margin: EdgeInsets.symmetric(horizontal: 0), + padding: EdgeInsets.all(0), + child: DropDownButtonDefault( + title: '', + fontSize: 15, + width: width*0.5, + widthContainer: width*0.4, + select: selectTeam, + list: ConstVariable().listTeam, + onChanged: (value){ + setState(() { + selectTeam = value!; + }); + }, + ), + ) + ], + ), + Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + date!=null + ?GestureDetector( + onTap: ()=>escolherprazoInicio(context), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'Data', + color: ColorPalette.black54, + fontWeigth: FontWeight.bold, + fontSize: 18, + ), + ), + Spacer(), + Container( + margin: EdgeInsets.symmetric(horizontal: 5), + padding: EdgeInsets.all(5), + width: width*0.5, + child: TextDefault( + text: date!, + color: ColorPalette.black54, + fontSize: 15, + ), + ) + ], + ), + ):GestureDetector( + onTap: ()=>escolherprazoInicio(context), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: TextDefault( + text: 'Data', + color: ColorPalette.black54, + fontWeigth: FontWeight.bold, + fontSize: 18, + ), + ), + ), + Divider(color: ColorPalette.black54,height: 5,endIndent: 10,), + ] + ), + ) + ], + ), + ], + ), + ), + Card( + 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: width, + ), + ButtonDefault( + onPressed: (){}, + title: 'Cancelar', + background: ColorPalette.blackButton, + borderColor: ColorPalette.blackButton, + textColor: ColorPalette.white, + width: width, + ), + ], + ), + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 90fbac1..92f8002 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -50,7 +50,7 @@ class _HomeScreenState extends State { ), IconButtonDefault( icon: Icons.edit_note, - onPressed: (){} + onPressed: ()=>Navigator.pushNamed(context, '/edit_procedure') ), ], ), diff --git a/lib/screens/main_procedures_screen.dart b/lib/screens/main_procedures_screen.dart index 3e6478c..e76dcca 100644 --- a/lib/screens/main_procedures_screen.dart +++ b/lib/screens/main_procedures_screen.dart @@ -50,6 +50,7 @@ class _MainProceduresScreenState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 10), child: DropDownButtonDefault( + widthContainer: width*0.35, title: '', width: width*0.4, list: ConstVariable().itensProceduresStart, diff --git a/lib/utils/color_palette.dart b/lib/utils/color_palette.dart index cccf43d..f3c1143 100644 --- a/lib/utils/color_palette.dart +++ b/lib/utils/color_palette.dart @@ -10,4 +10,5 @@ class ColorPalette{ static const Color titleContainer = Color(0xffd6d6d6); static const Color buttonDisable = Color(0xfffafcbfb); static const Color black54 = Colors.black54; + static const Color blackButton = Color(0xff434343); } \ No newline at end of file diff --git a/lib/utils/const_variable.dart b/lib/utils/const_variable.dart index ea0bfa8..039dd1d 100644 --- a/lib/utils/const_variable.dart +++ b/lib/utils/const_variable.dart @@ -11,6 +11,18 @@ class ConstVariable{ 'ATENDIMENTO INDIVIDUAL', 'VISTA DOMICILIAR' ]; + List listTeam = [ + 'INE: 0001558536 / Área: 4 - Microárea: --' + ]; + List listProcedures = [ + 'Aferição de PA', + 'Curativo Simples', + 'Glicemia Capilar', + 'Medição de Peso', + 'Coleta de Material para Exame Laboratorial', + 'Aferição de Temperatura', + 'Medição de Altura', + ]; List itensProcedures = [ '0101010010 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO PRIMÁRIA', '0101010028 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO ESPECIALIZADA', diff --git a/lib/utils/routes.dart b/lib/utils/routes.dart index 09f34b2..fc89753 100644 --- a/lib/utils/routes.dart +++ b/lib/utils/routes.dart @@ -3,6 +3,7 @@ import 'package:rkm/screens/attendance_list_screen.dart'; import 'package:rkm/screens/home_screen.dart'; import 'package:rkm/screens/login_screen.dart'; 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/register_citizen_screen.dart'; @@ -18,4 +19,5 @@ var routes = { '/sinc_data': (context) => SincDataScreen(), '/clear_data': (context) => ClearDataScreen(), '/import_sigtap': (context) => ImportSigtapScreen(), + '/edit_procedure': (context) => EditProceduresScreen(), }; \ No newline at end of file diff --git a/lib/widgets/dropdown_button_default.dart b/lib/widgets/dropdown_button_default.dart index 9300fb2..af4d30c 100644 --- a/lib/widgets/dropdown_button_default.dart +++ b/lib/widgets/dropdown_button_default.dart @@ -8,15 +8,19 @@ class DropDownButtonDefault extends StatelessWidget { var onChanged; String? select; String title; + double fontSize; List list; double width; + double widthContainer; DropDownButtonDefault({ required this.onChanged, required this.select, required this.title, required this.list, - required this.width + required this.width, + this.fontSize = 15, + this.widthContainer = 300 }); @override @@ -34,9 +38,12 @@ class DropDownButtonDefault extends StatelessWidget { value: select, items: list.map((value) => DropdownMenuItem( value: value, - child: TextDefault( - text: value, - fontSize: 15, + child: Container( + width: widthContainer, + child: TextDefault( + text: value, + fontSize: fontSize, + ), ), ) ).toList(), diff --git a/lib/widgets/subtitle_containers.dart b/lib/widgets/subtitle_containers.dart index 9970540..86d6b9a 100644 --- a/lib/widgets/subtitle_containers.dart +++ b/lib/widgets/subtitle_containers.dart @@ -5,10 +5,14 @@ import 'package:rkm/widgets/text_default.dart'; class SubtitleContainers extends StatelessWidget { String title; double width; + bool separeted; + double padding; SubtitleContainers({ required this.title, - this.width = double.infinity + this.width = double.infinity, + this.separeted = true, + this.padding = 10 }); @override @@ -17,12 +21,12 @@ class SubtitleContainers extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Container( - padding: EdgeInsets.all(10), + padding: EdgeInsets.all(padding), width: width, color: ColorPalette.white, child: TextDefault(text: title,color: ColorPalette.black54), ), - Divider(color: Colors.black54,endIndent: 10,indent: 10,) + separeted?Divider(color: Colors.black54,endIndent: 10,indent: 10,):Container() ], ); }