recuperando da api loadEquipeComponentes e salvando no DB
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:rkm/widgets/text_default.dart';
|
||||
import '../models/args_load_init_model.dart';
|
||||
import '../service/api/api_data.dart';
|
||||
import '../service/db/db_sqlite.dart';
|
||||
import '../utils/const_variable.dart';
|
||||
|
||||
class LoadInitScreen extends StatefulWidget {
|
||||
ArgsLoadInitModel args;
|
||||
@@ -24,7 +25,16 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
initLoading();
|
||||
// initLoading();
|
||||
finishLoad();
|
||||
}
|
||||
|
||||
finishLoad()async{
|
||||
await ApiData().loadCompetencia(widget.args).then((value)async{
|
||||
await DbSqlite().saveCompetence(value,widget.args).then((value)async{
|
||||
Navigator.pushReplacementNamed(context, '/home');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
initLoading()async{
|
||||
@@ -91,7 +101,13 @@ class _LoadInitScreenState extends State<LoadInitScreen> {
|
||||
});
|
||||
await DbSqlite().saveTeam(value).then((value)async{
|
||||
print('finalizou saveTeam');
|
||||
Navigator.pushReplacementNamed(context, '/home');
|
||||
await ApiData().loadEquipeComponentes(widget.args).then((value)async{
|
||||
print('loadEquipeComponentes');
|
||||
await DbSqlite().saveTeamComponents(value).then((value)async{
|
||||
print('finalizou saveTeamComponents');
|
||||
finishLoad();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
});
|
||||
//verificar se a criptografia identificou se a senha está correta
|
||||
if(EncryptPassword().encrypt(inputPassword.text,response['userPass']) == response['userPass']){
|
||||
print(EncryptPassword().encrypt(inputPassword.text,response['userPass']));
|
||||
// print(EncryptPassword().encrypt(inputPassword.text,response['userPass']));
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
|
||||
@@ -16,7 +16,9 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
DbSqlite().intialDB();
|
||||
DbSqlite().intialDB().then((value){
|
||||
|
||||
});
|
||||
timer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user