bug fixed
This commit is contained in:
@@ -27,7 +27,7 @@ import '../utils/utils.dart';
|
||||
|
||||
Profile? profile;
|
||||
String tokenAdmin = "";
|
||||
|
||||
bool _canPop = false;
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@@ -92,7 +92,9 @@ class _HomePageState extends State<HomePage> {
|
||||
clearProfile() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString("access_token", "");
|
||||
_canPop = true;
|
||||
Navigator.popUntil(context, ModalRoute.withName('/'));
|
||||
_canPop = false;
|
||||
}
|
||||
|
||||
lockTest() {
|
||||
@@ -223,7 +225,17 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return PopScope(
|
||||
canPop: _canPop, // <== set a bool var or set it to false
|
||||
onPopInvoked: (bool didPop) async {
|
||||
if (didPop) {
|
||||
return;
|
||||
}
|
||||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
body: SafeArea(
|
||||
child: SmartRefresher(
|
||||
onRefresh: () {
|
||||
@@ -255,6 +267,7 @@ class _HomePageState extends State<HomePage> {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
|
||||
clearProfile();
|
||||
},
|
||||
child: Icon(
|
||||
@@ -562,7 +575,7 @@ class _HomePageState extends State<HomePage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user