550 lines
20 KiB
Dart
550 lines
20 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/config/color_palette.dart';
|
|
import 'package:rkm/config/const_variable.dart';
|
|
import 'package:rkm/screens/select_service/service_home_screen.dart';
|
|
import 'package:rkm/widgets/button_default.dart';
|
|
import 'package:rkm/widgets/switch_with_subtitle.dart';
|
|
import 'package:rkm/widgets/text_default.dart';
|
|
import 'package:rkm/widgets/title_containers.dart';
|
|
import '../screens/select_service/home_visit_screen.dart';
|
|
import 'dropdown_button_default.dart';
|
|
import 'input_search_text.dart';
|
|
class AlertDialogDefault {
|
|
|
|
@override
|
|
alert_with_search(BuildContext context,controller,Widget list) {
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
double height = MediaQuery.of(context).size.height;
|
|
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context){
|
|
return AlertDialog(
|
|
title: InputSearchText(
|
|
controller: controller,
|
|
width: width*0.3,
|
|
hint: 'Buscar...',
|
|
color: ColorPalette.titleContainer,
|
|
border: false,
|
|
),
|
|
content: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
width: width*0.8,
|
|
child: Container(
|
|
width: width*0.8,
|
|
height: height*0.8,
|
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
child: list,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
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,
|
|
)
|
|
],
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
alertSelect(BuildContext context,String name) {
|
|
|
|
List list = [
|
|
'Atendimento Domiciliar',
|
|
'Atendimento Individual',
|
|
'Atendimento Odontológico',
|
|
'Avaliação de Elegibilidade',
|
|
'Ficha Complementar',
|
|
'Marcadores de Consumo',
|
|
'Procedimentos',
|
|
'Visita domiciliar',
|
|
];
|
|
|
|
List routes = [
|
|
'/service_home',
|
|
'/service_individual',
|
|
'/service_dental',
|
|
'/eligibility_assessment',
|
|
'/complementary_sheet',
|
|
'/consumption_markers',
|
|
'/procedures',
|
|
'/home_visit',
|
|
];
|
|
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: 'Seleção de Atendimento',
|
|
color: ColorPalette.black54,
|
|
textAlign: TextAlign.center,
|
|
fontWeigth: FontWeight.bold,
|
|
),
|
|
content: Container(
|
|
width: width*0.8,
|
|
height: height*0.5,
|
|
child: ListView.builder(
|
|
itemCount: list.length,
|
|
itemBuilder: (context,index){
|
|
|
|
int rest = index % 2;
|
|
|
|
return ListTile(
|
|
onTap: (){
|
|
if(index==0){
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder:(context) => ServiceHomeScreen(name: name,)),
|
|
);
|
|
}else if (index==7){
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder:(context) => HomeVisitScreen(name: name,)),
|
|
);
|
|
}else{
|
|
Navigator.pushNamed(context, routes[index]);
|
|
}
|
|
},
|
|
tileColor: rest==0?ColorPalette.white:ColorPalette.appBar,
|
|
title: TextDefault(
|
|
textAlign: TextAlign.center,
|
|
text: list[index],
|
|
color: rest==0?ColorPalette.black54:ColorPalette.white,
|
|
),
|
|
);
|
|
}
|
|
),
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
otherProfessionals(
|
|
BuildContext context,String title,String subtitle,String? selectProfessionals,String? selectCBO,String add
|
|
) {
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
double height = MediaQuery.of(context).size.height;
|
|
bool addProfissionals = false;
|
|
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context){
|
|
return StatefulBuilder(
|
|
builder:(context,setState)=> AlertDialog(
|
|
titlePadding: EdgeInsets.all(0),
|
|
contentPadding: EdgeInsets.all(0),
|
|
title: Container(
|
|
padding: EdgeInsets.all(10),
|
|
color: ColorPalette.blackButton,
|
|
child: TextDefault(
|
|
text: title,
|
|
color: ColorPalette.white,
|
|
textAlign: TextAlign.center,
|
|
fontWeigth: FontWeight.bold,
|
|
),
|
|
),
|
|
content: Container(
|
|
decoration: ConstVariable().backgroundGradient,
|
|
child: Column(
|
|
children: [
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: subtitle),
|
|
DropDownButtonDefault(
|
|
onChanged: (value)=>setState((){
|
|
selectProfessionals=value;
|
|
addProfissionals = true;
|
|
}),
|
|
select: selectProfessionals,
|
|
title: 'Profissional',
|
|
list: [
|
|
'ADMINISTRADOR',
|
|
'ALEXANDRE NITTA',
|
|
'ALINE SUELEM LEITE',
|
|
'ARIANE FAVORATO ROSA',
|
|
],
|
|
width: width
|
|
),
|
|
DropDownButtonDefault(
|
|
onChanged: (value)=>setState(()=>selectCBO=value),
|
|
select: selectCBO,
|
|
title: 'CBO',
|
|
list: [],
|
|
width: width
|
|
),
|
|
ButtonDefault(
|
|
onPressed:addProfissionals?()=>setState((){
|
|
add = selectProfessionals!;
|
|
}):null,
|
|
title: 'Adicionar',
|
|
width: width*0.85,
|
|
textColor: ColorPalette.white,
|
|
borderColor:addProfissionals?ColorPalette.appBar:ColorPalette.buttonDisable,
|
|
background: ColorPalette.appBar,
|
|
disableColor: ColorPalette.buttonDisable,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: 'Profissionais'),
|
|
add!=''
|
|
?Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: Row(
|
|
children: [
|
|
TextDefault(text: add,color: ColorPalette.black54,),
|
|
Spacer(),
|
|
IconButton(
|
|
icon: Icon(Icons.delete),
|
|
onPressed: ()=>setState((){
|
|
add='';
|
|
addProfissionals = false;
|
|
}),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
:Container()
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
actionsAlignment: MainAxisAlignment.start,
|
|
actions: [
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.pop(context),
|
|
title: 'Fechar',
|
|
width: width*0.2,
|
|
textColor: ColorPalette.black54,
|
|
borderColor: ColorPalette.white,
|
|
background: ColorPalette.white,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
otherExams(
|
|
BuildContext context,
|
|
String title,String subtitle,
|
|
String? selectProfessionals,
|
|
String? selectCBO,
|
|
String add,
|
|
List examsList,
|
|
bool requested,
|
|
bool avaliable
|
|
) {
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
double height = MediaQuery.of(context).size.height;
|
|
bool addProfissionals = false;
|
|
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context){
|
|
return StatefulBuilder(
|
|
builder:(context,setState)=> AlertDialog(
|
|
titlePadding: EdgeInsets.all(0),
|
|
contentPadding: EdgeInsets.all(0),
|
|
title: Container(
|
|
padding: EdgeInsets.all(10),
|
|
color: ColorPalette.blackButton,
|
|
child: TextDefault(
|
|
text: title,
|
|
color: ColorPalette.white,
|
|
textAlign: TextAlign.center,
|
|
fontWeigth: FontWeight.bold,
|
|
),
|
|
),
|
|
content: Container(
|
|
decoration: ConstVariable().backgroundGradient,
|
|
child: Column(
|
|
children: [
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: subtitle),
|
|
DropDownButtonDefault(
|
|
onChanged: (value)=>setState((){
|
|
selectProfessionals=value;
|
|
addProfissionals = true;
|
|
}),
|
|
select: selectProfessionals,
|
|
title: 'Exame',
|
|
list: [
|
|
'0201010011 - AMNIOCENTESE',
|
|
'0201010020 - BIOPSIA / PUNSAO DE TUMOR SUPERFICIAL DA PELE',
|
|
'0201010046 - BIOPSIA DE ANUS E CANAL ANAL',
|
|
'0201010062 - BIOSIA DE BEXIGA',
|
|
],
|
|
width: width
|
|
),
|
|
SwitchWithSubtitle(
|
|
onChanged: (v)=>setState(()=>requested=v),
|
|
value: requested,
|
|
width: width*0.8,
|
|
title: 'Solicitado'
|
|
),
|
|
SwitchWithSubtitle(
|
|
onChanged: (v)=>setState(()=>avaliable=v),
|
|
value: avaliable,
|
|
width: width*0.8,
|
|
title: 'Avaliado'
|
|
),
|
|
ButtonDefault(
|
|
onPressed:addProfissionals || examsList.length == 4?()=>setState((){
|
|
List list = selectProfessionals!.split(' - ');
|
|
add = list[0] + '${requested?' - S':''}' + '${avaliable?' - A':''}'+' - ${list[1]}';
|
|
if(examsList.length<=3){
|
|
examsList.add(add);
|
|
}else{
|
|
addProfissionals = false;
|
|
}
|
|
selectProfessionals=null;
|
|
avaliable = false;
|
|
requested = false;
|
|
}):null,
|
|
title: 'Adicionar',
|
|
width: width*0.85,
|
|
textColor: ColorPalette.white,
|
|
borderColor:addProfissionals?ColorPalette.appBar:ColorPalette.buttonDisable,
|
|
background: ColorPalette.appBar,
|
|
disableColor: ColorPalette.buttonDisable,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: 'Exames'),
|
|
examsList.length!=0
|
|
?Container(
|
|
width: width*0.8,
|
|
height: height*0.4,
|
|
child: ListView.builder(
|
|
itemCount: examsList.length,
|
|
itemBuilder: (context,index) {
|
|
return Container(
|
|
width: width * 0.8,
|
|
padding: EdgeInsets.all(10),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: width * 0.6,
|
|
child: TextDefault(text: examsList[index],
|
|
color: ColorPalette.black54,)
|
|
),
|
|
Spacer(),
|
|
IconButton(
|
|
icon: Icon(Icons.delete),
|
|
onPressed: () =>
|
|
setState(() {
|
|
examsList.removeAt(index);
|
|
}),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
),
|
|
)
|
|
:Container()
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
actionsAlignment: MainAxisAlignment.start,
|
|
actions: [
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.pop(context),
|
|
title: 'Fechar',
|
|
width: width*0.2,
|
|
textColor: ColorPalette.black54,
|
|
borderColor: ColorPalette.white,
|
|
background: ColorPalette.white,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
otherProc(
|
|
BuildContext context,
|
|
String title,
|
|
String subtitle,
|
|
String? selectProfessionals,
|
|
String? selectCBO,
|
|
String add,
|
|
List list,
|
|
List listProc,
|
|
) {
|
|
|
|
double width = MediaQuery.of(context).size.width;
|
|
double height = MediaQuery.of(context).size.height;
|
|
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context){
|
|
return StatefulBuilder(
|
|
builder:(context,setState)=> AlertDialog(
|
|
titlePadding: EdgeInsets.all(0),
|
|
contentPadding: EdgeInsets.all(0),
|
|
title: Container(
|
|
padding: EdgeInsets.all(10),
|
|
color: ColorPalette.blackButton,
|
|
child: TextDefault(
|
|
text: title,
|
|
color: ColorPalette.white,
|
|
textAlign: TextAlign.center,
|
|
fontWeigth: FontWeight.bold,
|
|
),
|
|
),
|
|
content: Container(
|
|
decoration: ConstVariable().backgroundGradient,
|
|
child: Column(
|
|
children: [
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: subtitle),
|
|
DropDownButtonDefault(
|
|
onChanged: (value)=>setState((){
|
|
selectProfessionals=value;
|
|
}),
|
|
select: selectProfessionals,
|
|
title: 'Procedimento',
|
|
list: list,
|
|
width: width
|
|
),
|
|
ButtonDefault(
|
|
onPressed:(){
|
|
listProc.add(selectProfessionals);
|
|
setState((){});
|
|
},
|
|
title: 'Adicionar',
|
|
width: width*0.8,
|
|
textColor: ColorPalette.white,
|
|
borderColor:ColorPalette.appBar,
|
|
background: ColorPalette.appBar,
|
|
disableColor: ColorPalette.buttonDisable,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Card(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
TitleContainers(title: 'Procedimentos'),
|
|
list.length!=0
|
|
?Container(
|
|
width: width*0.8,
|
|
height: height*0.4,
|
|
child: ListView.builder(
|
|
itemCount: listProc.length,
|
|
itemBuilder: (context,index) {
|
|
return Container(
|
|
width: width * 0.8,
|
|
padding: EdgeInsets.all(10),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: width * 0.65,
|
|
child: TextDefault(
|
|
fontSize: 15,
|
|
text: listProc[index],
|
|
color: ColorPalette.black54,)
|
|
),
|
|
Spacer(),
|
|
IconButton(
|
|
icon: Icon(Icons.delete),
|
|
onPressed: () =>
|
|
setState(() {
|
|
listProc.removeAt(index);
|
|
}),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
),
|
|
)
|
|
:Container()
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
actionsAlignment: MainAxisAlignment.start,
|
|
actions: [
|
|
ButtonDefault(
|
|
onPressed: ()=>Navigator.pop(context),
|
|
title: 'Fechar',
|
|
width: width*0.2,
|
|
textColor: ColorPalette.black54,
|
|
borderColor: ColorPalette.white,
|
|
background: ColorPalette.white,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
}
|