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");
|
||||
if (!mounted) return;
|
||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (c) => WelcomeScreen(
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin)));
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin),
|
||||
),
|
||||
(route) => false);
|
||||
} else {
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => JidelnicekPage(
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin)),
|
||||
);
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin),
|
||||
),
|
||||
(route) => false);
|
||||
}
|
||||
} on PlatformException {
|
||||
if (!mounted) return;
|
||||
|
@ -381,20 +384,21 @@ class _LoginPageState extends State<LoginPage> {
|
|||
await storage.read(key: "oc_souhlas");
|
||||
if (!mounted) return;
|
||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (c) => WelcomeScreen(
|
||||
canteen: canteen,
|
||||
n: flutterLocalNotificationsPlugin)));
|
||||
n: flutterLocalNotificationsPlugin)),
|
||||
(route) => false);
|
||||
} else {
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => JidelnicekPage(
|
||||
canteen: canteen,
|
||||
n: flutterLocalNotificationsPlugin)),
|
||||
);
|
||||
(route) => false);
|
||||
}
|
||||
} on PlatformException {
|
||||
if (!mounted) return;
|
||||
|
@ -445,10 +449,11 @@ class _LoginPageState extends State<LoginPage> {
|
|||
den: DateTime.parse(j["den"])));
|
||||
}
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: ((context) => OfflineJidelnicek(jidla: jidla))));
|
||||
builder: ((context) => OfflineJidelnicek(jidla: jidla))),
|
||||
(route) => false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,8 +330,10 @@ class _JidelnicekPageState extends State<JidelnicekPage> {
|
|||
onPressed: () {
|
||||
const storage = FlutterSecureStorage();
|
||||
storage.deleteAll();
|
||||
Navigator.pushReplacement(context,
|
||||
MaterialPageRoute(builder: (c) => const LoginPage()));
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(builder: (c) => const LoginPage()),
|
||||
(route) => false);
|
||||
},
|
||||
child: Text(Languages.of(context)!.yes)),
|
||||
TextButton(
|
||||
|
|
|
@ -70,9 +70,11 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||
const storage = FlutterSecureStorage();
|
||||
await storage.write(key: "oc_souhlas", value: "ano");
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (c) =>
|
||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)));
|
||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)),
|
||||
(route) => false);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
Reference in a new issue