Merge pull request #67 from cake-tech/CWA-220-bug-fix-3

Cwa 220 bug fix 3
wownero
Oleksandr Sobol 4 years ago committed by GitHub
commit 5752b98c62

@ -8,6 +8,8 @@ import 'package:cake_wallet/src/stores/auth/auth_store.dart';
import 'package:cake_wallet/src/screens/pin_code/pin_code.dart'; import 'package:cake_wallet/src/screens/pin_code/pin_code.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart'; import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/domain/common/biometric_auth.dart'; import 'package:cake_wallet/src/domain/common/biometric_auth.dart';
import 'package:cake_wallet/themes.dart';
import 'package:cake_wallet/theme_changer.dart';
typedef OnAuthenticationFinished = void Function(bool, AuthPageState); typedef OnAuthenticationFinished = void Function(bool, AuthPageState);
@ -26,6 +28,7 @@ class AuthPageState extends State<AuthPage> {
final _pinCodeKey = GlobalKey<PinCodeState>(); final _pinCodeKey = GlobalKey<PinCodeState>();
final _backArrowImageDarkTheme = final _backArrowImageDarkTheme =
Image.asset('assets/images/back_arrow_dark_theme.png'); Image.asset('assets/images/back_arrow_dark_theme.png');
final _backArrowImage = Image.asset('assets/images/back_arrow.png');
void changeProcessText(String text) { void changeProcessText(String text) {
_key.currentState.showSnackBar( _key.currentState.showSnackBar(
@ -39,6 +42,10 @@ class AuthPageState extends State<AuthPage> {
final authStore = Provider.of<AuthStore>(context); final authStore = Provider.of<AuthStore>(context);
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
final _themeChanger = Provider.of<ThemeChanger>(context);
final _backButton = _themeChanger.getTheme() == Themes.darkTheme
? _backArrowImageDarkTheme : _backArrowImage;
if (settingsStore.allowBiometricalAuthentication) { if (settingsStore.allowBiometricalAuthentication) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
final biometricAuth = BiometricAuth(); final biometricAuth = BiometricAuth();
@ -134,7 +141,7 @@ class AuthPageState extends State<AuthPage> {
splashColor: Colors.transparent, splashColor: Colors.transparent,
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
child: _backArrowImageDarkTheme), child: _backButton),
), ),
) )
: Container(), : Container(),
@ -146,6 +153,7 @@ class AuthPageState extends State<AuthPage> {
(pin, _) => authStore.auth( (pin, _) => authStore.auth(
password: pin.fold('', (ac, val) => ac + '$val')), password: pin.fold('', (ac, val) => ac + '$val')),
false, false,
_pinCodeKey)); _pinCodeKey,
authStore: authStore,));
} }
} }

@ -28,6 +28,7 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
endDrawer: MenuWidget(),
body: Container( body: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
@ -49,17 +50,16 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
width: 44, width: 44,
child: ButtonTheme( child: ButtonTheme(
minWidth: double.minPositive, minWidth: double.minPositive,
child: FlatButton( child: Builder(
highlightColor: Colors.transparent, builder: (context) {
splashColor: Colors.transparent, return FlatButton(
padding: EdgeInsets.all(0), highlightColor: Colors.transparent,
onPressed: () async { splashColor: Colors.transparent,
await showDialog<void>( padding: EdgeInsets.all(0),
builder: (_) => MenuWidget(), onPressed: () => Scaffold.of(context).openEndDrawer(),
context: context child: menuButton);
); }
}, ),
child: menuButton),
), ),
), ),
), ),

