Merge pull request #49 from cake-tech/CWA-198-implement-main-screen
Cwa 198 implement main screenwownero
After Width: | Height: | Size: 971 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 226 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 582 B |
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 559 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 242 B |
After Width: | Height: | Size: 479 B |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 287 B |
After Width: | Height: | Size: 588 B |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 292 B |
@ -0,0 +1,297 @@
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/src/stores/action_list/action_list_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
||||
|
||||
class ButtonHeader extends SliverPersistentHeaderDelegate {
|
||||
final sendImage = Image.asset('assets/images/send.png');
|
||||
final exchangeImage = Image.asset('assets/images/exchange.png');
|
||||
final buyImage = Image.asset('assets/images/coins.png');
|
||||
final filterButton = Image.asset('assets/images/filter_button.png');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
final actionListStore = Provider.of<ActionListStore>(context);
|
||||
final historyPanelWidth = MediaQuery.of(context).size.width;
|
||||
|
||||
double buttonsOpacity = 1 - shrinkOffset / (maxExtent - minExtent);
|
||||
double buttonsHeight = maxExtent - minExtent - shrinkOffset;
|
||||
|
||||
buttonsOpacity = buttonsOpacity >= 0 ? buttonsOpacity : 0;
|
||||
buttonsHeight = buttonsHeight >= 0 ? buttonsHeight : 0;
|
||||
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
overflow: Overflow.visible,
|
||||
children: <Widget>[
|
||||
Opacity(
|
||||
opacity: buttonsOpacity,
|
||||
child: Container(
|
||||
height: buttonsHeight,
|
||||
padding: EdgeInsets.only(left: 44, right: 44),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: actionButton(
|
||||
context: context,
|
||||
image: sendImage,
|
||||
title: S.of(context).send,
|
||||
route: Routes.send
|
||||
)
|
||||
),
|
||||
Flexible(
|
||||
child: actionButton(
|
||||
context: context,
|
||||
image: exchangeImage,
|
||||
title: S.of(context).exchange,
|
||||
route: Routes.exchange
|
||||
)
|
||||
),
|
||||
Flexible(
|
||||
child: actionButton(
|
||||
context: context,
|
||||
image: buyImage,
|
||||
title: S.of(context).buy,
|
||||
route: ''
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: buttonsHeight,
|
||||
left: 0,
|
||||
child: Container(
|
||||
width: historyPanelWidth,
|
||||
height: 66,
|
||||
padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||
color: PaletteDark.historyPanel,
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).trade_history_title,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: PopupMenuButton<int>(
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
enabled: false,
|
||||
value: -1,
|
||||
child: Text(S.of(context).transactions,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color))),
|
||||
PopupMenuItem(
|
||||
value: 0,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(S.of(context).incoming),
|
||||
Checkbox(
|
||||
value: actionListStore
|
||||
.transactionFilterStore
|
||||
.displayIncoming,
|
||||
onChanged: (value) =>
|
||||
actionListStore
|
||||
.transactionFilterStore
|
||||
.toggleIncoming(),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 1,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(S.of(context).outgoing),
|
||||
Checkbox(
|
||||
value: actionListStore
|
||||
.transactionFilterStore
|
||||
.displayOutgoing,
|
||||
onChanged: (value) =>
|
||||
actionListStore
|
||||
.transactionFilterStore
|
||||
.toggleOutgoing(),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 2,
|
||||
child:
|
||||
Text(S.of(context).transactions_by_date)),
|
||||
PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
enabled: false,
|
||||
value: -1,
|
||||
child: Text(S.of(context).trades,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color))),
|
||||
PopupMenuItem(
|
||||
value: 3,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('XMR.TO'),
|
||||
Checkbox(
|
||||
value: actionListStore
|
||||
.tradeFilterStore
|
||||
.displayXMRTO,
|
||||
onChanged: (value) =>
|
||||
actionListStore
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.xmrto),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 4,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('Change.NOW'),
|
||||
Checkbox(
|
||||
value: actionListStore
|
||||
.tradeFilterStore
|
||||
.displayChangeNow,
|
||||
onChanged: (value) =>
|
||||
actionListStore
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.changeNow),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 5,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('MorphToken'),
|
||||
Checkbox(
|
||||
value: actionListStore
|
||||
.tradeFilterStore
|
||||
.displayMorphToken,
|
||||
onChanged: (value) =>
|
||||
actionListStore
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.morphToken),
|
||||
)
|
||||
])))
|
||||
],
|
||||
child: filterButton,
|
||||
onSelected: (item) async {
|
||||
if (item == 2) {
|
||||
final List<DateTime> picked =
|
||||
await date_rage_picker.showDatePicker(
|
||||
context: context,
|
||||
initialFirstDate: DateTime.now()
|
||||
.subtract(Duration(days: 1)),
|
||||
initialLastDate: (DateTime.now()),
|
||||
firstDate: DateTime(2015),
|
||||
lastDate: DateTime.now()
|
||||
.add(Duration(days: 1)));
|
||||
|
||||
if (picked != null && picked.length == 2) {
|
||||
actionListStore.transactionFilterStore
|
||||
.changeStartDate(picked.first);
|
||||
actionListStore.transactionFilterStore
|
||||
.changeEndDate(picked.last);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => 174;
|
||||
|
||||
@override
|
||||
double get minExtent => 66;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true;
|
||||
|
||||
Widget actionButton({
|
||||
BuildContext context,
|
||||
@required Image image,
|
||||
@required String title,
|
||||
@required String route}) {
|
||||
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (route.isNotEmpty) {
|
||||
Navigator.of(context, rootNavigator: true).pushNamed(route);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: 48,
|
||||
width: 48,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: PaletteDark.borderCardColor,
|
||||
shape: BoxShape.circle
|
||||
),
|
||||
child: image,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: PaletteDark.walletCardText
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
import 'package:cake_wallet/src/domain/common/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/src/stores/action_list/action_list_store.dart';
|
||||
import 'package:cake_wallet/src/stores/action_list/date_section_item.dart';
|
||||
import 'package:cake_wallet/src/stores/action_list/trade_list_item.dart';
|
||||
import 'package:cake_wallet/src/stores/action_list/transaction_list_item.dart';
|
||||
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'date_section_raw.dart';
|
||||
import 'trade_row.dart';
|
||||
import 'transaction_raw.dart';
|
||||
import 'button_header.dart';
|
||||
|
||||
class TradeHistoryPanel extends StatefulWidget {
|
||||
@override
|
||||
TradeHistoryPanelState createState() => TradeHistoryPanelState();
|
||||
}
|
||||
|
||||
class TradeHistoryPanelState extends State<TradeHistoryPanel> {
|
||||
final _listObserverKey = GlobalKey();
|
||||
final _listKey = GlobalKey();
|
||||
|
||||
double panelHeight;
|
||||
double screenHeight;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
panelHeight = 0;
|
||||
screenHeight = 0;
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
||||
}
|
||||
|
||||
void afterLayout(dynamic _) {
|
||||
screenHeight = MediaQuery.of(context).size.height;
|
||||
setState(() {
|
||||
panelHeight = screenHeight;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final actionListStore = Provider.of<ActionListStore>(context);
|
||||
final settingsStore = Provider.of<SettingsStore>(context);
|
||||
final transactionDateFormat = DateFormat("HH:mm");
|
||||
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: AnimatedContainer(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: panelHeight,
|
||||
duration: Duration(milliseconds: 1000),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverPersistentHeader(
|
||||
delegate: ButtonHeader(),
|
||||
pinned: true,
|
||||
floating: false,
|
||||
),
|
||||
Observer(
|
||||
key: _listObserverKey,
|
||||
builder: (_) {
|
||||
final items = actionListStore.items == null
|
||||
? <String>[]
|
||||
: actionListStore.items;
|
||||
final itemsCount = items.length + 1;
|
||||
final symbol = settingsStore.fiatCurrency.toString();
|
||||
double freeSpaceHeight = MediaQuery.of(context).size.height - 496;
|
||||
|
||||
return SliverList(
|
||||
key: _listKey,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
|
||||
if (index == itemsCount - 1) {
|
||||
freeSpaceHeight = freeSpaceHeight >= 0 ? freeSpaceHeight : 0;
|
||||
|
||||
return Container(
|
||||
height: freeSpaceHeight,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
color: PaletteDark.historyPanel,
|
||||
);
|
||||
}
|
||||
|
||||
final item = items[index];
|
||||
|
||||
if (item is DateSectionItem) {
|
||||
freeSpaceHeight -= 38;
|
||||
return DateSectionRaw(date: item.date);
|
||||
}
|
||||
|
||||
if (item is TransactionListItem) {
|
||||
freeSpaceHeight -= 58;
|
||||
final transaction = item.transaction;
|
||||
final savedDisplayMode = settingsStore.balanceDisplayMode;
|
||||
final formattedAmount =
|
||||
savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||
? '---'
|
||||
: transaction.amountFormatted();
|
||||
final formattedFiatAmount =
|
||||
savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||
? '---'
|
||||
: transaction.fiatAmount(symbol);
|
||||
|
||||
return TransactionRow(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.transactionDetails,
|
||||
arguments: transaction),
|
||||
direction: transaction.direction,
|
||||
formattedDate:
|
||||
transactionDateFormat.format(transaction.date),
|
||||
formattedAmount: formattedAmount,
|
||||
formattedFiatAmount: formattedFiatAmount,
|
||||
isPending: transaction.isPending);
|
||||
}
|
||||
|
||||
if (item is TradeListItem) {
|
||||
freeSpaceHeight -= 58;
|
||||
final trade = item.trade;
|
||||
final savedDisplayMode = settingsStore.balanceDisplayMode;
|
||||
final formattedAmount = trade.amount != null
|
||||
? savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||
? '---'
|
||||
: trade.amountFormatted()
|
||||
: trade.amount;
|
||||
|
||||
return TradeRow(
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.tradeDetails, arguments: trade),
|
||||
provider: trade.provider,
|
||||
from: trade.from,
|
||||
to: trade.to,
|
||||
createdAtFormattedDate:
|
||||
transactionDateFormat.format(trade.createdAt),
|
||||
formattedAmount: formattedAmount);
|
||||
}
|
||||
|
||||
return Container(
|
||||
color: PaletteDark.historyPanel
|
||||
);
|
||||
},
|
||||
|
||||
childCount: itemsCount
|
||||
)
|
||||
);
|
||||
})
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,471 @@
|
||||
import 'dart:async';
|
||||
import 'package:cake_wallet/src/domain/common/balance_display_mode.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/src/stores/balance/balance_store.dart';
|
||||
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
import 'package:cake_wallet/src/stores/sync/sync_store.dart';
|
||||
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/domain/common/sync_status.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/qr_image.dart';
|
||||
|
||||
class WalletCard extends StatefulWidget {
|
||||
@override
|
||||
WalletCardState createState() => WalletCardState();
|
||||
}
|
||||
|
||||
class WalletCardState extends State<WalletCard> {
|
||||
final _syncingObserverKey = GlobalKey();
|
||||
final _balanceObserverKey = GlobalKey();
|
||||
final _addressObserverKey = GlobalKey();
|
||||
|
||||
final List<Color> colorsSync = [PaletteDark.walletCardSubAddressField, PaletteDark.walletCardBottomEndSync];
|
||||
double cardWidth;
|
||||
double cardHeight;
|
||||
double screenWidth;
|
||||
double opacity;
|
||||
bool isDraw;
|
||||
bool isFrontSide;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
cardWidth = 0;
|
||||
cardHeight = 220;
|
||||
screenWidth = 0;
|
||||
opacity = 0;
|
||||
isDraw = false;
|
||||
isFrontSide = true;
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
||||
}
|
||||
|
||||
void afterLayout(dynamic _) {
|
||||
screenWidth = MediaQuery.of(context).size.width - 20;
|
||||
setState(() {
|
||||
cardWidth = screenWidth;
|
||||
opacity = 1;
|
||||
});
|
||||
Timer(Duration(milliseconds: 500), () =>
|
||||
setState(() => isDraw = true)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: cardHeight,
|
||||
alignment: Alignment.centerRight,
|
||||
child: AnimatedContainer(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
duration: Duration(milliseconds: 500),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
padding: EdgeInsets.only(
|
||||
top: 1,
|
||||
left: 1,
|
||||
bottom: 1
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
color: PaletteDark.borderCardColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: PaletteDark.historyPanel.withOpacity(0.5),
|
||||
blurRadius: 8,
|
||||
offset: Offset(5, 5))
|
||||
]
|
||||
),
|
||||
child: Container(
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
color: PaletteDark.historyPanel
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => setState(() => isFrontSide = !isFrontSide),
|
||||
child: isFrontSide
|
||||
? frontSide()
|
||||
: backSide()
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget frontSide() {
|
||||
final syncStore = Provider.of<SyncStore>(context);
|
||||
final walletStore = Provider.of<WalletStore>(context);
|
||||
final settingsStore = Provider.of<SettingsStore>(context);
|
||||
final balanceStore = Provider.of<BalanceStore>(context);
|
||||
final triangleButton = Image.asset('assets/images/triangle.png');
|
||||
|
||||
return Observer(
|
||||
key: _syncingObserverKey,
|
||||
builder: (_) {
|
||||
final status = syncStore.status;
|
||||
final statusText = status.title();
|
||||
final progress = syncStore.status.progress();
|
||||
final indicatorWidth = progress * cardWidth;
|
||||
|
||||
String shortAddress = walletStore.subaddress.address;
|
||||
shortAddress = shortAddress.replaceRange(4, shortAddress.length - 4, '...');
|
||||
|
||||
var descriptionText = '';
|
||||
|
||||
if (status is SyncingSyncStatus) {
|
||||
descriptionText = S
|
||||
.of(context)
|
||||
.Blocks_remaining(
|
||||
syncStore.status.toString());
|
||||
}
|
||||
|
||||
if (status is FailedSyncStatus) {
|
||||
descriptionText = S
|
||||
.of(context)
|
||||
.please_try_to_connect_to_another_node;
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: cardHeight,
|
||||
width: indicatorWidth,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
gradient: LinearGradient(
|
||||
colors: colorsSync,
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter
|
||||
)
|
||||
),
|
||||
),
|
||||
progress != 1
|
||||
? Positioned(
|
||||
left: indicatorWidth,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
width: 1,
|
||||
height: cardHeight,
|
||||
color: PaletteDark.borderCardColor,
|
||||
)
|
||||
)
|
||||
: Offstage(),
|
||||
isDraw ? Positioned(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {print('TAP 2');},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
walletStore.name,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
triangleButton
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
walletStore.account.label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.walletCardText
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
width: 98,
|
||||
height: 32,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: PaletteDark.walletCardAddressField,
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))
|
||||
),
|
||||
child: Text(
|
||||
shortAddress,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.walletCardAddressText
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
status is SyncedSyncStatus
|
||||
? Observer(
|
||||
key: _balanceObserverKey,
|
||||
builder: (_) {
|
||||
final balanceDisplayMode = settingsStore.balanceDisplayMode;
|
||||
final symbol = settingsStore
|
||||
.fiatCurrency
|
||||
.toString();
|
||||
var balance = '---';
|
||||
var fiatBalance = '---';
|
||||
|
||||
if (balanceDisplayMode ==
|
||||
BalanceDisplayMode.availableBalance) {
|
||||
balance =
|
||||
balanceStore.unlockedBalance ??
|
||||
'0.0';
|
||||
fiatBalance =
|
||||
'$symbol ${balanceStore.fiatUnlockedBalance}';
|
||||
}
|
||||
|
||||
if (balanceDisplayMode ==
|
||||
BalanceDisplayMode.fullBalance) {
|
||||
balance =
|
||||
balanceStore.fullBalance ?? '0.0';
|
||||
fiatBalance =
|
||||
'$symbol ${balanceStore.fiatFullBalance}';
|
||||
}
|
||||
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
balanceDisplayMode.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.walletCardText
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
balance,
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
color: Colors.white
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Text(
|
||||
fiatBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
statusText,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.walletCardText
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
descriptionText,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget backSide() {
|
||||
final walletStore = Provider.of<WalletStore>(context);
|
||||
final rightArrow = Image.asset('assets/images/right_arrow.png');
|
||||
double messageBoxHeight = 0;
|
||||
double messageBoxWidth = cardWidth - 10;
|
||||
|
||||
return Observer(
|
||||
key: _addressObserverKey,
|
||||
builder: (_) {
|
||||
return Container(
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Stack(
|
||||
alignment: Alignment.topRight,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: cardWidth,
|
||||
height: cardHeight,
|
||||
padding: EdgeInsets.only(left: 20, right: 20, top: 30, bottom: 30),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
gradient: LinearGradient(
|
||||
colors: colorsSync,
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter
|
||||
)
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 84,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.current.card_address,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.walletCardText
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: walletStore.subaddress.address));
|
||||
_addressObserverKey.currentState.setState(() {
|
||||
messageBoxHeight = 20;
|
||||
messageBoxWidth = cardWidth;
|
||||
});
|
||||
Timer(Duration(milliseconds: 1000), () {
|
||||
try {
|
||||
_addressObserverKey.currentState.setState(() {
|
||||
messageBoxHeight = 0;
|
||||
messageBoxWidth = cardWidth - 10;
|
||||
});
|
||||
} catch(e) {
|
||||
print('${e.toString()}');
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
walletStore.subaddress.address,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Container(
|
||||
width: 84,
|
||||
height: 84,
|
||||
child: QrImage(
|
||||
data: walletStore.subaddress.address,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: PaletteDark.walletCardText,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 44,
|
||||
padding: EdgeInsets.only(left: 20, right: 20),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(22)),
|
||||
color: PaletteDark.walletCardSubAddressField
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.current.subaddresses,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
rightArrow
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
AnimatedContainer(
|
||||
width: messageBoxWidth,
|
||||
height: messageBoxHeight,
|
||||
alignment: Alignment.center,
|
||||
duration: Duration(milliseconds: 500),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10)),
|
||||
color: Colors.green
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|