inserido o progress indicator
This commit is contained in:
@@ -49,7 +49,7 @@ class _ImportSigtapScreenState extends State<ImportSigtapScreen> {
|
||||
setState(() {
|
||||
stage = "Etapa 2 de 4 - Gravando os Procedimentos no Aplicativo";
|
||||
});
|
||||
// print(value['procedimentos']);
|
||||
// print(valueAPI['procedimentos']);
|
||||
await DbSqliteSigtap().saveProceduresSigtapDB(valueAPI['procedimentos']).then((value)async{
|
||||
await DbSqliteSigtap().saveProceduresRegisterSigtapDB(valueAPI['procedimentosRegistros']).then((value)async{
|
||||
setState(() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:rkm/config/color_palette.dart';
|
||||
import 'package:rkm/widgets/alert_dialog_default.dart';
|
||||
import 'package:rkm/widgets/button_default.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import '../config/const_variable.dart';
|
||||
import '../service/api/api_data_load.dart';
|
||||
import '../service/db/db_sqlite_load.dart';
|
||||
import '../service/shared_preferences/shared_preferences_service.dart';
|
||||
@@ -25,6 +26,8 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
bool loading = false;
|
||||
String nameCityApi = '';
|
||||
String user = '';
|
||||
double countProg = 0.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -53,76 +56,117 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
print('idUsuario $idUsuario');
|
||||
_prefService.createCacheidUsuario(idUsuario).then((value)async{
|
||||
await ApiDataLoad().loadUnidades(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length !=0){
|
||||
List list = value;
|
||||
if(list.length !=0){
|
||||
setState(() {
|
||||
messageSteps = "Etapa 1 de 7 - Gravando as Unidades no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveUnidadesDB(value).then((value)async{
|
||||
await ApiDataLoad().loadProcedimentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
setState(() {
|
||||
messageSteps = "Etapa 2 de 7 - Gravando os Procedimentos no Aplicativo";
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveUnidadesDB(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataLoad().loadProcedimentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
setState(() {
|
||||
messageSteps = "Etapa 2 de 7 - Gravando os Procedimentos no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveProceduresDB(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
await DbSqliteLoad().saveProceduresDB(value).then((value)async{
|
||||
print('finalizou save Procedures');
|
||||
await ApiDataLoad().loadProcedimentosRegistros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
await DbSqliteLoad().saveProceduresRegisterDB(value).then((value)async{
|
||||
print('finalizou saveProceduresRegisterDB');
|
||||
await ApiDataLoad().loadCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCID');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 3 de 7 - Gravando os CIDs no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveCID(value).then((value)async{
|
||||
print('finalizou saveCID');
|
||||
await ApiDataLoad().loadProcedimentosCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCID');
|
||||
await DbSqliteLoad().saveProceduresCID(value).then((value)async{
|
||||
print('finalizou saveProceduresCID');
|
||||
await ApiDataLoad().loadCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCBO');
|
||||
}
|
||||
print('finalizou save Procedures');
|
||||
await ApiDataLoad().loadProcedimentosRegistros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
await DbSqliteLoad().saveProceduresRegisterDB(value).then((value)async{
|
||||
print('finalizou saveProceduresRegisterDB');
|
||||
await ApiDataLoad().loadCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCID');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 3 de 7 - Gravando os CIDs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCID(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCID');
|
||||
await ApiDataLoad().loadProcedimentosCID(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCID');
|
||||
await DbSqliteLoad().saveProceduresCID(value).then((value)async{
|
||||
print('finalizou saveProceduresCID');
|
||||
await ApiDataLoad().loadCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCBO');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 4 de 7 - Gravando os CBOs no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCBO(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCBO');
|
||||
await ApiDataLoad().loadProcedimentosCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCBO');
|
||||
await DbSqliteLoad().saveProceduresCBO(value).then((value)async{
|
||||
print('finalizou saveProceduresCBO');
|
||||
await ApiDataLoad().loadCIAP(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCIAP');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 4 de 7 - Gravando os CBOs no Aplicativo";
|
||||
messageSteps = "Etapa 5 de 7 - Gravando os CIAPs no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveCBO(value).then((value)async{
|
||||
print('finalizou saveCBO');
|
||||
await ApiDataLoad().loadProcedimentosCBO(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadProcedimentosCBO');
|
||||
await DbSqliteLoad().saveProceduresCBO(value).then((value)async{
|
||||
print('finalizou saveProceduresCBO');
|
||||
await ApiDataLoad().loadCIAP(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadCIAP');
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCIAP(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveCIAP');
|
||||
await ApiDataLoad().loadMunicipios(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadMunicipios');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 6 de 7 - Gravando os Municípios no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveCity(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataLoad().loadEquipes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipes');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 7 de 7 - Gravando as Equipes no Aplicativo";
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteLoad().saveTeam(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
print('finalizou saveTeam');
|
||||
await ApiDataLoad().loadEquipeComponentes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipeComponentes');
|
||||
await DbSqliteLoad().saveTeamComponents(value).then((value)async{
|
||||
print('finalizou saveTeamComponents');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 5 de 7 - Gravando os CIAPs no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveCIAP(value).then((value)async{
|
||||
print('finalizou saveCIAP');
|
||||
await ApiDataLoad().loadMunicipios(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadMunicipios');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 6 de 7 - Gravando os Municípios no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveCity(value).then((value)async{
|
||||
print('finalizou saveCity');
|
||||
await ApiDataLoad().loadEquipes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipes');
|
||||
setState(() {
|
||||
messageSteps = "Etapa 7 de 7 - Gravando as Equipes no Aplicativo";
|
||||
});
|
||||
await DbSqliteLoad().saveTeam(value).then((value)async{
|
||||
print('finalizou saveTeam');
|
||||
await ApiDataLoad().loadEquipeComponentes(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
print('loadEquipeComponentes');
|
||||
await DbSqliteLoad().saveTeamComponents(value).then((value)async{
|
||||
print('finalizou saveTeamComponents');
|
||||
setState(() {
|
||||
finish = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
finish = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -223,7 +267,11 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
fontWeigth: FontWeight.bold,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 3,
|
||||
)
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
TextDefault(text: countProg>0.94?'100 % finalizando etapa atual':(countProg*100).toStringAsFixed(0) + '%',color: Colors.black,textAlign: TextAlign.center,fontWeigth: FontWeight.bold,fontSize: 20),
|
||||
SizedBox(height: 10),
|
||||
LinearProgressIndicator(value: countProg,minHeight: 15,color: ColorPalette.appBar,backgroundColor: ColorPalette.titleContainer,)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm/controllers/main_controllers.dart';
|
||||
import 'package:rkm/screens/home_screen.dart';
|
||||
import 'package:rkm/service/api/url_api_const.dart';
|
||||
import 'package:rkm/config/color_palette.dart';
|
||||
import 'package:rkm/config/const_variable.dart';
|
||||
@@ -10,6 +11,7 @@ import 'package:rkm/widgets/text_default.dart';
|
||||
import '../../service/api/api_data_load.dart';
|
||||
import '../../service/db/db_sqlite_load.dart';
|
||||
import '../../service/shared_preferences/shared_preferences_service.dart';
|
||||
import '../../widgets/title_input.dart';
|
||||
import '../load_init_screen.dart';
|
||||
class LoginLoadScreen extends StatefulWidget {
|
||||
const LoginLoadScreen({Key? key}) : super(key: key);
|
||||
@@ -28,8 +30,8 @@ class _LoginLoadScreenState extends State<LoginLoadScreen> {
|
||||
String? now;
|
||||
String? selectCity;
|
||||
int contLogo = 0;
|
||||
String mode = 'desenvolvimento';
|
||||
String urlAPI = UrlApiConst.ApiUrlDesenvolvimento;
|
||||
String mode = 'online';
|
||||
String urlAPI = UrlApiConst.ApiUrlOnline;
|
||||
bool loading = false;
|
||||
String nameCityApi = '';
|
||||
String nameCityFront = '';
|
||||
@@ -97,7 +99,8 @@ class _LoginLoadScreenState extends State<LoginLoadScreen> {
|
||||
nameCityApi,
|
||||
nameCityFront,
|
||||
codState,
|
||||
codCityIbge).then((value) {
|
||||
codCityIbge
|
||||
).then((value) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -189,23 +192,24 @@ class _LoginLoadScreenState extends State<LoginLoadScreen> {
|
||||
height: mode == 'desenvolvimento'?height*0.4:height*0.3,
|
||||
child: ListView(
|
||||
children: [
|
||||
TitleInput(title:'Usuário'),
|
||||
InputText(
|
||||
hint: 'Usuário',
|
||||
label: 'Usuário',
|
||||
title: 'Usuário',
|
||||
controller: inputUser,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
TitleInput(title:'Senha'),
|
||||
InputText(
|
||||
hint: 'Senha',
|
||||
label: 'Senha',
|
||||
title: 'Senha',
|
||||
obscure: true,
|
||||
controller: inputPassword,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
TitleInput(title:'Cidade'),
|
||||
DropDownButtonCity(
|
||||
error: 'Campo obrigatório',
|
||||
validator: mandatory,
|
||||
@@ -217,18 +221,18 @@ class _LoginLoadScreenState extends State<LoginLoadScreen> {
|
||||
});
|
||||
},
|
||||
),
|
||||
mode == 'desenvolvimento'?TitleInput(title:'IP'):Container(),
|
||||
mode == 'desenvolvimento'?InputText(
|
||||
hint: 'IP',
|
||||
label: 'IP',
|
||||
title: 'IP',
|
||||
obscure: false,
|
||||
controller: inputIP,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
):Container(),
|
||||
mode == 'desenvolvimento'?TitleInput(title:'Porta'):Container(),
|
||||
mode == 'desenvolvimento'?InputText(
|
||||
hint: 'Porta',
|
||||
label: 'Porta',
|
||||
title: 'Porta',
|
||||
obscure: false,
|
||||
controller: inputPort,
|
||||
width: width*0.6,
|
||||
@@ -240,6 +244,12 @@ class _LoginLoadScreenState extends State<LoginLoadScreen> {
|
||||
),
|
||||
),
|
||||
loading?Container():ButtonDefault(
|
||||
// onPressed: (){
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => HomeScreen()));
|
||||
// },
|
||||
onPressed: ()=>checkLogin(),
|
||||
title: 'Carga Inicial',
|
||||
width: width*0.6,
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:rkm/widgets/text_default.dart';
|
||||
import '../../controllers/main_controllers.dart';
|
||||
import '../../service/api/api_data_load.dart';
|
||||
import '../../service/db/db_sqlite_load.dart';
|
||||
import '../../widgets/title_input.dart';
|
||||
class LoginSavedScreen extends StatefulWidget {
|
||||
List listControl;
|
||||
|
||||
@@ -156,17 +157,17 @@ class _LoginSavedScreenState extends State<LoginSavedScreen> {
|
||||
height: height*0.2,
|
||||
child: ListView(
|
||||
children: [
|
||||
TitleInput(title:'Usuário'),
|
||||
InputText(
|
||||
hint: 'Usuário',
|
||||
label: inputUser.text.isNotEmpty?'':'Usuário',
|
||||
title: 'Usuário',
|
||||
controller: inputUser,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
TitleInput(title:'Senha'),
|
||||
InputText(
|
||||
hint: 'Senha',
|
||||
label: inputPassword.text.isNotEmpty?'':'Senha',
|
||||
title: 'Senha',
|
||||
obscure: true,
|
||||
controller: inputPassword,
|
||||
width: width*0.6,
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../../controllers/main_controllers.dart';
|
||||
import '../../service/api/api_data_load.dart';
|
||||
import '../../service/db/db_sqlite_load.dart';
|
||||
import '../../service/shared_preferences/shared_preferences_service.dart';
|
||||
import '../../widgets/title_input.dart';
|
||||
class SyncLoginScreen extends StatefulWidget {
|
||||
|
||||
@override
|
||||
@@ -197,26 +198,27 @@ class _SyncLoginScreenState extends State<SyncLoginScreen> {
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: Container(
|
||||
width: width*0.6,
|
||||
height: height*0.35,
|
||||
height: height*0.4,
|
||||
child: ListView(
|
||||
children: [
|
||||
TitleInput(title:'Usuário'),
|
||||
InputText(
|
||||
hint: 'Usuário',
|
||||
label: inputUser.text.isNotEmpty?'':'Usuário',
|
||||
title: 'Usuário',
|
||||
controller: inputUser,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
TitleInput(title:'Senha'),
|
||||
InputText(
|
||||
hint: 'Senha',
|
||||
label: inputPassword.text.isNotEmpty?'':'Senha',
|
||||
title: 'Senha',
|
||||
obscure: true,
|
||||
controller: inputPassword,
|
||||
width: width*0.6,
|
||||
colorBorder: Colors.white,
|
||||
onChanged: (v)=>setState((){}),
|
||||
),
|
||||
TitleInput(title:'Unidade'),
|
||||
DropDownButtonDefault(
|
||||
width: width*0.7,
|
||||
title: 'Unidade',
|
||||
@@ -231,6 +233,7 @@ class _SyncLoginScreenState extends State<SyncLoginScreen> {
|
||||
getTeam();
|
||||
},
|
||||
),
|
||||
TitleInput(title:'Equipe'),
|
||||
DropDownButtonDefault(
|
||||
width: width*0.7,
|
||||
title: 'Equipe',
|
||||
|
||||
@@ -458,7 +458,7 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
'ATENDIMENTOS' : '',
|
||||
'SINCRONIZADO' : 'N',
|
||||
};
|
||||
await DbSqliteSync().insertCidadaos(row,editing?'update':'new',codSus).then((value){
|
||||
await DbSqliteSync().insertCidadaos(row,editing?'update':'new',codSus,0).then((value){
|
||||
if(checkCNS != 'ok' || CNSController.text.isEmpty){
|
||||
AlertDialogDefault().alert(
|
||||
context,
|
||||
|
||||
@@ -361,7 +361,7 @@ class _RegisterHomeScreenState extends State<RegisterHomeScreen> {
|
||||
'CARGO_RESP_TECNICO_INST' : CARGO_RESP_TECNICO_INST,
|
||||
'TEL_RESP_TECNICO_INST' : TEL_RESP_TECNICO_INST,
|
||||
};
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(row,TIPO_SALVAR,ID_DOMICILIO,ID_CIDADAO,CD_USUARIO_SUS).then((value){
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(row,TIPO_SALVAR,ID_DOMICILIO,ID_CIDADAO,CD_USUARIO_SUS,0).then((value){
|
||||
AlertDialogDefault().alert(
|
||||
context,
|
||||
'Aviso',
|
||||
|
||||
@@ -545,7 +545,7 @@ class _RegisterIndividualScreenState extends State<RegisterIndividualScreen> {
|
||||
'CRIANCAS_OUTRO' : CRIANCAS_OUTRO?1:2,
|
||||
'IDENTIDADE_GENERO' : IDENTIDADE_GENERO_COD,
|
||||
};
|
||||
await DbSqliteSync().insertCadastrosIndividuais(row,TIPO_SALVAR,ID_CIDADAO).then((value){
|
||||
await DbSqliteSync().insertCadastrosIndividuais(row,TIPO_SALVAR,ID_CIDADAO,0).then((value){
|
||||
AlertDialogDefault().alert(
|
||||
context,
|
||||
'Aviso',
|
||||
|
||||
@@ -34,6 +34,7 @@ class _SyncInitScreenState extends State<SyncInitScreen> {
|
||||
int codCity = 0;
|
||||
int codCityIbge = 0;
|
||||
String codState = '';
|
||||
double countProg = 0.0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -85,74 +86,128 @@ class _SyncInitScreenState extends State<SyncInitScreen> {
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 2 de 10 - Gravando os Bairros no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertBairros(value).then((value)async{
|
||||
await ApiDataSync().syncTiposLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertBairros(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncTiposLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Tipos de Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 3 de 10 - Gravando os Tipos de Logradouros no Aplicativo");
|
||||
}
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertTiposLogradouros(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Tipos de Logradouros - Por favor, tente novamente!");
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 3 de 10 - Gravando os Tipos de Logradouros no Aplicativo");
|
||||
setState(()=> messageSteps = "Etapa 4 de 10 - Gravando os Logradouros no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertTiposLogradouros(value).then((value)async{
|
||||
await ApiDataSync().syncLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertLogradouros(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncLoteamentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Loteamentos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 5 de 10 - Gravando os Loteamentos no Aplicativo");
|
||||
}
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertLoteamentos(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncProfissionais(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Logradouros - Por favor, tente novamente!");
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 4 de 10 - Gravando os Logradouros no Aplicativo");
|
||||
setState(()=> messageSteps = "Etapa 6 de 10 - Gravando os Profissionais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertLogradouros(value).then((value)async{
|
||||
await ApiDataSync().syncLoteamentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertProfissionais(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncProfissionaisCBOs(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os CBOs dos Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 7 de 10 - Gravando os CBO´s dos Profissionais no Aplicativo");
|
||||
}
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertProfissionaisCBOs(value,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncCidadaos(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Loteamentos - Por favor, tente novamente!");
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros dos Cidadãos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 5 de 10 - Gravando os Loteamentos no Aplicativo");
|
||||
setState(()=> messageSteps = "Etapa 8 de 10 - Gravando os Cidadãos no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertLoteamentos(value).then((value)async{
|
||||
await ApiDataSync().syncProfissionais(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 6 de 10 - Gravando os Profissionais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertProfissionais(value).then((value)async{
|
||||
await ApiDataSync().syncProfissionaisCBOs(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os CBOs dos Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 7 de 10 - Gravando os CBO´s dos Profissionais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertProfissionaisCBOs(value).then((value)async{
|
||||
await ApiDataSync().syncCidadaos(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros dos Cidadãos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 8 de 10 - Gravando os Cidadãos no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertCidadaos(value,'sync','').then((value)async{
|
||||
await ApiDataSync().syncCadastrosDomiciliares(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Domiciliares - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 9 de 10 - Gravando os Cadastros Domiciliares no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(value,'sync',0,0,'').then((value)async{
|
||||
await ApiDataSync().syncCadastrosIndividuais(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Individuais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 10 de 10 - Gravando os Cadastros Individuais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertCadastrosIndividuais(value,'sync',0).then((value)async{
|
||||
await DbSqliteSync().saveSync(codCity,codState,urlAPI,mode,nameCityApi,nameCityFront,codCityIbge,user,idUnidade,nomeUnidade,area,microarea).then((value)async{
|
||||
Navigator.pushNamed(context, '/home');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertCidadaos(value,'sync','',i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncCadastrosDomiciliares(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Domiciliares - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 9 de 10 - Gravando os Cadastros Domiciliares no Aplicativo");
|
||||
}
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(value,'sync',0,0,'',i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await ApiDataSync().syncCadastrosIndividuais(urlAPI,mode,nameCityApi,user,idUnidade,area,microarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Individuais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 10 de 10 - Gravando os Cadastros Individuais no Aplicativo");
|
||||
}
|
||||
List list = value;
|
||||
for(int i=0;list.length > i;i++){
|
||||
await DbSqliteSync().insertCadastrosIndividuais(value,'sync',0,i).then((value)async{
|
||||
int cont = list.length!=0?list.length:0;
|
||||
countProg = i/cont;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
await DbSqliteSync().saveSync(codCity,codState,urlAPI,mode,nameCityApi,nameCityFront,codCityIbge,user,idUnidade,nomeUnidade,area,microarea).then((value)async{
|
||||
Navigator.pushNamed(context, '/home');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -245,7 +300,11 @@ class _SyncInitScreenState extends State<SyncInitScreen> {
|
||||
fontWeigth: FontWeight.bold,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 3,
|
||||
)
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
TextDefault(text: countProg>0.94?'100 % finalizando etapa atual':(countProg*100).toStringAsFixed(0) + '%',color: Colors.black,textAlign: TextAlign.center,fontWeigth: FontWeight.bold,fontSize: 20),
|
||||
SizedBox(height: 10),
|
||||
LinearProgressIndicator(value: countProg,minHeight: 15,color: ColorPalette.appBar,backgroundColor: ColorPalette.titleContainer,)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user