@ -1,7 +1,5 @@
import 'dart:async';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/dashboard/wallet_menu.dart'; import 'package:cake_wallet/src/screens/dashboard/wallet_menu.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart'; import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -19,7 +17,6 @@ class MenuWidgetState extends State<MenuWidget> {
double screenWidth; double screenWidth;
double screenHeight; double screenHeight;
double opacity; double opacity;
bool isDraw;
double headerHeight; double headerHeight;
double tileHeight; double tileHeight;
@ -32,7 +29,6 @@ class MenuWidgetState extends State<MenuWidget> {
screenWidth = 0; screenWidth = 0;
screenHeight = 0; screenHeight = 0;
opacity = 0; opacity = 0;
isDraw = false;
headerHeight = 120; headerHeight = 120;
tileHeight = 75; tileHeight = 75;
@ -59,10 +55,6 @@ class MenuWidgetState extends State<MenuWidget> {
fromBottomEdge *= scale; fromBottomEdge *= scale;
} }
}); });
Timer(Duration(milliseconds: 350), () =>
setState(() => isDraw = true)
);
} }
@override @override
@ -71,194 +63,174 @@ class MenuWidgetState extends State<MenuWidget> {
final walletStore = Provider.of<WalletStore>(context); final walletStore = Provider.of<WalletStore>(context);
final itemCount = walletMenu.items.length; final itemCount = walletMenu.items.length;
return GestureDetector( return Row(
onTap: () => Navigator.of(context).pop(), mainAxisSize: MainAxisSize.max,
child: Container( crossAxisAlignment: CrossAxisAlignment.center,
color: Colors.transparent, children: <Widget>[
child: BackdropFilter( Padding(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), padding: EdgeInsets.only(left: 24),
child: Container( child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)), height: 60,
child: Row( width: 4,
mainAxisSize: MainAxisSize.max, decoration: BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.center, borderRadius: BorderRadius.all(Radius.circular(2)),
children: <Widget>[ color: Theme.of(context).hintColor
Padding( ),
padding: EdgeInsets.only(left: 24), )
child: isDraw ),
? Container( SizedBox(width: 12),
height: 60, Expanded(
width: 4, child: GestureDetector(
decoration: BoxDecoration( onTap: () => null,
borderRadius: BorderRadius.all(Radius.circular(2)), child: Container(
color: Theme.of(context).hintColor // width: menuWidth,
), height: double.infinity,
) decoration: BoxDecoration(
: Container( borderRadius: BorderRadius.only(
height: 60, topLeft: Radius.circular(24),
width: 4, bottomLeft: Radius.circular(24)),
) color: Theme.of(context).primaryTextTheme.display1.color
), ),
SizedBox(width: 12), child: ClipRRect(
Expanded( borderRadius: BorderRadius.only(
child: GestureDetector( topLeft: Radius.circular(24),
onTap: () => null, bottomLeft: Radius.circular(24)),
child: Container( child: ListView.separated(
width: double.infinity, itemBuilder: (_, index) {
height: double.infinity,
alignment: Alignment.centerRight, if (index == 0) {
child: AnimatedContainer( return Container(
alignment: Alignment.centerLeft, height: headerHeight,
width: menuWidth, padding: EdgeInsets.only(
height: double.infinity, left: 24,
duration: Duration(milliseconds: 500), top: fromTopEdge,
curve: Curves.fastOutSlowIn, right: 24,
decoration: BoxDecoration( bottom: fromBottomEdge),
borderRadius: BorderRadius.only(topLeft: Radius.circular(24), bottomLeft: Radius.circular(24)), decoration: BoxDecoration(
color: Theme.of(context).primaryTextTheme.display1.color.withOpacity(opacity) borderRadius: BorderRadius.only(topLeft: Radius.circular(24)),
color: Theme.of(context).primaryTextTheme.display2.color
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
moneroIcon,
SizedBox(width: 16),
Expanded(
child: Container(
height: 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
walletStore.name,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color,
decoration: TextDecoration.none,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
),
Text(
walletStore.account.label,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.caption.color,
decoration: TextDecoration.none,
fontFamily: 'Lato',
fontSize: 12
),
)
],
),
)
)
],
),
);
}
index -= 1;
final item = walletMenu.items[index];
final image = walletMenu.images[index] ?? Offstage();
return GestureDetector(
onTap: () {
Navigator.of(context).pop();
walletMenu.action(index);
},
child: index == itemCount - 1
? Container(
height: headerHeight,
padding: EdgeInsets.only(
left: 24,
right: 24,
top: fromBottomEdge,
bottom: fromTopEdge),
alignment: Alignment.topLeft,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24)),
color: Theme.of(context).primaryTextTheme.display1.color,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context).primaryTextTheme.title.color,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
)
)
],
),
)
: Container(
height: tileHeight,
padding: EdgeInsets.only(left: 24, right: 24),
color: Theme.of(context).primaryTextTheme.display1.color,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context).primaryTextTheme.title.color,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
)
)
],
),
), ),
child: isDraw );
? ListView.separated( },
itemBuilder: (_, index) { separatorBuilder: (_, index) =>
Container(
if (index == 0) { height: 1,
return Container( color: Theme.of(context).dividerColor,
height: headerHeight, ),
padding: EdgeInsets.only( itemCount: itemCount + 1),
left: 24, ),
top: fromTopEdge, ),
right: 24,
bottom: fromBottomEdge),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(24)),
color: Theme.of(context).primaryTextTheme.display2.color
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
moneroIcon,
SizedBox(width: 16),
Expanded(
child: Container(
height: 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
walletStore.name,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color,
decoration: TextDecoration.none,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
),
Text(
walletStore.account.label,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.caption.color,
decoration: TextDecoration.none,
fontFamily: 'Lato',
fontSize: 12
),
)
],
),
)
)
],
),
);
}
index -= 1;
final item = walletMenu.items[index];
final image = walletMenu.images[index] ?? Offstage();
return GestureDetector(
onTap: () {
Navigator.of(context).pop();
walletMenu.action(index);
},
child: index == itemCount - 1
? Container(
height: headerHeight,
padding: EdgeInsets.only(
left: 24,
right: 24,
top: fromBottomEdge,
bottom: fromTopEdge),
alignment: Alignment.topLeft,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24)),
color: Theme.of(context).primaryTextTheme.display1.color,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context).primaryTextTheme.title.color,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
)
)
],
),
)
: Container(
height: tileHeight,
padding: EdgeInsets.only(left: 24, right: 24),
color: Theme.of(context).primaryTextTheme.display1.color,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context).primaryTextTheme.title.color,
fontFamily: 'Lato',
fontSize: 20,
fontWeight: FontWeight.bold
),
)
)
],
),
),
);
},
separatorBuilder: (_, index) =>
Container(
height: 1,
color: Theme.of(context).dividerColor,
),
itemCount: itemCount + 1)
: Offstage()
),
),
)
)
],
) )
), )
), ],
),
); );
} }
} }

