Files
rkmmobile/lib/widgets/alert_dialog_default.dart

619 lines
24 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/complementary_sheet_screen.dart';
import 'package:rkm/screens/select_service/consumption_markers_screen.dart';
import 'package:rkm/screens/select_service/eligibility_assessment_screen.dart';
import 'package:rkm/screens/select_service/procedures_screen.dart';
import 'package:rkm/screens/select_service/service_dental_screen.dart';
import 'package:rkm/screens/select_service/atendimento_domiciliar_tela.dart';
import 'package:rkm/screens/select_service/service_individual_screen.dart';
import 'package:rkm/widgets/button_default.dart';
import 'package:rkm/widgets/dropdown_button_com_pesquisa.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/visita_domiciliar_tela.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,
)
],
);
}
);
}
sucess(BuildContext context,String title,String subtitle,String textButtom, var onPressed) {
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: onPressed,
title: textButtom,
width: width*0.85,
textColor: ColorPalette.white,
borderColor: ColorPalette.appBar,
background: ColorPalette.appBar,
)
],
);
}
);
}
alertSelect(BuildContext context,String name,String username, var dataPatient) {
//Cadastro e edição do Cadastro do Cidadão, Cadastro Individual, Cadastro Domiciliar e Visita Domiciliar
List list = [
'Atendimento Domiciliar',
// 'Atendimento Individual',
// 'Atendimento Odontológico',
// 'Avaliação de Elegibilidade',
// 'Ficha Complementar',
// 'Marcadores de Consumo',
// 'Procedimentos',
'Visita Domiciliar',
];
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: (){
Navigator.pop(context);
if(index==0){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => AtendimentoDomiciliarTela(name: name,username: username,)),
);
}else if(index == 1){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => VisitaDomiciliarTela(name: name,username: username,)),
);
// Navigator.push(
// context,
// MaterialPageRoute(builder:(context) => ServiceIndividualScreen(username: username,dataPatient: dataPatient,)),
// );
}else if(index == 2){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => ServiceDentalScreen(username: username,)),
);
}else if(index == 3){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => EligibilityAssessmentScreen(username: username,)),
);
}else if(index == 4){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => ComplementarySheetScreen(username: username,)),
);
}else if(index == 5){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => ConsumptionMarkersScreen(username: username,)),
);
}else if(index == 6){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => ProceduresScreen(username: username,)),
);
}else if (index==7){
Navigator.push(
context,
MaterialPageRoute(builder:(context) => VisitaDomiciliarTela(name: name,username: username,)),
);
}
},
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 listProcProfissional,
List listProc,
) {
double width = MediaQuery.of(context).size.width;
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),
DropDownButtonComPesquisa(
onChanged: (value)=>setState((){
selectProfessionals=value;
listProc.add(selectProfessionals);
setState((){});
}),
select: selectProfessionals,
title: '',
list: listProcProfissional,
width: width*0.8,
widthContainer: width*0.75,
),
// 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'),
listProcProfissional.length!=0
?Container(
width: width*0.8,
height: listProc.length*70,
child: ListView.builder(
itemCount: listProc.length,
itemBuilder: (context,index) {
print(listProc.length);
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);
setState((){});
}),
)
],
),
);
}
),
)
: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,
)
],
),
);
}
);
}
}