105 lines
3.5 KiB
Dart
105 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/service/db/db_sqlite_sync.dart';
|
|
import 'package:rkm/widgets/button_default.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import '../../service/db/db_sqlite_load.dart';
|
|
import '../../service/shared_preferences/shared_preferences_service.dart';
|
|
import '../../config/color_palette.dart';
|
|
import '../../widgets/text_default.dart';
|
|
|
|
class ClearDataScreen extends StatefulWidget {
|
|
const ClearDataScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<ClearDataScreen> createState() => _ClearDataScreenState();
|
|
}
|
|
|
|
class _ClearDataScreenState extends State<ClearDataScreen> {
|
|
|
|
String mode ='';
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
dataSQLite();
|
|
}
|
|
|
|
dataSQLite()async{
|
|
final PrefService _preferences = PrefService();
|
|
_preferences.readCacheModel('user', 'password', 'city', 'mode').then((list){
|
|
setState(() {
|
|
mode = list[3];
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
double width = MediaQuery.of(context).size.width;
|
|
return Scaffold(
|
|
bottomSheet: Container(
|
|
color: ColorPalette.appBar,
|
|
child: Row(
|
|
children: [
|
|
Spacer(),
|
|
ButtonDefault(
|
|
title: 'Voltar',
|
|
width: width*0.2,
|
|
textColor: ColorPalette.white,
|
|
background: ColorPalette.appBar,
|
|
borderColor: ColorPalette.appBar,
|
|
onPressed: ()=>Navigator.pushNamedAndRemoveUntil(context, '/home', (Route<dynamic> route) => false),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
body: Container(
|
|
padding: EdgeInsets.only(top: 100),
|
|
decoration: BoxDecoration(
|
|
color: ColorPalette.grayBackground,
|
|
image: DecorationImage(
|
|
fit: BoxFit.fitHeight,
|
|
image: AssetImage('assets/images/load_image.png'),
|
|
)
|
|
),
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
child: Column(
|
|
children: [
|
|
Image.asset('assets/images/logo.PNG',width: width*0.5,),
|
|
mode == 'homologacao'?Image.asset('assets/images/homologacao.png',width: width*0.4):Container(),
|
|
mode == 'desenvolvimento'?Image.asset('assets/images/desenvolvimento.png',width: width*0.4):Container(),
|
|
SizedBox(height: 50),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 5.0,horizontal: 15),
|
|
child: TextDefault(
|
|
text: 'Todos os registros (dados Importados, Cadastros e Atendimentos) do aplicativo serão excluídos.\n\n'
|
|
'Para utilizar novamente o aplicativo deverá ser realizada uma nova Carga inicial.',
|
|
maxLines: 5,
|
|
textAlign: TextAlign.center,
|
|
color: ColorPalette.black54,
|
|
fontSize: 15,
|
|
fontWeigth: FontWeight.bold,
|
|
),
|
|
),
|
|
ButtonDefault(
|
|
title: 'Limpar Dados',
|
|
width: width*0.9,
|
|
textColor: ColorPalette.white,
|
|
background: ColorPalette.appBar,
|
|
borderColor: ColorPalette.appBar,
|
|
onPressed: ()async{
|
|
await DbSqliteLoad().deleteLoad().then((_)async {
|
|
await DbSqliteSync().deleteSync().then((_){
|
|
Navigator.pushReplacementNamed(context, '/splash');
|
|
});
|
|
});
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|