@ -77,8 +77,6 @@ class NodeListPageBodyState extends State<NodeListPageBody> {
final nodeList = Provider.of<NodeListStore>(context); final nodeList = Provider.of<NodeListStore>(context);
final settings = Provider.of<SettingsStore>(context); final settings = Provider.of<SettingsStore>(context);
final trashImage = Image.asset('assets/images/trash.png', height: 32, width: 32, color: Colors.white);
final currentColor = Theme.of(context).accentTextTheme.subtitle.decorationColor; final currentColor = Theme.of(context).accentTextTheme.subtitle.decorationColor;
final notCurrentColor = Theme.of(context).accentTextTheme.title.backgroundColor; final notCurrentColor = Theme.of(context).accentTextTheme.title.backgroundColor;
@ -194,12 +192,16 @@ class NodeListPageBodyState extends State<NodeListPageBody> {
await nodeList.remove(node: node), await nodeList.remove(node: node),
direction: DismissDirection.endToStart, direction: DismissDirection.endToStart,
background: Container( background: Container(
padding: EdgeInsets.only(right: 10.0, top: 2), padding: EdgeInsets.only(right: 10.0),
alignment: AlignmentDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
color: Palette.red, color: Palette.red,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
trashImage, const Icon(
CupertinoIcons.delete,
color: Colors.white,
),
Text( Text(
S.of(context).delete, S.of(context).delete,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),

@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart'; import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/stores/auth/auth_store.dart';
import 'package:cake_wallet/src/domain/common/biometric_auth.dart';
abstract class PinCodeWidget extends StatefulWidget { abstract class PinCodeWidget extends StatefulWidget {
PinCodeWidget({Key key, this.onPinCodeEntered, this.hasLengthSwitcher}) PinCodeWidget({Key key, this.onPinCodeEntered, this.hasLengthSwitcher})
@ -14,21 +16,26 @@ abstract class PinCodeWidget extends StatefulWidget {
class PinCode extends PinCodeWidget { class PinCode extends PinCodeWidget {
PinCode(Function(List<int> pin, PinCodeState state) onPinCodeEntered, PinCode(Function(List<int> pin, PinCodeState state) onPinCodeEntered,
bool hasLengthSwitcher, Key key) bool hasLengthSwitcher, Key key, {this.authStore})
: super( : super(
key: key, key: key,
onPinCodeEntered: onPinCodeEntered, onPinCodeEntered: onPinCodeEntered,
hasLengthSwitcher: hasLengthSwitcher); hasLengthSwitcher: hasLengthSwitcher);
final AuthStore authStore;
@override @override
PinCodeState createState() => PinCodeState(); PinCodeState createState() => PinCodeState(authStore: authStore);
} }
class PinCodeState<T extends PinCodeWidget> extends State<T> { class PinCodeState<T extends PinCodeWidget> extends State<T> {
PinCodeState({this.authStore});
static const defaultPinLength = 4; static const defaultPinLength = 4;
static const sixPinLength = 6; static const sixPinLength = 6;
static const fourPinLength = 4; static const fourPinLength = 4;
final _gridViewKey = GlobalKey(); final _gridViewKey = GlobalKey();
final AuthStore authStore;
final _key = GlobalKey<ScaffoldState>();
int pinLength = defaultPinLength; int pinLength = defaultPinLength;
List<int> pin = List<int>.filled(defaultPinLength, null); List<int> pin = List<int>.filled(defaultPinLength, null);
@ -83,9 +90,11 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
} }
@override @override
Widget build(BuildContext context) => Scaffold(body: body(context)); Widget build(BuildContext context) => Scaffold(key: _key, body: body(context));
Widget body(BuildContext context) { Widget body(BuildContext context) {
final settingsStore = Provider.of<SettingsStore>(context);
final deleteIconImage = Image.asset( final deleteIconImage = Image.asset(
'assets/images/delete_icon.png', 'assets/images/delete_icon.png',
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.title.color,
@ -161,10 +170,35 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: marginLeft, right: marginRight), left: marginLeft, right: marginRight),
child: FlatButton( child: FlatButton(
onPressed: () {}, onPressed: (widget.hasLengthSwitcher ||
!settingsStore.allowBiometricalAuthentication)
? null
: () {
if (authStore != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
final biometricAuth = BiometricAuth();
biometricAuth.isAuthenticated().then(
(isAuth) {
if (isAuth) {
authStore.biometricAuth();
_key.currentState.showSnackBar(
SnackBar(
content: Text(S.of(context).authenticated),
backgroundColor: Colors.green,
),
);
}
}
);
});
}
},
color: Theme.of(context).backgroundColor, color: Theme.of(context).backgroundColor,
shape: CircleBorder(), shape: CircleBorder(),
child: faceImage, child: (widget.hasLengthSwitcher ||
!settingsStore.allowBiometricalAuthentication)
? Offstage()
: faceImage,
), ),
); );
} else if (index == 10) { } else if (index == 10) {

@ -245,110 +245,129 @@ class ReceivePageState extends State<ReceivePage> {
), ),
), ),
Observer( Observer(
builder: (_) => ListView.separated( builder: (_) {
separatorBuilder: (context, index) => Divider( subaddressListStore.updateShortAddressShow();
height: 1,
color: Theme.of(context).dividerColor,
),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: subaddressListStore.subaddresses.length + 2,
itemBuilder: (context, index) {
if (index == 0) { return ListView.separated(
return ClipRRect( separatorBuilder: (context, index) => Divider(
borderRadius: BorderRadius.only( height: 1,
topLeft: Radius.circular(24), color: Theme.of(context).dividerColor,
topRight: Radius.circular(24) ),
), shrinkWrap: true,
child: HeaderTile( physics: NeverScrollableScrollPhysics(),
onTap: () async { itemCount: subaddressListStore.subaddresses.length + 2,
await showDialog<void>( itemBuilder: (context, index) {
context: context,
builder: (BuildContext context) { if (index == 0) {
return AccountListPage(accountListStore: accountListStore); return ClipRRect(
} borderRadius: BorderRadius.only(
); topLeft: Radius.circular(24),
}, topRight: Radius.circular(24)
title: walletStore.account.label, ),
child: HeaderTile(
onTap: () async {
await showDialog<void>(
context: context,
builder: (BuildContext context) {
return AccountListPage(accountListStore: accountListStore);
}
);
},
title: walletStore.account.label,
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Theme.of(context).primaryTextTheme.title.color,
)
),
);
}
if (index == 1) {
return HeaderTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).subaddresses,
icon: Icon( icon: Icon(
Icons.arrow_forward_ios, Icons.add,
size: 14, size: 20,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.title.color,
) )
), );
); }
}
if (index == 1) { index -= 2;
return HeaderTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).subaddresses,
icon: Icon(
Icons.add,
size: 20,
color: Theme.of(context).primaryTextTheme.title.color,
)
);
}
index -= 2; return Observer(
builder: (_) {
final subaddress = subaddressListStore.subaddresses[index];
final isCurrent =
walletStore.subaddress.address == subaddress.address;
return Observer( final content = Observer(
builder: (_) { builder: (_) {
final subaddress = subaddressListStore.subaddresses[index]; final isShortAddressShow = subaddressListStore.isShortAddressShow[index];
final isCurrent =
walletStore.subaddress.address == subaddress.address;
final label = subaddress.label.isNotEmpty final label = index == 0
? subaddress.label ? 'Primary subaddress'
: subaddress.address; : subaddress.label.isNotEmpty
? subaddress.label
: subaddress.address;
final content = InkWell( return InkWell(
onTap: () => walletStore.setSubaddress(subaddress), onTap: () => walletStore.setSubaddress(subaddress),
child: Container( onLongPress: () {
color: isCurrent ? currentColor : notCurrentColor, if (subaddress.label.isNotEmpty) {
padding: EdgeInsets.only( return;
left: 24, }
right: 24, subaddressListStore.setShortAddressShow(index, !isShortAddressShow);
top: 28, },
bottom: 28 child: Container(
), color: isCurrent ? currentColor : notCurrentColor,
child: Text( padding: EdgeInsets.only(
label, left: 24,
style: TextStyle( right: 24,
fontSize: subaddress.label.isNotEmpty top: 28,
? 18 : 10, bottom: 28
fontWeight: FontWeight.bold, ),
color: isCurrent child: Text(
? currentTextColor label,
: notCurrentTextColor, maxLines: isShortAddressShow ? 1 : 10,
), overflow: TextOverflow.ellipsis,
), style: TextStyle(
), fontSize: 18,
); fontWeight: FontWeight.bold,
color: isCurrent
? currentTextColor
: notCurrentTextColor,
),
),
),
);
}
);
return isCurrent return isCurrent || index == 0
? content ? content
: Slidable( : Slidable(
key: Key(subaddress.address), key: Key(subaddress.address),
actionPane: SlidableDrawerActionPane(), actionPane: SlidableDrawerActionPane(),
child: content, child: content,
secondaryActions: <Widget>[ secondaryActions: <Widget>[
IconSlideAction( IconSlideAction(
caption: S.of(context).edit, caption: S.of(context).edit,
color: Theme.of(context).primaryTextTheme.overline.color, color: Theme.of(context).primaryTextTheme.overline.color,
icon: Icons.edit, icon: Icons.edit,
onTap: () => Navigator.of(context) onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress, arguments: subaddress), .pushNamed(Routes.newSubaddress, arguments: subaddress),
) )
] ]
); );
} }
); );
} }
) );
}
), ),
], ],
), ),

