mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
Cw 430 find a better way to decide when to show the desktop UI (#977)
* Find a better way to decide when to show the desktop UI * fix UI issue for tablet view * fix trocar invoice issue for landscape layout * fix present receive option piker UI issue * fix dascktop layout * - Fix AnonPay Navigation - Fix Wallet changing on Mobile --------- Co-authored-by: Serhii <borodenko.sv@gmail.com> Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
co-authored by
Serhii
OmarHatem
parent
d4969633b0
commit
ff420c7c7e
@@ -4,6 +4,7 @@ import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/entities/main_actions.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/market_place_page.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/version_comparator.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/market_place_view_model.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -42,15 +43,30 @@ class DashboardPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: ResponsiveLayoutUtil.instance.isMobile
|
||||
? _DashboardPageView(
|
||||
return Scaffold(body: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (DeviceInfo.instance.isDesktop) {
|
||||
if (constraints.maxWidth > ResponsiveLayoutUtil.kDesktopMaxDashBoardWidthConstraint) {
|
||||
return getIt.get<DesktopSidebarWrapper>();
|
||||
} else {
|
||||
return _DashboardPageView(
|
||||
balancePage: balancePage,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
addressListViewModel: addressListViewModel,
|
||||
)
|
||||
: getIt.get<DesktopSidebarWrapper>(),
|
||||
);
|
||||
);
|
||||
}
|
||||
} else if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
|
||||
return _DashboardPageView(
|
||||
balancePage: balancePage,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
addressListViewModel: addressListViewModel,
|
||||
);
|
||||
} else {
|
||||
return getIt.get<DesktopSidebarWrapper>();
|
||||
}
|
||||
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +267,7 @@ class _DashboardPageView extends BasePage {
|
||||
pages.add(Semantics(
|
||||
label: S.of(context).market_place,
|
||||
child: MarketPlacePage(
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
dashboardViewModel: dashboardViewModel,
|
||||
marketPlaceViewModel: getIt.get<MarketPlaceViewModel>(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -138,7 +138,7 @@ class PresentReceiveOptionPicker extends StatelessWidget {
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 40),
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.pop(context),
|
||||
onTap: () => Navigator.pop(popUpContext),
|
||||
child: CircleAvatar(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/anonpay_input_form.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/view_model/anon_invoice_page_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart';
|
||||
@@ -54,9 +53,7 @@ class AnonPayInvoicePage extends BasePage {
|
||||
AppBarStyle get appBarStyle => AppBarStyle.transparent;
|
||||
|
||||
@override
|
||||
void onClose(BuildContext context) {
|
||||
Navigator.popUntil(context, ModalRoute.withName(Routes.dashboard));
|
||||
}
|
||||
void onClose(BuildContext context) => Navigator.popUntil(context, (route) => route.isFirst);
|
||||
|
||||
@override
|
||||
Widget middle(BuildContext context) =>
|
||||
|
||||
@@ -32,28 +32,7 @@ class AnonPayReceivePage extends BasePage {
|
||||
bool get resizeToAvoidBottomInset => false;
|
||||
|
||||
@override
|
||||
Widget leading(BuildContext context) {
|
||||
final _backButton = Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme!
|
||||
.displayMedium!
|
||||
.backgroundColor!,
|
||||
size: 16,
|
||||
);
|
||||
|
||||
return SizedBox(
|
||||
height: 37,
|
||||
width: 37,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
child: TextButton(
|
||||
onPressed: () =>
|
||||
Navigator.pushNamedAndRemoveUntil(context, Routes.dashboard, (route) => false),
|
||||
child: _backButton),
|
||||
),
|
||||
);
|
||||
}
|
||||
void onClose(BuildContext context) => Navigator.popUntil(context, (route) => route.isFirst);
|
||||
|
||||
@override
|
||||
Widget middle(BuildContext context) {
|
||||
|
||||
@@ -220,7 +220,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
await hideProgressText();
|
||||
// only pop the wallets route in mobile as it will go back to dashboard page
|
||||
// in desktop platforms the navigation tree is different
|
||||
if (ResponsiveLayoutUtil.instance.isMobile) {
|
||||
if (ResponsiveLayoutUtil.instance.shouldRenderMobileUI()) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user