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");
|
||||
if (!mounted) return;
|
||||
if (odsouhlasil == null || odsouhlasil != "ano") {
|
||||
Navigator.pushReplacement(
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (c) => WelcomeScreen(
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin)));
|
||||
builder: (c) => WelcomeScreen(
|
||||
canteen: canteen, n: flutterLocalNotificationsPlugin),
|
||||
),
|
||||
(route) => false);
|
||||
} else {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
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(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => JidelnicekPage(
|
||||
canteen: canteen,
|
||||
n: flutterLocalNotificationsPlugin)),
|
||||
);
|
||||
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(
|
||||
builder: (c) =>
|
||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)));
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (c) =>
|
||||
JidelnicekPage(canteen: widget.canteen, n: widget.n)),
|
||||
(route) => false);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
Reference in a new issue