@ -33,10 +33,8 @@ abstract class ExchangeStoreBase with Store {
provider = initialProvider; provider = initialProvider;
depositCurrency = initialDepositCurrency; depositCurrency = initialDepositCurrency;
receiveCurrency = initialReceiveCurrency; receiveCurrency = initialReceiveCurrency;
/*isDepositAddressEnabled = !(depositCurrency == walletStore.type); isDepositAddressEnabled = !(depositCurrency == walletStore.type);
isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);*/ isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);
isDepositAddressEnabled = true;
isReceiveAddressEnabled = true;
depositAmount = ''; depositAmount = '';
receiveAmount = ''; receiveAmount = '';
depositAddress = ''; depositAddress = '';
@ -109,16 +107,16 @@ abstract class ExchangeStoreBase with Store {
void changeDepositCurrency({CryptoCurrency currency}) { void changeDepositCurrency({CryptoCurrency currency}) {
depositCurrency = currency; depositCurrency = currency;
_onPairChange(); _onPairChange();
/*isDepositAddressEnabled = !(depositCurrency == walletStore.type); isDepositAddressEnabled = !(depositCurrency == walletStore.type);
isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);*/ isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);
} }
@action @action
void changeReceiveCurrency({CryptoCurrency currency}) { void changeReceiveCurrency({CryptoCurrency currency}) {
receiveCurrency = currency; receiveCurrency = currency;
_onPairChange(); _onPairChange();
/*isDepositAddressEnabled = !(depositCurrency == walletStore.type); isDepositAddressEnabled = !(depositCurrency == walletStore.type);
isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);*/ isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);
} }
@action @action
@ -242,8 +240,8 @@ abstract class ExchangeStoreBase with Store {
receiveCurrency = CryptoCurrency.btc; receiveCurrency = CryptoCurrency.btc;
depositAddress = depositCurrency == walletStore.type ? walletStore.address : ''; depositAddress = depositCurrency == walletStore.type ? walletStore.address : '';
receiveAddress = receiveCurrency == walletStore.type ? walletStore.address : ''; receiveAddress = receiveCurrency == walletStore.type ? walletStore.address : '';
/*isDepositAddressEnabled = !(depositCurrency == walletStore.type); isDepositAddressEnabled = !(depositCurrency == walletStore.type);
isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);*/ isReceiveAddressEnabled = !(receiveCurrency == walletStore.type);
_onPairChange(); _onPairChange();
} }

