Commit 2b66dff3 authored by Ilham Maulana's avatar Ilham Maulana 💻

fix: pop routing

parent 6ab0290f
......@@ -41,7 +41,9 @@ class _FormScreen extends State<FormScreen> {
title: Text(title),
leading: withBack
? BackButton(
onPressed: () => context.push(backRoute ?? ""),
onPressed: () => backRoute != null
? context.push(backRoute!)
: context.pop(),
)
: null,
actions: action,
......@@ -99,7 +101,7 @@ class ChangePasswordScreen extends StatelessWidget {
return FormScreen(
title: title,
backRoute: "/profile-edit",
backRoute: null,
body: const ChangePasswordForm(),
);
}
......
......@@ -18,7 +18,7 @@ class ProfileEditScreen extends StatelessWidget {
appBar: AppBar(
title: Text(title),
leading: BackButton(
onPressed: () => context.push("/"),
onPressed: () => context.pop(),
),
),
body: Consumer<AuthProvider>(
......
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:library_app/src/providers/auth_provider.dart';
import 'package:library_app/src/models/user.dart';
......@@ -120,16 +119,6 @@ class _ProfileEditForm extends State<ProfileEditForm> {
),
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => context.go("/change-password"),
child: const Text("Change Password"),
),
),
)
],
),
),
......
......@@ -78,15 +78,25 @@ class _Profile extends State<Profile> {
textAlign: TextAlign.center,
),
),
const SizedBox(
height: 10.0,
),
FilledButton(
child: const Text("Edit Profile"),
onPressed: () {
context.go("/profile-edit");
context.push("/profile-edit");
},
),
const SizedBox(
height: 10.0,
),
ElevatedButton(
onPressed: () => context.push("/change-password"),
child: const Text("Change Password"),
),
const SizedBox(
height: 10.0,
),
OutlinedButton(
child: const Text("Log Out"),
onPressed: () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment