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

fix: pop routing

parent 6ab0290f
...@@ -41,7 +41,9 @@ class _FormScreen extends State<FormScreen> { ...@@ -41,7 +41,9 @@ class _FormScreen extends State<FormScreen> {
title: Text(title), title: Text(title),
leading: withBack leading: withBack
? BackButton( ? BackButton(
onPressed: () => context.push(backRoute ?? ""), onPressed: () => backRoute != null
? context.push(backRoute!)
: context.pop(),
) )
: null, : null,
actions: action, actions: action,
...@@ -99,7 +101,7 @@ class ChangePasswordScreen extends StatelessWidget { ...@@ -99,7 +101,7 @@ class ChangePasswordScreen extends StatelessWidget {
return FormScreen( return FormScreen(
title: title, title: title,
backRoute: "/profile-edit", backRoute: null,
body: const ChangePasswordForm(), body: const ChangePasswordForm(),
); );
} }
......
...@@ -18,7 +18,7 @@ class ProfileEditScreen extends StatelessWidget { ...@@ -18,7 +18,7 @@ class ProfileEditScreen extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: Text(title), title: Text(title),
leading: BackButton( leading: BackButton(
onPressed: () => context.push("/"), onPressed: () => context.pop(),
), ),
), ),
body: Consumer<AuthProvider>( body: Consumer<AuthProvider>(
......
import 'package:flutter/material.dart'; 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/providers/auth_provider.dart';
import 'package:library_app/src/models/user.dart'; import 'package:library_app/src/models/user.dart';
...@@ -120,16 +119,6 @@ class _ProfileEditForm extends State<ProfileEditForm> { ...@@ -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> { ...@@ -78,15 +78,25 @@ class _Profile extends State<Profile> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
const SizedBox(
height: 10.0,
),
FilledButton( FilledButton(
child: const Text("Edit Profile"), child: const Text("Edit Profile"),
onPressed: () { onPressed: () {
context.go("/profile-edit"); context.push("/profile-edit");
}, },
), ),
const SizedBox( const SizedBox(
height: 10.0, height: 10.0,
), ),
ElevatedButton(
onPressed: () => context.push("/change-password"),
child: const Text("Change Password"),
),
const SizedBox(
height: 10.0,
),
OutlinedButton( OutlinedButton(
child: const Text("Log Out"), child: const Text("Log Out"),
onPressed: () { 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