fix(login): opravit vracení na přihlašovací stránku při vracení zpět
Merge pull request #29 from hernikplays/bug-login
This commit is contained in:
commit
d2cbebff25
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(
|
||||||
builder: (c) =>
|
MaterialPageRoute(
|
||||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)));
|
builder: (c) =>
|
||||||
|
JidelnicekPage(canteen: widget.canteen, n: widget.n)),
|
||||||
|
(route) => false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue