criada a tela edit_procedures_screen.dart
This commit is contained in:
336
lib/screens/edit_procedures_screen.dart
Normal file
336
lib/screens/edit_procedures_screen.dart
Normal 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
IconButtonDefault(
|
||||
icon: Icons.edit_note,
|
||||
onPressed: (){}
|
||||
onPressed: ()=>Navigator.pushNamed(context, '/edit_procedure')
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -50,6 +50,7 @@ class _MainProceduresScreenState extends State<MainProceduresScreen> {
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: DropDownButtonDefault(
|
||||
widthContainer: width*0.35,
|
||||
title: '',
|
||||
width: width*0.4,
|
||||
list: ConstVariable().itensProceduresStart,
|
||||
|
||||
Reference in New Issue
Block a user