208 lines
8.8 KiB
Dart
208 lines
8.8 KiB
Dart
import 'package:flutter/material.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/appbar_default.dart';
|
|
import 'package:rkm/widgets/button_default.dart';
|
|
import '../widgets/dropdown_button_default.dart';
|
|
import '../widgets/subtitle_containers.dart';
|
|
import '../widgets/text_default.dart';
|
|
import '../widgets/title_containers.dart';
|
|
|
|
class MainProceduresScreen extends StatefulWidget {
|
|
const MainProceduresScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<MainProceduresScreen> createState() => _MainProceduresScreenState();
|
|
}
|
|
|
|
class _MainProceduresScreenState extends State<MainProceduresScreen> {
|
|
|
|
String? selectService;
|
|
String? selectProcedure;
|
|
String? selectCBO;
|
|
bool disableButton = true;
|
|
var controllerProceduresSearch = TextEditingController();
|
|
var controllerCBOSearch = TextEditingController();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
|
|
return Scaffold(
|
|
appBar: AppBarDefault().appbar(context, 'RKM AB - Procedimentos Iniciais'),
|
|
body: Container(
|
|
padding: EdgeInsets.all(10),
|
|
decoration: ConstVariable().backgroundGradient,
|
|
child: ListView(
|
|
children: [
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: 'Adicionar Procedimento Inicial',),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SubtitleContainers(title: 'Atendimento',width: width*0.5),
|
|
Spacer(),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
child: DropDownButtonDefault(
|
|
widthContainer: width*0.35,
|
|
title: '',
|
|
width: width*0.4,
|
|
list: ConstVariable().itensProceduresStart,
|
|
select: selectService,
|
|
onChanged: (value){
|
|
setState(() {
|
|
selectService = value!;
|
|
if(selectProcedure!= null && selectCBO!= null && selectService!=null){
|
|
disableButton = false;
|
|
}
|
|
});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(color: ColorPalette.black54,endIndent: 10,indent: 10,height: 1),
|
|
GestureDetector(
|
|
onTap: ()=>AlertDialogDefault().alert(
|
|
context,
|
|
controllerProceduresSearch,
|
|
ListView.separated(
|
|
separatorBuilder:(context,index)=> Divider(color: ColorPalette.black54,height: 5,),
|
|
itemCount: ConstVariable().itensProcedures.length,
|
|
itemBuilder: (context,index){
|
|
return Container(
|
|
width: width*0.8,
|
|
color: ColorPalette.white,
|
|
child: ListTile(
|
|
onTap: (){
|
|
setState(() {
|
|
selectProcedure = ConstVariable().itensProcedures[index];
|
|
Navigator.pop(context);
|
|
if(selectProcedure!= null && selectCBO!= null && selectService!=null){
|
|
disableButton = false;
|
|
}
|
|
});
|
|
},
|
|
title: TextDefault(
|
|
color: ColorPalette.black54,
|
|
text: ConstVariable().itensProcedures[index],
|
|
fontSize: 16,
|
|
maxLines: 2,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
child: selectProcedure!=null?
|
|
Container(
|
|
width: width,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SubtitleContainers(title: 'Procedimento',width: width*0.3,),
|
|
Spacer(),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
|
width: width*0.65,
|
|
child: TextDefault(
|
|
color: ColorPalette.black54,
|
|
text: selectProcedure!,
|
|
fontSize: 15,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
):
|
|
SubtitleContainers(title: 'Procedimento')
|
|
),
|
|
GestureDetector(
|
|
onTap: ()=>AlertDialogDefault().alert(
|
|
context,
|
|
controllerCBOSearch,
|
|
ListView.separated(
|
|
separatorBuilder:(context,index)=> Divider(color: ColorPalette.black54,height: 5,),
|
|
itemCount: ConstVariable().itensCBO.length,
|
|
itemBuilder: (context,index){
|
|
return Container(
|
|
width: width*0.8,
|
|
color: ColorPalette.white,
|
|
child: ListTile(
|
|
onTap: (){
|
|
setState(() {
|
|
selectCBO = ConstVariable().itensCBO[index];
|
|
Navigator.pop(context);
|
|
if(selectProcedure!= null && selectCBO!= null && selectService!=null){
|
|
disableButton = false;
|
|
}
|
|
});
|
|
},
|
|
title: TextDefault(
|
|
color: ColorPalette.black54,
|
|
text: ConstVariable().itensCBO[index],
|
|
fontSize: 16,
|
|
maxLines: 2,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
child: selectCBO!=null?
|
|
Container(
|
|
width: width,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SubtitleContainers(title: 'CBO',width: width*0.3,),
|
|
Spacer(),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
|
width: width*0.65,
|
|
child: TextDefault(
|
|
color: ColorPalette.black54,
|
|
text: selectCBO!,
|
|
fontSize: 15,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
):
|
|
SubtitleContainers(title: 'CBO')
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10),
|
|
child: ButtonDefault(
|
|
title: 'Adicionar',
|
|
borderColor: disableButton?ColorPalette.buttonDisable:ColorPalette.appBar,
|
|
background: ColorPalette.appBar,
|
|
disableColor: ColorPalette.buttonDisable,
|
|
textColor: ColorPalette.white,
|
|
onPressed: disableButton?null:()=>Navigator.pushReplacementNamed(context, '/home'),
|
|
width: double.infinity,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0,horizontal: 2),
|
|
child: Card(
|
|
child: TitleContainers(
|
|
title: 'Procedimentos',
|
|
)
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|