mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
CW-502-Add-Monero-Account-Management-to-Home-Screen (#1140)
* Add the monero account widget on the Home screen * [skip ci] add hasAccounts variable
This commit is contained in:
parent
9aede1f3c1
commit
7710a19e82
3 changed files with 129 additions and 44 deletions
|
@ -1,17 +1,18 @@
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/dashboard/widgets/home_screen_account_widget.dart';
|
||||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/introducing_card.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||||
import 'package:cake_wallet/utils/feature_flag.dart';
|
import 'package:cake_wallet/utils/feature_flag.dart';
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/introducing_card.dart';
|
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
|
||||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
|
||||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
|
||||||
|
|
||||||
class BalancePage extends StatelessWidget {
|
class BalancePage extends StatelessWidget {
|
||||||
BalancePage({required this.dashboardViewModel, required this.settingsStore});
|
BalancePage({required this.dashboardViewModel, required this.settingsStore});
|
||||||
|
@ -28,47 +29,59 @@ class BalancePage extends StatelessWidget {
|
||||||
!dashboardViewModel.balanceViewModel.isReversing,
|
!dashboardViewModel.balanceViewModel.isReversing,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 56),
|
Observer(
|
||||||
Container(
|
builder: (_) => dashboardViewModel.balanceViewModel.hasAccounts
|
||||||
margin: const EdgeInsets.only(left: 24, bottom: 16),
|
? HomeScreenAccountWidget(
|
||||||
child: Observer(
|
walletName: dashboardViewModel.name,
|
||||||
builder: (_) {
|
accountName: dashboardViewModel.subname)
|
||||||
return Row(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
SizedBox(height: 56),
|
||||||
dashboardViewModel.balanceViewModel.asset,
|
Container(
|
||||||
style: TextStyle(
|
margin: const EdgeInsets.only(left: 24, bottom: 16),
|
||||||
fontSize: 24,
|
child: Observer(
|
||||||
fontFamily: 'Lato',
|
builder: (_) {
|
||||||
fontWeight: FontWeight.w600,
|
return Row(
|
||||||
color:
|
children: [
|
||||||
Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
Text(
|
||||||
height: 1,
|
dashboardViewModel.balanceViewModel.asset,
|
||||||
),
|
style: TextStyle(
|
||||||
maxLines: 1,
|
fontSize: 24,
|
||||||
textAlign: TextAlign.center,
|
fontFamily: 'Lato',
|
||||||
),
|
fontWeight: FontWeight.w600,
|
||||||
if (dashboardViewModel.balanceViewModel.isHomeScreenSettingsEnabled)
|
color: Theme.of(context)
|
||||||
InkWell(
|
.extension<DashboardPageTheme>()!
|
||||||
onTap: () => Navigator.pushNamed(context, Routes.homeSettings,
|
.pageTitleTextColor,
|
||||||
arguments: dashboardViewModel.balanceViewModel),
|
height: 1,
|
||||||
child: Padding(
|
),
|
||||||
padding: const EdgeInsets.all(8.0),
|
maxLines: 1,
|
||||||
child: Image.asset(
|
textAlign: TextAlign.center,
|
||||||
'assets/images/home_screen_settings_icon.png',
|
),
|
||||||
color: Theme.of(context)
|
if (dashboardViewModel
|
||||||
.extension<DashboardPageTheme>()!
|
.balanceViewModel.isHomeScreenSettingsEnabled)
|
||||||
.pageTitleTextColor,
|
InkWell(
|
||||||
|
onTap: () => Navigator.pushNamed(
|
||||||
|
context, Routes.homeSettings,
|
||||||
|
arguments: dashboardViewModel.balanceViewModel),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/home_screen_settings_icon.png',
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<DashboardPageTheme>()!
|
||||||
|
.pageTitleTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
)),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
if (dashboardViewModel.balanceViewModel.isShowCard &&
|
if (dashboardViewModel.balanceViewModel.isShowCard &&
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
import 'package:cake_wallet/di.dart';
|
||||||
|
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_list_page.dart';
|
||||||
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class HomeScreenAccountWidget extends StatelessWidget {
|
||||||
|
HomeScreenAccountWidget({this.walletName, this.accountName});
|
||||||
|
|
||||||
|
final String? walletName;
|
||||||
|
final String? accountName;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
await showPopUp<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => getIt.get<MoneroAccountListPage>());
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 100.0,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
walletName ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Text(
|
||||||
|
accountName ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Icon(
|
||||||
|
Icons.keyboard_arrow_down,
|
||||||
|
color: Theme.of(context).extension<DashboardPageTheme>()!.pageTitleTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,9 @@ abstract class BalanceViewModelBase with Store {
|
||||||
@computed
|
@computed
|
||||||
bool get isHomeScreenSettingsEnabled => wallet.type == WalletType.ethereum;
|
bool get isHomeScreenSettingsEnabled => wallet.type == WalletType.ethereum;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
bool get hasAccounts => wallet.type == WalletType.monero;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
SortBalanceBy get sortBalanceBy => settingsStore.sortBalanceBy;
|
SortBalanceBy get sortBalanceBy => settingsStore.sortBalanceBy;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue