criada a tela edit_procedures_screen.dart

This commit is contained in:
Reginaldo
2023-03-23 17:51:35 -03:00
parent b3080870aa
commit 9677a9ce71
8 changed files with 371 additions and 8 deletions

View File

@@ -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<EditProceduresScreen> createState() => _EditProceduresScreenState();
}
class _EditProceduresScreenState extends State<EditProceduresScreen> {
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,
),
],
),
),
)
],
),
),
),
);
}
}

View File

@@ -50,7 +50,7 @@ class _HomeScreenState extends State<HomeScreen> {
), ),
IconButtonDefault( IconButtonDefault(
icon: Icons.edit_note, icon: Icons.edit_note,
onPressed: (){} onPressed: ()=>Navigator.pushNamed(context, '/edit_procedure')
), ),
], ],
), ),

View File

@@ -50,6 +50,7 @@ class _MainProceduresScreenState extends State<MainProceduresScreen> {
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 10), padding: EdgeInsets.symmetric(horizontal: 10),
child: DropDownButtonDefault( child: DropDownButtonDefault(
widthContainer: width*0.35,
title: '', title: '',
width: width*0.4, width: width*0.4,
list: ConstVariable().itensProceduresStart, list: ConstVariable().itensProceduresStart,

View File

@@ -10,4 +10,5 @@ class ColorPalette{
static const Color titleContainer = Color(0xffd6d6d6); static const Color titleContainer = Color(0xffd6d6d6);
static const Color buttonDisable = Color(0xfffafcbfb); static const Color buttonDisable = Color(0xfffafcbfb);
static const Color black54 = Colors.black54; static const Color black54 = Colors.black54;
static const Color blackButton = Color(0xff434343);
} }

View File

@@ -11,6 +11,18 @@ class ConstVariable{
'ATENDIMENTO INDIVIDUAL', 'ATENDIMENTO INDIVIDUAL',
'VISTA DOMICILIAR' 'VISTA DOMICILIAR'
]; ];
List<String> listTeam = [
'INE: 0001558536 / Área: 4 - Microárea: --'
];
List<String> 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<String> itensProcedures = [ List<String> itensProcedures = [
'0101010010 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO PRIMÁRIA', '0101010010 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO PRIMÁRIA',
'0101010028 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO ESPECIALIZADA', '0101010028 - ATIVIDADE EDUCATIVA / ORIENTAÇÃO EM GRUPO NA ATENÇÃO ESPECIALIZADA',

View File

@@ -3,6 +3,7 @@ import 'package:rkm/screens/attendance_list_screen.dart';
import 'package:rkm/screens/home_screen.dart'; import 'package:rkm/screens/home_screen.dart';
import 'package:rkm/screens/login_screen.dart'; import 'package:rkm/screens/login_screen.dart';
import '../screens/clear_data_screen.dart'; import '../screens/clear_data_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/register_citizen_screen.dart'; import '../screens/register_citizen_screen.dart';
@@ -18,4 +19,5 @@ var routes = {
'/sinc_data': (context) => SincDataScreen(), '/sinc_data': (context) => SincDataScreen(),
'/clear_data': (context) => ClearDataScreen(), '/clear_data': (context) => ClearDataScreen(),
'/import_sigtap': (context) => ImportSigtapScreen(), '/import_sigtap': (context) => ImportSigtapScreen(),
'/edit_procedure': (context) => EditProceduresScreen(),
}; };

View File

@@ -8,15 +8,19 @@ class DropDownButtonDefault extends StatelessWidget {
var onChanged; var onChanged;
String? select; String? select;
String title; String title;
double fontSize;
List<String> list; List<String> list;
double width; double width;
double widthContainer;
DropDownButtonDefault({ DropDownButtonDefault({
required this.onChanged, required this.onChanged,
required this.select, required this.select,
required this.title, required this.title,
required this.list, required this.list,
required this.width required this.width,
this.fontSize = 15,
this.widthContainer = 300
}); });
@override @override
@@ -34,9 +38,12 @@ class DropDownButtonDefault extends StatelessWidget {
value: select, value: select,
items: list.map((value) => DropdownMenuItem( items: list.map((value) => DropdownMenuItem(
value: value, value: value,
child: Container(
width: widthContainer,
child: TextDefault( child: TextDefault(
text: value, text: value,
fontSize: 15, fontSize: fontSize,
),
), ),
) )
).toList(), ).toList(),

View File

@@ -5,10 +5,14 @@ import 'package:rkm/widgets/text_default.dart';
class SubtitleContainers extends StatelessWidget { class SubtitleContainers extends StatelessWidget {
String title; String title;
double width; double width;
bool separeted;
double padding;
SubtitleContainers({ SubtitleContainers({
required this.title, required this.title,
this.width = double.infinity this.width = double.infinity,
this.separeted = true,
this.padding = 10
}); });
@override @override
@@ -17,12 +21,12 @@ class SubtitleContainers extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(padding),
width: width, width: width,
color: ColorPalette.white, color: ColorPalette.white,
child: TextDefault(text: title,color: ColorPalette.black54), 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()
], ],
); );
} }