fix(login): opravit vracení na přihlašovací stránku při vracení zpět
This commit is contained in:
parent
e5ce622473
commit
d2d887e3ee
3 changed files with 33 additions and 24 deletions
|
@ -231,18 +231,21 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
var odsouhlasil = await storage.read(key: "oc_souhlas");
|
var odsouhlasil = await storage.read(key: "oc_souhlas");
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (c) => WelcomeScreen(
|
builder: (c) => WelcomeScreen(
|
||||||
canteen: canteen, n: flutterLocalNotificationsPlugin)));
|
canteen: canteen, n: flutterLocalNotificationsPlugin),
|
||||||
|
),
|
||||||
|
(route) => false);
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => JidelnicekPage(
|
builder: (context) => JidelnicekPage(
|
||||||
canteen: canteen, n: flutterLocalNotificationsPlugin)),
|
canteen: canteen, n: flutterLocalNotificationsPlugin),
|
||||||
);
|
),
|
||||||
|
(route) => false);
|
||||||
}
|
}
|
||||||
} on PlatformException {
|
} on PlatformException {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
@ -381,20 +384,21 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
await storage.read(key: "oc_souhlas");
|
await storage.read(key: "oc_souhlas");
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (c) => WelcomeScreen(
|
builder: (c) => WelcomeScreen(
|
||||||
canteen: canteen,
|
canteen: canteen,
|
||||||
n: flutterLocalNotificationsPlugin)));
|
n: flutterLocalNotificationsPlugin)),
|
||||||
|
(route) => false);
|
||||||
} else {
|
} else {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => JidelnicekPage(
|
builder: (context) => JidelnicekPage(
|
||||||
canteen: canteen,
|
canteen: canteen,
|
||||||
n: flutterLocalNotificationsPlugin)),
|
n: flutterLocalNotificationsPlugin)),
|
||||||
);
|
(route) => false);
|
||||||
}
|
}
|
||||||
} on PlatformException {
|
} on PlatformException {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
|
@ -445,10 +449,11 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
den: DateTime.parse(j["den"])));
|
den: DateTime.parse(j["den"])));
|
||||||
}
|
}
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pushReplacement(
|
Navigator.pushAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: ((context) => OfflineJidelnicek(jidla: jidla))));
|
builder: ((context) => OfflineJidelnicek(jidla: jidla))),
|
||||||
|
(route) => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,8 +330,10 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
const storage = FlutterSecureStorage();
|
const storage = FlutterSecureStorage();
|
||||||
storage.deleteAll();
|
storage.deleteAll();
|
||||||
Navigator.pushReplacement(context,
|
Navigator.pushAndRemoveUntil(
|
||||||
MaterialPageRoute(builder: (c) => const LoginPage()));
|
context,
|
||||||
|
MaterialPageRoute(builder: (c) => const LoginPage()),
|
||||||
|
(route) => false);
|
||||||
},
|
},
|
||||||
child: Text(Languages.of(context)!.yes)),
|
child: Text(Languages.of(context)!.yes)),
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
|
@ -70,9 +70,11 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||||
const storage = FlutterSecureStorage();
|
const storage = FlutterSecureStorage();
|
||||||
await storage.write(key: "oc_souhlas", value: "ano");
|
await storage.write(key: "oc_souhlas", value: "ano");
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
Navigator.of(context).pushAndRemoveUntil(
|
||||||
|
MaterialPageRoute(
|
||||||
builder: (c) =>
|
builder: (c) =>
|
||||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)));
|
JidelnicekPage(canteen: widget.canteen, n: widget.n)),
|
||||||
|
(route) => false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue