mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
* feat: Integration tests setup and tests for Disclaimer, Welcome and Setup Pin Code pages * feat: Integration test flow from start to restoring a wallet successfully done * test: Dashboard view test and linking to flow * feat: Testing the Exchange flow section, selecting sending and receiving currencies * test: Successfully create an exchange section * feat: Implement flow up to sending section * test: Complete Exchange flow * fix dependency issue * test: Final cleanups * feat: Add CI to run automated integration tests withan android emulator * feat: Adjust Automated integration test CI to run on ubuntu 20.04-a * fix: Move integration test CI into PR test build CI * ci: Add automated test ci which is a streamlined replica of pr test build ci * ci: Re-add step to access branch name * ci: Add KVM * ci: Add filepath to trigger the test run from * ci: Add required key * ci: Add required key * ci: Add missing secret key * ci: Add missing secret key * ci: Add nano secrets to workflow * ci: Switch step to free space on runner * ci: Remove timeout from workflow * ci: Confirm impact that removing copy_monero_deps would have on entire workflow time * ci: Update CI and temporarily remove cache related to emulator * ci: Remove dynamic java version * ci: Temporarily switch CI * ci: Switch to 11.x jdk * ci: Temporarily switch CI * ci: Revert ubuntu version * ci: Add more api levels * ci: Add more target options * ci: Settled on stable emulator matrix options * ci: Add more target options * ci: Modify flow * ci: Streamline api levels to 28 and 29 * ci: One more trial * ci: Switch to flutter drive * ci: Reduce options * ci: Remove haven from test * ci: Check for solana in list * ci: Adjust amounts and currencies for exchange flow * ci: Set write response on failure to true * ci: Split ci to funds and non funds related tests * test: Test for Send flow scenario and minor restructuring for test folders and files * chore: cleanup * ci: Pause CI for now * ci: Pause CI for now * ci: Pause CI for now * test: Restore wallets integration automated tests * Fix: Add keys back to currency amount textfield widget * fix: Switch variable name * fix: remove automation for now * tests: Automated tests for Create wallets flow * tests: Further optimize common flows * tests: Add missing await for call * tests: Confirm Seeds Display Properly WIP * tests: Confirm Seeds Display Correctly Automated Tests * fix: Add missing pubspec params for bitcoin and bitcoin_cash * feat: Automated Tests for Transaction History Flow * fix: Add missing pubspec parameter * feat: Automated Integration Tests for Transaction History flow * test: Updating send page robot and also syncing branch with main * test: Modifying tests to flow with wallet grouping implementation * fix: Issue with transaction history test * fix: Modifications to the PR and add automated confirmation for checking that all wallet types are restored or created correctly * test: Attempting automation for testing * fix: Issue from merge conflicts * test: Remove automation of test in this PR --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
250 lines
9 KiB
Dart
250 lines
9 KiB
Dart
import 'package:cake_wallet/generated/i18n.dart';
|
|
import 'package:cake_wallet/src/widgets/setting_action_button.dart';
|
|
import 'package:cake_wallet/src/widgets/setting_actions.dart';
|
|
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:cake_wallet/palette.dart';
|
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
|
|
|
class MenuWidget extends StatefulWidget {
|
|
MenuWidget(this.dashboardViewModel, Key? key);
|
|
|
|
final DashboardViewModel dashboardViewModel;
|
|
|
|
@override
|
|
MenuWidgetState createState() => MenuWidgetState();
|
|
}
|
|
|
|
class MenuWidgetState extends State<MenuWidget> {
|
|
MenuWidgetState()
|
|
: this.menuWidth = 0,
|
|
this.screenWidth = 0,
|
|
this.screenHeight = 0,
|
|
this.headerHeight = 120,
|
|
this.tileHeight = 60,
|
|
this.fromTopEdge = 50,
|
|
this.fromBottomEdge = 25,
|
|
this.moneroIcon = Image.asset('assets/images/monero_menu.png'),
|
|
this.bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png'),
|
|
this.litecoinIcon = Image.asset('assets/images/litecoin_menu.png'),
|
|
this.havenIcon = Image.asset('assets/images/haven_menu.png'),
|
|
this.ethereumIcon = Image.asset('assets/images/eth_icon.png'),
|
|
this.nanoIcon = Image.asset('assets/images/nano_icon.png'),
|
|
this.bananoIcon = Image.asset('assets/images/nano_icon.png'),
|
|
this.bitcoinCashIcon = Image.asset('assets/images/bch_icon.png'),
|
|
this.polygonIcon = Image.asset('assets/images/matic_icon.png'),
|
|
this.solanaIcon = Image.asset('assets/images/sol_icon.png'),
|
|
this.tronIcon = Image.asset('assets/images/trx_icon.png'),
|
|
this.wowneroIcon = Image.asset('assets/images/wownero_icon.png');
|
|
|
|
final largeScreen = 731;
|
|
|
|
double menuWidth;
|
|
double screenWidth;
|
|
double screenHeight;
|
|
|
|
double headerHeight;
|
|
double tileHeight;
|
|
double fromTopEdge;
|
|
double fromBottomEdge;
|
|
|
|
Image moneroIcon;
|
|
Image bitcoinIcon;
|
|
Image litecoinIcon;
|
|
Image havenIcon;
|
|
Image ethereumIcon;
|
|
Image bitcoinCashIcon;
|
|
Image nanoIcon;
|
|
Image bananoIcon;
|
|
Image polygonIcon;
|
|
Image solanaIcon;
|
|
Image tronIcon;
|
|
Image wowneroIcon;
|
|
|
|
@override
|
|
void initState() {
|
|
menuWidth = 0;
|
|
screenWidth = 0;
|
|
screenHeight = 0;
|
|
|
|
headerHeight = 120;
|
|
tileHeight = 60;
|
|
fromTopEdge = 50;
|
|
fromBottomEdge = 25;
|
|
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
|
}
|
|
|
|
void afterLayout(dynamic _) {
|
|
screenWidth = MediaQuery.of(context).size.width;
|
|
screenHeight = MediaQuery.of(context).size.height;
|
|
|
|
setState(() {
|
|
menuWidth = screenWidth;
|
|
|
|
if (screenHeight > largeScreen) {
|
|
final scale = screenHeight / largeScreen;
|
|
tileHeight *= scale;
|
|
headerHeight *= scale;
|
|
fromTopEdge *= scale;
|
|
fromBottomEdge *= scale;
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
List<SettingActions> items = List.of(SettingActions.all);
|
|
if (!widget.dashboardViewModel.hasSilentPayments) {
|
|
items.removeWhere((element) => element.name(context) == S.of(context).silent_payments_settings);
|
|
}
|
|
if (!widget.dashboardViewModel.hasMweb) {
|
|
items.removeWhere((element) => element.name(context) == S.of(context).litecoin_mweb_settings);
|
|
}
|
|
int itemCount = items.length;
|
|
|
|
moneroIcon = Image.asset('assets/images/monero_menu.png',
|
|
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
|
|
bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png',
|
|
color: Theme.of(context).extension<CakeMenuTheme>()!.iconColor);
|
|
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: EdgeInsets.only(left: 24),
|
|
child: Container(
|
|
height: 60,
|
|
width: 4,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(2)), color: PaletteDark.gray),
|
|
),
|
|
),
|
|
SizedBox(width: 12),
|
|
Expanded(
|
|
child: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.only(topLeft: Radius.circular(24), bottomLeft: Radius.circular(24)),
|
|
child: Container(
|
|
color: Theme.of(context).extension<CakeMenuTheme>()!.backgroundColor,
|
|
child: ListView.separated(
|
|
padding: EdgeInsets.only(top: 0),
|
|
itemBuilder: (_, index) {
|
|
if (index == 0) {
|
|
return Container(
|
|
height: headerHeight,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(colors: [
|
|
Theme.of(context).extension<CakeMenuTheme>()!.headerFirstGradientColor,
|
|
Theme.of(context).extension<CakeMenuTheme>()!.headerSecondGradientColor,
|
|
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
|
),
|
|
padding: EdgeInsets.only(
|
|
left: 24, top: fromTopEdge, right: 24, bottom: fromBottomEdge),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
_iconFor(type: widget.dashboardViewModel.type),
|
|
SizedBox(width: 12),
|
|
SingleChildScrollView(
|
|
child: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: widget.dashboardViewModel.subname.isNotEmpty
|
|
? MainAxisAlignment.spaceBetween
|
|
: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(
|
|
widget.dashboardViewModel.name,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold),
|
|
),
|
|
if (widget.dashboardViewModel.subname.isNotEmpty)
|
|
Observer(
|
|
builder: (_) => Text(
|
|
widget.dashboardViewModel.subname,
|
|
style: TextStyle(
|
|
color: Theme.of(context)
|
|
.extension<CakeMenuTheme>()!
|
|
.subnameTextColor,
|
|
fontWeight: FontWeight.w500,
|
|
fontSize: 12),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
index--;
|
|
|
|
final item = items[index];
|
|
|
|
final isLastTile = index == itemCount - 1;
|
|
|
|
return SettingActionButton(
|
|
key: item.key,
|
|
isLastTile: isLastTile,
|
|
tileHeight: tileHeight,
|
|
selectionActive: false,
|
|
fromBottomEdge: fromBottomEdge,
|
|
fromTopEdge: fromTopEdge,
|
|
onTap: () => item.onTap.call(context),
|
|
image: item.image,
|
|
title: item.name.call(context),
|
|
);
|
|
},
|
|
separatorBuilder: (_, index) => Container(
|
|
height: 1,
|
|
color: Theme.of(context).extension<CakeMenuTheme>()!.dividerColor,
|
|
),
|
|
itemCount: itemCount + 1,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Image _iconFor({required WalletType type}) {
|
|
switch (type) {
|
|
case WalletType.monero:
|
|
return moneroIcon;
|
|
case WalletType.bitcoin:
|
|
return bitcoinIcon;
|
|
case WalletType.litecoin:
|
|
return litecoinIcon;
|
|
case WalletType.haven:
|
|
return havenIcon;
|
|
case WalletType.ethereum:
|
|
return ethereumIcon;
|
|
case WalletType.bitcoinCash:
|
|
return bitcoinCashIcon;
|
|
case WalletType.nano:
|
|
return nanoIcon;
|
|
case WalletType.banano:
|
|
return bananoIcon;
|
|
case WalletType.polygon:
|
|
return polygonIcon;
|
|
case WalletType.solana:
|
|
return solanaIcon;
|
|
case WalletType.tron:
|
|
return tronIcon;
|
|
case WalletType.wownero:
|
|
return wowneroIcon;
|
|
default:
|
|
throw Exception('No icon for ${type.toString()}');
|
|
}
|
|
}
|
|
}
|