Skip to content

Commit

Permalink
Bugfix: Backdrop Drawer Flow (#3)
Browse files Browse the repository at this point in the history
The goal of this branch is to close Backdrop automatically (if open) when navigating to Sign In Drawer Page and Account Drawer Page on mobile view.

List of changes:
- extracted the navigation method to a private method in my_account_button_mobile.dart, connect_wallet_button_mobile.dart and added a call to the method that collapses the backdrop
  • Loading branch information
aknowak01 authored Jan 12, 2024
1 parent ecc5269 commit 5fcb08a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:miro/config/app_icons.dart';
import 'package:miro/config/theme/design_colors.dart';
import 'package:miro/views/layout/scaffold/backdrop/backdrop.dart';
import 'package:miro/views/layout/scaffold/kira_scaffold.dart';
import 'package:miro/views/pages/drawer/sign_in_drawer_page/sign_in_drawer_page.dart';
import 'package:miro/views/widgets/buttons/kira_elevated_button.dart';
Expand All @@ -18,8 +19,14 @@ class ConnectWalletButtonMobile extends StatelessWidget {
return KiraElevatedButton(
width: size.width,
height: size.height,
onPressed: () => KiraScaffold.of(context).navigateEndDrawerRoute(const SignInDrawerPage()),
onPressed: () => _handleNavigation(context),
icon: const Icon(AppIcons.account, color: DesignColors.background, size: 14),
);
}

Future<void> _handleNavigation(BuildContext context) async {
KiraScaffold.of(context).navigateEndDrawerRoute(const SignInDrawerPage());
await Future<void>.delayed(const Duration(milliseconds: 500));
Backdrop.of(context).collapse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:miro/blocs/generic/identity_registrar/identity_registrar_cubit.d
import 'package:miro/blocs/generic/identity_registrar/states/identity_registrar_loading_state.dart';
import 'package:miro/config/locator.dart';
import 'package:miro/shared/models/wallet/wallet.dart';
import 'package:miro/views/layout/scaffold/backdrop/backdrop.dart';
import 'package:miro/views/layout/scaffold/kira_scaffold.dart';
import 'package:miro/views/pages/drawer/account_drawer_page/account_drawer_page.dart';
import 'package:miro/views/widgets/kira/kira_identity_avatar.dart';
Expand Down Expand Up @@ -34,11 +35,17 @@ class MyAccountButtonMobile extends StatelessWidget {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () => KiraScaffold.of(context).navigateEndDrawerRoute(AccountDrawerPage()),
onTap: () => _handleNavigation(context),
child: buttonWidget,
),
);
},
);
}

Future<void> _handleNavigation(BuildContext context) async {
KiraScaffold.of(context).navigateEndDrawerRoute(AccountDrawerPage());
await Future<void>.delayed(const Duration(milliseconds: 500));
Backdrop.of(context).collapse();
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.21.3
version: 1.21.4

environment:
sdk: ">=3.1.3"
Expand Down

0 comments on commit 5fcb08a

Please sign in to comment.