@ -15,6 +15,7 @@ class SubaddressListStore = SubaddressListStoreBase with _$SubaddressListStore;
abstract class SubaddressListStoreBase with Store { abstract class SubaddressListStoreBase with Store {
SubaddressListStoreBase({@required WalletService walletService}) { SubaddressListStoreBase({@required WalletService walletService}) {
subaddresses = ObservableList<Subaddress>(); subaddresses = ObservableList<Subaddress>();
isShortAddressShow = ObservableList<bool>();
if (walletService.currentWallet != null) { if (walletService.currentWallet != null) {
_onWalletChanged(walletService.currentWallet); _onWalletChanged(walletService.currentWallet);
@ -27,12 +28,20 @@ abstract class SubaddressListStoreBase with Store {
@observable @observable
ObservableList<Subaddress> subaddresses; ObservableList<Subaddress> subaddresses;
@observable
ObservableList<bool> isShortAddressShow;
SubaddressList _subaddressList; SubaddressList _subaddressList;
StreamSubscription<Wallet> _onWalletChangeSubscription; StreamSubscription<Wallet> _onWalletChangeSubscription;
StreamSubscription<List<Subaddress>> _onSubaddressesChangeSubscription; StreamSubscription<List<Subaddress>> _onSubaddressesChangeSubscription;
StreamSubscription<Account> _onAccountChangeSubscription; StreamSubscription<Account> _onAccountChangeSubscription;
Account _account; Account _account;
@action
void setShortAddressShow(int index, bool isShow) {
isShortAddressShow[index] = isShow;
}
@override @override
void dispose() { void dispose() {
if (_onSubaddressesChangeSubscription != null) { if (_onSubaddressesChangeSubscription != null) {
@ -47,6 +56,10 @@ abstract class SubaddressListStoreBase with Store {
super.dispose(); super.dispose();
} }
void updateShortAddressShow() {
isShortAddressShow = ObservableList.of(List.generate(subaddresses.length, (i) => true));
}
Future<void> _updateSubaddressList({int accountIndex}) async { Future<void> _updateSubaddressList({int accountIndex}) async {
await _subaddressList.refresh(accountIndex: accountIndex); await _subaddressList.refresh(accountIndex: accountIndex);
subaddresses = ObservableList.of(_subaddressList.getAll()); subaddresses = ObservableList.of(_subaddressList.getAll());

Loading…
Cancel
Save