mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
Merge redesign part 1.
This commit is contained in:
@@ -15,21 +15,26 @@ abstract class BasePage extends StatelessWidget {
|
||||
|
||||
Color get backgroundLightColor => Colors.white;
|
||||
|
||||
Color get backgroundDarkColor => PaletteDark.darkNightBlue;
|
||||
Color get backgroundDarkColor => PaletteDark.backgroundColor;
|
||||
|
||||
Color get titleColor => null;
|
||||
|
||||
bool get resizeToAvoidBottomPadding => true;
|
||||
|
||||
Widget get endDrawer => null;
|
||||
|
||||
AppBarStyle get appBarStyle => AppBarStyle.regular;
|
||||
|
||||
Widget Function(BuildContext, Widget) get rootWrapper => null;
|
||||
|
||||
final _backArrowImage = Image.asset('assets/images/back_arrow.png', color: Colors.white);
|
||||
final _backArrowImageDarkTheme =
|
||||
Image.asset('assets/images/back_arrow_dark_theme.png', color: Colors.white);
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
final _closeButtonImage = Image.asset('assets/images/close_button.png');
|
||||
final _closeButtonImageDarkTheme =
|
||||
Image.asset('assets/images/close_button_dark_theme.png');
|
||||
|
||||
void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer();
|
||||
|
||||
void onClose(BuildContext context) => Navigator.of(context).pop();
|
||||
|
||||
Widget leading(BuildContext context) {
|
||||
@@ -37,16 +42,13 @@ abstract class BasePage extends StatelessWidget {
|
||||
return null;
|
||||
}
|
||||
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
Image _closeButton, _backButton;
|
||||
final _backButton = Image.asset('assets/images/back_arrow.png',
|
||||
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color);
|
||||
|
||||
if (_themeChanger.getTheme() == Themes.darkTheme) {
|
||||
_backButton = _backArrowImageDarkTheme;
|
||||
_closeButton = _closeButtonImageDarkTheme;
|
||||
} else {
|
||||
_backButton = _backArrowImage;
|
||||
_closeButton = _closeButtonImage;
|
||||
}
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _closeButton = _themeChanger.getTheme() == Themes.darkTheme
|
||||
? _closeButtonImageDarkTheme
|
||||
: _closeButtonImage;
|
||||
|
||||
return SizedBox(
|
||||
height: 37,
|
||||
@@ -71,9 +73,8 @@ abstract class BasePage extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
//color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Colors.white,
|
||||
),
|
||||
color: titleColor ??
|
||||
Theme.of(context).primaryTextTheme.title.color),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,9 +124,11 @@ abstract class BasePage extends StatelessWidget {
|
||||
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
|
||||
|
||||
final root = Scaffold(
|
||||
key: _scaffoldKey,
|
||||
backgroundColor:
|
||||
_isDarkTheme ? backgroundDarkColor : backgroundLightColor,
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
endDrawer: endDrawer,
|
||||
appBar: appBar(context),
|
||||
body: body(context), //SafeArea(child: ),
|
||||
floatingActionButton: floatingActionButton(context));
|
||||
|
||||
@@ -5,16 +5,13 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:dots_indicator/dots_indicator.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/action_button.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/address_page.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
|
||||
class DashboardPage extends BasePage {
|
||||
DashboardPage({
|
||||
@@ -23,14 +20,28 @@ class DashboardPage extends BasePage {
|
||||
});
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => PaletteDark.backgroundColor;
|
||||
Color get backgroundLightColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.backgroundColor;
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||
(BuildContext context, Widget scaffold) => Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).accentColor,
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
Theme.of(context).primaryColor,
|
||||
], begin: Alignment.topRight, end: Alignment.bottomLeft)),
|
||||
child: scaffold);
|
||||
|
||||
@override
|
||||
bool get resizeToAvoidBottomPadding => false;
|
||||
|
||||
@override
|
||||
Widget get endDrawer => MenuWidget(walletViewModel);
|
||||
|
||||
@override
|
||||
Widget middle(BuildContext context) {
|
||||
return SyncIndicator(dashboardViewModel: walletViewModel);
|
||||
@@ -38,24 +49,18 @@ class DashboardPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final menuButton = Image.asset('assets/images/menu.png',
|
||||
color: Colors.white);
|
||||
final menuButton =
|
||||
Image.asset('assets/images/menu.png', color: Colors.white);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerRight,
|
||||
width: 40,
|
||||
child: FlatButton(
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
padding: EdgeInsets.all(0),
|
||||
onPressed: () async {
|
||||
await showDialog<void>(
|
||||
builder: (_) => MenuWidget(walletViewModel),
|
||||
context: context);
|
||||
},
|
||||
child: menuButton
|
||||
)
|
||||
);
|
||||
alignment: Alignment.centerRight,
|
||||
width: 40,
|
||||
child: FlatButton(
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
padding: EdgeInsets.all(0),
|
||||
onPressed: () => onOpenEndDrawer(),
|
||||
child: menuButton));
|
||||
}
|
||||
|
||||
final DashboardViewModel walletViewModel;
|
||||
@@ -73,79 +78,64 @@ class DashboardPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
|
||||
_setEffects();
|
||||
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: PageView.builder(
|
||||
controller: controller,
|
||||
itemCount: pages.length,
|
||||
itemBuilder: (context, index) {
|
||||
return pages[index];
|
||||
})),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 24),
|
||||
child: SmoothPageIndicator(
|
||||
controller: controller,
|
||||
itemCount: pages.length,
|
||||
itemBuilder: (context, index) {
|
||||
return pages[index];
|
||||
}
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 24
|
||||
),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return DotsIndicator(
|
||||
dotsCount: pages.length,
|
||||
position: walletViewModel.currentPage,
|
||||
decorator: DotsDecorator(
|
||||
color: PaletteDark.cyanBlue,
|
||||
activeColor: Colors.white,
|
||||
size: Size(6, 6),
|
||||
activeSize: Size(6, 6),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
left: 45,
|
||||
right: 45,
|
||||
bottom: 24
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: sendImage,
|
||||
title: S.of(context).send,
|
||||
route: Routes.send,
|
||||
alignment: Alignment.centerLeft,
|
||||
),
|
||||
count: pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
spacing: 6.0,
|
||||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).indicatorColor,
|
||||
activeDotColor: Colors.white),
|
||||
)),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: sendImage,
|
||||
title: S.of(context).send,
|
||||
route: Routes.send,
|
||||
alignment: Alignment.centerLeft,
|
||||
),
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
),
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: exchangeImage,
|
||||
title: S.of(context).exchange,
|
||||
route: Routes.exchange
|
||||
),
|
||||
route: Routes.exchange),
|
||||
),
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: receiveImage,
|
||||
title: S.of(context).receive,
|
||||
route: Routes.receive,
|
||||
alignment: Alignment.centerRight,
|
||||
),
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: receiveImage,
|
||||
title: S.of(context).receive,
|
||||
route: Routes.receive,
|
||||
alignment: Alignment.centerRight,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
void _setEffects() {
|
||||
@@ -157,16 +147,6 @@ class DashboardPage extends BasePage {
|
||||
pages.add(BalancePage(dashboardViewModel: walletViewModel));
|
||||
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
|
||||
|
||||
controller.addListener(() {
|
||||
walletViewModel.pageViewStore.setCurrentPage(controller.page);
|
||||
});
|
||||
|
||||
reaction((_) => walletViewModel.currentPage, (double currentPage) {
|
||||
if (controller.page != currentPage) {
|
||||
controller.jumpTo(currentPage);
|
||||
}
|
||||
});
|
||||
|
||||
_isEffectsInstalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ class WalletMenu {
|
||||
];
|
||||
|
||||
final List<Image> images = [
|
||||
Image.asset('assets/images/reconnect.png'),
|
||||
Image.asset('assets/images/wallet.png'),
|
||||
Image.asset('assets/images/nodes.png'),
|
||||
Image.asset('assets/images/eye.png'),
|
||||
Image.asset('assets/images/key.png'),
|
||||
Image.asset('assets/images/open_book.png'),
|
||||
Image.asset('assets/images/settings.png'),
|
||||
Image.asset('assets/images/reconnect_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/wallet_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/nodes_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/eye_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/open_book_menu.png', height: 16, width: 16),
|
||||
Image.asset('assets/images/settings_menu.png', height: 16, width: 16),
|
||||
];
|
||||
|
||||
final BuildContext context;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class ActionButton extends StatelessWidget{
|
||||
ActionButton({
|
||||
@@ -36,7 +35,7 @@ class ActionButton extends StatelessWidget{
|
||||
width: 60,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: PaletteDark.nightBlue,
|
||||
color: Theme.of(context).buttonColor,
|
||||
shape: BoxShape.circle),
|
||||
child: image,
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -29,7 +28,11 @@ class AddressPage extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(25)),
|
||||
color: PaletteDark.nightBlue
|
||||
border: Border.all(
|
||||
color: Theme.of(context).textTheme.subhead.color,
|
||||
width: 1
|
||||
),
|
||||
color: Theme.of(context).buttonColor
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class BalancePage extends StatelessWidget {
|
||||
@@ -26,7 +25,7 @@ class BalancePage extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: PaletteDark.cyanBlue,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1
|
||||
),
|
||||
);
|
||||
@@ -52,7 +51,7 @@ class BalancePage extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: PaletteDark.cyanBlue,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:intl/intl.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class DateSectionRaw extends StatelessWidget {
|
||||
DateSectionRaw({this.date});
|
||||
@@ -42,7 +41,7 @@ class DateSectionRaw extends StatelessWidget {
|
||||
child: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: PaletteDark.darkCyanBlue
|
||||
color: Theme.of(context).textTheme.overline.backgroundColor
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FilterTile extends StatelessWidget {
|
||||
FilterTile({@required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
top: 18,
|
||||
bottom: 18,
|
||||
left: 24,
|
||||
right: 24
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_tile.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/checkbox_widget.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
||||
|
||||
class FilterWidget extends StatelessWidget {
|
||||
FilterWidget({@required this.dashboardViewModel});
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final backVector = Image.asset('assets/images/back_vector.png',
|
||||
color: Palette.darkBlueCraiola
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).filters,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Poppins',
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24,
|
||||
top: 24
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
color: Theme.of(context).textTheme.body2.decorationColor,
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: dashboardViewModel.filterItems.length,
|
||||
separatorBuilder: (context, _) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).accentTextTheme.subhead.backgroundColor,
|
||||
),
|
||||
itemBuilder: (_, index1) {
|
||||
final title = dashboardViewModel.filterItems.keys.elementAt(index1);
|
||||
final section = dashboardViewModel.filterItems.values.elementAt(index1);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
left: 24,
|
||||
right: 24
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).accentTextTheme.subhead.color,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Poppins',
|
||||
decoration: TextDecoration.none
|
||||
),
|
||||
),
|
||||
),
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: section.length,
|
||||
separatorBuilder: (context, _) => Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).textTheme.body2.decorationColor,
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).accentTextTheme.subhead.backgroundColor,
|
||||
),
|
||||
),
|
||||
itemBuilder: (_, index2) {
|
||||
|
||||
final item = section[index2];
|
||||
final content = item.onChanged != null
|
||||
? CheckboxWidget(
|
||||
value: item.value,
|
||||
caption: item.caption,
|
||||
onChanged: item.onChanged
|
||||
)
|
||||
: GestureDetector(
|
||||
onTap: () async {
|
||||
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) {
|
||||
dashboardViewModel.transactionFilterStore
|
||||
.changeStartDate(picked.first);
|
||||
dashboardViewModel.transactionFilterStore
|
||||
.changeEndDate(picked.last);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 32),
|
||||
child: Text(
|
||||
item.caption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.none
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return FilterTile(child: content);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
AlertCloseButton(image: backVector)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,18 @@
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
|
||||
class HeaderRow extends StatelessWidget {
|
||||
HeaderRow({this.dashboardViewModel});
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
|
||||
final filterIcon = Image.asset('assets/images/filter_icon.png',
|
||||
color: PaletteDark.wildBlue);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final filterIcon = Image.asset('assets/images/filter_icon.png',
|
||||
color: Theme.of(context).textTheme.caption.decorationColor);
|
||||
|
||||
return Container(
|
||||
height: 52,
|
||||
color: Colors.transparent,
|
||||
@@ -32,154 +29,23 @@ class HeaderRow extends StatelessWidget {
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
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: dashboardViewModel
|
||||
.transactionFilterStore
|
||||
.displayIncoming,
|
||||
onChanged: (value) => dashboardViewModel
|
||||
.transactionFilterStore
|
||||
.toggleIncoming()
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 1,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(S.of(context).outgoing),
|
||||
Checkbox(
|
||||
value: dashboardViewModel
|
||||
.transactionFilterStore
|
||||
.displayOutgoing,
|
||||
onChanged: (value) => dashboardViewModel
|
||||
.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: dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.displayXMRTO,
|
||||
onChanged: (value) => dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.xmrto),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 4,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('Change.NOW'),
|
||||
Checkbox(
|
||||
value: dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.displayChangeNow,
|
||||
onChanged: (value) => dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.changeNow),
|
||||
)
|
||||
]))),
|
||||
PopupMenuItem(
|
||||
value: 5,
|
||||
child: Observer(
|
||||
builder: (_) => Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('MorphToken'),
|
||||
Checkbox(
|
||||
value: dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.displayMorphToken,
|
||||
onChanged: (value) => dashboardViewModel
|
||||
.tradeFilterStore
|
||||
.toggleDisplayExchange(
|
||||
ExchangeProviderDescription
|
||||
.morphToken),
|
||||
)
|
||||
])))
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel)
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 36,
|
||||
width: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: PaletteDark.oceanBlue
|
||||
color: Theme.of(context).textTheme.overline.color
|
||||
),
|
||||
child: filterIcon,
|
||||
),
|
||||
onSelected: (item) async {
|
||||
if (item == 2) {
|
||||
final 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) {
|
||||
dashboardViewModel.transactionFilterStore
|
||||
.changeStartDate(picked.first);
|
||||
dashboardViewModel.transactionFilterStore
|
||||
.changeEndDate(picked.last);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.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:cake_wallet/src/domain/common/wallet_type.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/wallet_menu.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
// FIXME: terrible design.
|
||||
|
||||
@@ -16,14 +18,13 @@ class MenuWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MenuWidgetState extends State<MenuWidget> {
|
||||
final moneroIcon = Image.asset('assets/images/monero.png');
|
||||
final bitcoinIcon = Image.asset('assets/images/bitcoin.png');
|
||||
Image moneroIcon;
|
||||
Image bitcoinIcon;
|
||||
final largeScreen = 731;
|
||||
|
||||
double menuWidth;
|
||||
double screenWidth;
|
||||
double screenHeight;
|
||||
double opacity;
|
||||
|
||||
double headerHeight;
|
||||
double tileHeight;
|
||||
@@ -35,9 +36,8 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
menuWidth = 0;
|
||||
screenWidth = 0;
|
||||
screenHeight = 0;
|
||||
opacity = 0;
|
||||
|
||||
headerHeight = 120;
|
||||
headerHeight = 137;
|
||||
tileHeight = 75;
|
||||
fromTopEdge = 50;
|
||||
fromBottomEdge = 30;
|
||||
@@ -52,7 +52,6 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
|
||||
setState(() {
|
||||
menuWidth = screenWidth;
|
||||
opacity = 1;
|
||||
|
||||
if (screenHeight > largeScreen) {
|
||||
final scale = screenHeight / largeScreen;
|
||||
@@ -70,6 +69,11 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
WalletMenu(context, () async => widget.dashboardViewModel.reconnect());
|
||||
final itemCount = walletMenu.items.length;
|
||||
|
||||
moneroIcon = Image.asset('assets/images/monero_menu.png',
|
||||
color: Theme.of(context).accentTextTheme.overline.decorationColor);
|
||||
bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png',
|
||||
color: Theme.of(context).accentTextTheme.overline.decorationColor);
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@@ -81,175 +85,142 @@ class MenuWidgetState extends State<MenuWidget> {
|
||||
width: 4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
color: Theme.of(context).hintColor),
|
||||
color: PaletteDark.gray),
|
||||
)),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: Container(
|
||||
width: menuWidth,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(24),
|
||||
bottomLeft: Radius.circular(24)),
|
||||
color: Theme.of(context).primaryTextTheme.display1.color),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(24),
|
||||
bottomLeft: Radius.circular(24)),
|
||||
child: ListView.separated(
|
||||
itemBuilder: (_, index) {
|
||||
if (index == 0) {
|
||||
return Container(
|
||||
height: headerHeight,
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
top: fromTopEdge,
|
||||
right: 24,
|
||||
bottom: fromBottomEdge),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.only(topLeft: Radius.circular(24)),
|
||||
child: Container(
|
||||
color: Theme.of(context).textTheme.body2.decorationColor,
|
||||
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)
|
||||
.accentTextTheme
|
||||
.display1
|
||||
.color,
|
||||
Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display1
|
||||
.decorationColor,
|
||||
],
|
||||
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),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 42,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
widget.dashboardViewModel.subname !=
|
||||
null
|
||||
? MainAxisAlignment.spaceBetween
|
||||
: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.dashboardViewModel.name,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (widget.dashboardViewModel.subname !=
|
||||
null)
|
||||
Text(
|
||||
widget.dashboardViewModel.subname,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.overline
|
||||
.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
index--;
|
||||
|
||||
final item = walletMenu.items[index];
|
||||
final image = walletMenu.images[index] ?? Offstage();
|
||||
final isLastTile = index == itemCount - 1;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
walletMenu.action(index);
|
||||
},
|
||||
child: Container(
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.body2
|
||||
.decorationColor,
|
||||
height: isLastTile ? headerHeight : tileHeight,
|
||||
padding: isLastTile
|
||||
? EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24,
|
||||
top: fromBottomEdge,
|
||||
//bottom: fromTopEdge
|
||||
)
|
||||
: EdgeInsets.only(left: 24, right: 24),
|
||||
alignment: isLastTile ? Alignment.topLeft : null,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.display2
|
||||
.color,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
))
|
||||
],
|
||||
),
|
||||
));
|
||||
},
|
||||
separatorBuilder: (_, index) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display2
|
||||
.color),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_iconFor(type: widget.dashboardViewModel.type),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 40,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
widget.dashboardViewModel.subname != null
|
||||
? MainAxisAlignment.spaceBetween
|
||||
: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.dashboardViewModel.name,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color,
|
||||
decoration: TextDecoration.none,
|
||||
fontFamily: 'Avenir Next',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (widget.dashboardViewModel.subname != null)
|
||||
Text(
|
||||
widget.dashboardViewModel.subname,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.caption
|
||||
.color,
|
||||
decoration: TextDecoration.none,
|
||||
fontFamily: 'Avenir Next',
|
||||
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: 'Avenir Next',
|
||||
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: 'Avenir Next',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, index) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
itemCount: itemCount + 1),
|
||||
),
|
||||
),
|
||||
))
|
||||
.caption
|
||||
.decorationColor,
|
||||
),
|
||||
itemCount: itemCount + 1),
|
||||
)))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,35 +13,36 @@ class SyncIndicator extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Observer(
|
||||
builder: (_) {
|
||||
final syncIndicatorWidth = 250.0;
|
||||
final syncIndicatorWidth = 237.0;
|
||||
final status = dashboardViewModel.status;
|
||||
final statusText = status.title();
|
||||
final progress = status.progress();
|
||||
final statusText = status != null ? status.title() : '';
|
||||
final progress = status != null ? status.progress() : 0.0;
|
||||
final indicatorOffset = progress * syncIndicatorWidth;
|
||||
final indicatorWidth =
|
||||
progress <= 1 ? syncIndicatorWidth - indicatorOffset : 0.0;
|
||||
final indicatorWidth = progress < 1
|
||||
? indicatorOffset > 0 ? indicatorOffset : 0.0
|
||||
: syncIndicatorWidth;
|
||||
final indicatorColor = status is SyncedSyncStatus
|
||||
? PaletteDark.brightGreen
|
||||
: PaletteDark.orangeYellow;
|
||||
: Theme.of(context).textTheme.caption.color;
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: syncIndicatorWidth,
|
||||
color: PaletteDark.lightNightBlue,
|
||||
color: Theme.of(context).textTheme.title.decorationColor,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
progress <= 1
|
||||
? Positioned(
|
||||
left: indicatorOffset,
|
||||
left: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
width: indicatorWidth,
|
||||
height: 30,
|
||||
color: PaletteDark.oceanBlue,
|
||||
color: Theme.of(context).textTheme.title.backgroundColor,
|
||||
)
|
||||
)
|
||||
: Offstage(),
|
||||
@@ -70,7 +71,7 @@ class SyncIndicator extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: PaletteDark.wildBlue
|
||||
color: Theme.of(context).textTheme.title.color
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class TradeRow extends StatelessWidget {
|
||||
TradeRow({
|
||||
@@ -66,7 +65,8 @@ class TradeRow extends StatelessWidget {
|
||||
Text(createdAtFormattedDate,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: PaletteDark.darkCyanBlue))
|
||||
color: Theme.of(context).textTheme
|
||||
.overline.backgroundColor))
|
||||
]),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/domain/common/transaction_direction.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
@@ -35,7 +34,7 @@ class TransactionRow extends StatelessWidget {
|
||||
width: 36,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: PaletteDark.wildNightBlue
|
||||
color: Theme.of(context).textTheme.overline.decorationColor
|
||||
),
|
||||
child: Image.asset(
|
||||
direction == TransactionDirection.incoming
|
||||
@@ -79,13 +78,15 @@ class TransactionRow extends StatelessWidget {
|
||||
Text(formattedDate,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: PaletteDark.darkCyanBlue)),
|
||||
color: Theme.of(context).textTheme
|
||||
.overline.backgroundColor)),
|
||||
Text(direction == TransactionDirection.incoming
|
||||
? formattedFiatAmount
|
||||
: '- ' + formattedFiatAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: PaletteDark.darkCyanBlue))
|
||||
color: Theme.of(context).textTheme
|
||||
.overline.backgroundColor))
|
||||
]),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -75,7 +75,7 @@ class TransactionsPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
color: Colors.transparent,
|
||||
height: 1);
|
||||
}
|
||||
)
|
||||
@@ -84,7 +84,8 @@ class TransactionsPage extends StatelessWidget {
|
||||
S.of(context).placeholder_transactions,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey
|
||||
color: Theme.of(context).primaryTextTheme
|
||||
.overline.decorationColor
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,66 +1,59 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/base_exchange_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/trail_button.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
||||
|
||||
class ExchangePage extends BasePage {
|
||||
ExchangePage(this.exchangeViewModel);
|
||||
|
||||
final ExchangeViewModel exchangeViewModel;
|
||||
|
||||
@override
|
||||
String get title => S.current.exchange;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => Palette.darkLavender;
|
||||
Color get titleColor => Colors.white;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.moderateBlue;
|
||||
Color get backgroundLightColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Widget middle(BuildContext context) {
|
||||
final exchangeStore = Provider.of<ExchangeStore>(context);
|
||||
|
||||
return PresentProviderPicker(exchangeStore: exchangeStore);
|
||||
}
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final exchangeStore = Provider.of<ExchangeStore>(context);
|
||||
|
||||
return TrailButton(
|
||||
caption: S.of(context).reset,
|
||||
onPressed: () => exchangeStore.reset()
|
||||
);
|
||||
}
|
||||
Widget middle(BuildContext context) =>
|
||||
PresentProviderPicker(exchangeViewModel: exchangeViewModel);
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => ExchangeForm();
|
||||
}
|
||||
Widget trailing(BuildContext context) =>
|
||||
TrailButton(
|
||||
caption: S.of(context).reset,
|
||||
onPressed: () => exchangeViewModel.reset()
|
||||
);
|
||||
|
||||
class ExchangeForm extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => ExchangeFormState();
|
||||
}
|
||||
|
||||
class ExchangeFormState extends State<ExchangeForm> {
|
||||
Widget body(BuildContext context) =>
|
||||
BaseExchangeWidget(
|
||||
exchangeViewModel: exchangeViewModel,
|
||||
leading: leading(context),
|
||||
middle: middle(context),
|
||||
trailing: trailing(context),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final exchangeStore = Provider.of<ExchangeStore>(context);
|
||||
final walletStore = Provider.of<WalletStore>(context);
|
||||
final exchangeTemplateStore = Provider.of<ExchangeTemplateStore>(context);
|
||||
|
||||
return BaseExchangeWidget(
|
||||
exchangeStore: exchangeStore,
|
||||
walletStore: walletStore,
|
||||
exchangeTemplateStore: exchangeTemplateStore,
|
||||
isTemplate: false
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
body: Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: body(context)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,51 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/base_exchange_widget.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
||||
|
||||
class ExchangeTemplatePage extends BasePage {
|
||||
ExchangeTemplatePage(this.exchangeViewModel);
|
||||
|
||||
final ExchangeViewModel exchangeViewModel;
|
||||
|
||||
@override
|
||||
String get title => S.current.exchange_new_template;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => Palette.darkLavender;
|
||||
Color get titleColor => Colors.white;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.moderateBlue;
|
||||
Color get backgroundLightColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final exchangeStore = Provider.of<ExchangeStore>(context);
|
||||
|
||||
return PresentProviderPicker(exchangeStore: exchangeStore);
|
||||
}
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => ExchangeTemplateForm();
|
||||
}
|
||||
Widget trailing(BuildContext context) =>
|
||||
PresentProviderPicker(exchangeViewModel: exchangeViewModel);
|
||||
|
||||
class ExchangeTemplateForm extends StatefulWidget{
|
||||
@override
|
||||
ExchangeTemplateFormState createState() => ExchangeTemplateFormState();
|
||||
}
|
||||
|
||||
class ExchangeTemplateFormState extends State<ExchangeTemplateForm> {
|
||||
Widget body(BuildContext context) =>
|
||||
BaseExchangeWidget(
|
||||
exchangeViewModel: exchangeViewModel,
|
||||
leading: leading(context),
|
||||
middle: middle(context),
|
||||
trailing: trailing(context),
|
||||
isTemplate: true
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final exchangeStore = Provider.of<ExchangeStore>(context);
|
||||
final walletStore = Provider.of<WalletStore>(context);
|
||||
final exchangeTemplateStore = Provider.of<ExchangeTemplateStore>(context);
|
||||
|
||||
return BaseExchangeWidget(
|
||||
exchangeStore: exchangeStore,
|
||||
walletStore: walletStore,
|
||||
exchangeTemplateStore: exchangeTemplateStore,
|
||||
isTemplate: true
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
body: Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: body(context)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/template_tile.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -12,50 +14,54 @@ import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_exchange_provider.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/exchange_trade_state.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/limits_state.dart';
|
||||
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/exchange_card.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/top_panel.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
||||
import 'package:cake_wallet/core/address_validator.dart';
|
||||
import 'package:cake_wallet/core/amount_validator.dart';
|
||||
|
||||
class BaseExchangeWidget extends StatefulWidget {
|
||||
BaseExchangeWidget({
|
||||
@ required this.exchangeStore,
|
||||
@ required this.walletStore,
|
||||
@ required this.exchangeTemplateStore,
|
||||
@ required this.isTemplate,
|
||||
@required this.exchangeViewModel,
|
||||
this.leading,
|
||||
this.middle,
|
||||
this.trailing,
|
||||
this.isTemplate = false,
|
||||
});
|
||||
|
||||
final ExchangeStore exchangeStore;
|
||||
final WalletStore walletStore;
|
||||
final ExchangeTemplateStore exchangeTemplateStore;
|
||||
final ExchangeViewModel exchangeViewModel;
|
||||
final Widget leading;
|
||||
final Widget middle;
|
||||
final Widget trailing;
|
||||
final bool isTemplate;
|
||||
|
||||
@override
|
||||
BaseExchangeWidgetState createState() =>
|
||||
BaseExchangeWidgetState(
|
||||
exchangeStore: exchangeStore,
|
||||
walletStore: walletStore,
|
||||
exchangeTemplateStore: exchangeTemplateStore,
|
||||
isTemplate: isTemplate
|
||||
);
|
||||
BaseExchangeWidgetState createState() => BaseExchangeWidgetState(
|
||||
exchangeViewModel: exchangeViewModel,
|
||||
leading: leading,
|
||||
middle: middle,
|
||||
trailing: trailing,
|
||||
isTemplate: isTemplate);
|
||||
}
|
||||
|
||||
class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
BaseExchangeWidgetState({
|
||||
@ required this.exchangeStore,
|
||||
@ required this.walletStore,
|
||||
@ required this.exchangeTemplateStore,
|
||||
@ required this.isTemplate,
|
||||
@required this.exchangeViewModel,
|
||||
@required this.leading,
|
||||
@required this.middle,
|
||||
@required this.trailing,
|
||||
@required this.isTemplate,
|
||||
});
|
||||
|
||||
final ExchangeStore exchangeStore;
|
||||
final WalletStore walletStore;
|
||||
final ExchangeTemplateStore exchangeTemplateStore;
|
||||
final ExchangeViewModel exchangeViewModel;
|
||||
final Widget leading;
|
||||
final Widget middle;
|
||||
final Widget trailing;
|
||||
final bool isTemplate;
|
||||
final double topPanelHeight = 290;
|
||||
|
||||
final depositKey = GlobalKey<ExchangeCardState>();
|
||||
final receiveKey = GlobalKey<ExchangeCardState>();
|
||||
@@ -64,281 +70,368 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Image arrowBottomPurple = Image.asset(
|
||||
final arrowBottomPurple = Image.asset(
|
||||
'assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Colors.white,
|
||||
height: 8,
|
||||
);
|
||||
final Image arrowBottomCakeGreen = Image.asset(
|
||||
final arrowBottomCakeGreen = Image.asset(
|
||||
'assets/images/arrow_bottom_cake_green.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Colors.white,
|
||||
height: 8,
|
||||
);
|
||||
|
||||
final depositWalletName =
|
||||
exchangeStore.depositCurrency == CryptoCurrency.xmr
|
||||
? walletStore.name
|
||||
: null;
|
||||
exchangeViewModel.depositCurrency == CryptoCurrency.xmr
|
||||
? exchangeViewModel.wallet.name
|
||||
: null;
|
||||
final receiveWalletName =
|
||||
exchangeStore.receiveCurrency == CryptoCurrency.xmr
|
||||
? walletStore.name
|
||||
: null;
|
||||
exchangeViewModel.receiveCurrency == CryptoCurrency.xmr
|
||||
? exchangeViewModel.wallet.name
|
||||
: null;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => _setReactions(context, exchangeStore, walletStore));
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => _setReactions(context, exchangeViewModel));
|
||||
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
TopPanel(
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
edgeInsets: EdgeInsets.only(bottom: 24),
|
||||
widget: Column(
|
||||
children: <Widget>[
|
||||
TopPanel(
|
||||
color: Theme.of(context).accentTextTheme.title.color,
|
||||
widget: Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
key: depositKey,
|
||||
title: S.of(context).you_will_send,
|
||||
initialCurrency: exchangeStore.depositCurrency,
|
||||
initialWalletName: depositWalletName,
|
||||
initialAddress:
|
||||
exchangeStore.depositCurrency == walletStore.type
|
||||
? walletStore.address
|
||||
: exchangeStore.depositAddress,
|
||||
initialIsAmountEditable: true,
|
||||
initialIsAddressEditable: exchangeStore.isDepositAddressEnabled,
|
||||
isAmountEstimated: false,
|
||||
currencies: CryptoCurrency.all,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeStore.changeDepositCurrency(currency: currency),
|
||||
imageArrow: arrowBottomPurple,
|
||||
currencyButtonColor: Theme.of(context).accentTextTheme.title.color,
|
||||
addressButtonsColor: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
currencyValueValidator: (value) {
|
||||
exchangeStore.validateCryptoCurrency(value);
|
||||
return exchangeStore.errorMessage;
|
||||
},
|
||||
addressTextFieldValidator: (value) {
|
||||
exchangeStore.validateAddress(value,
|
||||
cryptoCurrency: exchangeStore.depositCurrency);
|
||||
return exchangeStore.errorMessage;
|
||||
},
|
||||
),
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 32, left: 24, right: 24),
|
||||
child: Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency: exchangeStore.receiveCurrency,
|
||||
initialWalletName: receiveWalletName,
|
||||
initialAddress:
|
||||
exchangeStore.receiveCurrency == walletStore.type
|
||||
? walletStore.address
|
||||
: exchangeStore.receiveAddress,
|
||||
initialIsAmountEditable: false,
|
||||
initialIsAddressEditable: exchangeStore.isReceiveAddressEnabled,
|
||||
isAmountEstimated: true,
|
||||
currencies: CryptoCurrency.all,
|
||||
onCurrencySelected: (currency) => exchangeStore
|
||||
.changeReceiveCurrency(currency: currency),
|
||||
imageArrow: arrowBottomCakeGreen,
|
||||
currencyButtonColor: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
addressButtonsColor: Theme.of(context).accentTextTheme.title.color,
|
||||
currencyValueValidator: (value) {
|
||||
exchangeStore.validateCryptoCurrency(value);
|
||||
return exchangeStore.errorMessage;
|
||||
},
|
||||
addressTextFieldValidator: (value) {
|
||||
exchangeStore.validateAddress(value,
|
||||
cryptoCurrency: exchangeStore.receiveCurrency);
|
||||
return exchangeStore.errorMessage;
|
||||
},
|
||||
)),
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 32,
|
||||
left: 24,
|
||||
bottom: 24
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
TopPanel(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).primaryTextTheme.body1.color,
|
||||
Theme.of(context).primaryTextTheme.body1.decorationColor,
|
||||
], stops: [
|
||||
0.35,
|
||||
1.0
|
||||
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||
edgeInsets: EdgeInsets.only(bottom: 32),
|
||||
widget: Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).send_templates,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
),
|
||||
TopPanel(
|
||||
edgeInsets: EdgeInsets.all(0),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle
|
||||
.color,
|
||||
Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.subtitle
|
||||
.decorationColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight),
|
||||
widget: Column(
|
||||
children: <Widget>[
|
||||
CupertinoNavigationBar(
|
||||
leading: leading,
|
||||
middle: middle,
|
||||
trailing: trailing,
|
||||
backgroundColor: Colors.transparent,
|
||||
border: null,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(24, 29, 24, 32),
|
||||
child: Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
key: depositKey,
|
||||
title: S.of(context).you_will_send,
|
||||
initialCurrency:
|
||||
exchangeViewModel.depositCurrency,
|
||||
initialWalletName: depositWalletName,
|
||||
initialAddress: exchangeViewModel
|
||||
.depositCurrency ==
|
||||
exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.address
|
||||
: exchangeViewModel.depositAddress,
|
||||
initialIsAmountEditable: true,
|
||||
initialIsAddressEditable: exchangeViewModel
|
||||
.isDepositAddressEnabled,
|
||||
isAmountEstimated: false,
|
||||
currencies: CryptoCurrency.all,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeDepositCurrency(
|
||||
currency: currency),
|
||||
imageArrow: arrowBottomPurple,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).focusColor,
|
||||
borderColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.body2
|
||||
.color,
|
||||
currencyValueValidator: AmountValidator(
|
||||
type: exchangeViewModel.wallet.type),
|
||||
addressTextFieldValidator: AddressValidator(
|
||||
type:
|
||||
exchangeViewModel.depositCurrency),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
|
||||
child: Observer(
|
||||
builder: (_) => ExchangeCard(
|
||||
key: receiveKey,
|
||||
title: S.of(context).you_will_get,
|
||||
initialCurrency:
|
||||
exchangeViewModel.receiveCurrency,
|
||||
initialWalletName: receiveWalletName,
|
||||
initialAddress:
|
||||
exchangeViewModel.receiveCurrency ==
|
||||
exchangeViewModel.wallet.currency
|
||||
? exchangeViewModel.wallet.address
|
||||
: exchangeViewModel.receiveAddress,
|
||||
initialIsAmountEditable: false,
|
||||
initialIsAddressEditable:
|
||||
exchangeViewModel.isReceiveAddressEnabled,
|
||||
isAmountEstimated: true,
|
||||
currencies: CryptoCurrency.all,
|
||||
onCurrencySelected: (currency) =>
|
||||
exchangeViewModel.changeReceiveCurrency(
|
||||
currency: currency),
|
||||
imageArrow: arrowBottomCakeGreen,
|
||||
currencyButtonColor: Colors.transparent,
|
||||
addressButtonsColor:
|
||||
Theme.of(context).focusColor,
|
||||
borderColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.body2
|
||||
.decorationColor,
|
||||
currencyValueValidator: AmountValidator(
|
||||
type: exchangeViewModel.wallet.type),
|
||||
addressTextFieldValidator: AddressValidator(
|
||||
type: exchangeViewModel.receiveCurrency),
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: Container(
|
||||
height: 40,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
final itemCount = exchangeTemplateStore.templates.length + 1;
|
||||
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
if (index == 0) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.exchangeTemplate),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(right: 10),
|
||||
child: DottedBorder(
|
||||
borderType: BorderType.RRect,
|
||||
dashPattern: [8, 4],
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
strokeWidth: 2,
|
||||
radius: Radius.circular(20),
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 75,
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).send_new,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
index -= 1;
|
||||
|
||||
final template = exchangeTemplateStore.templates[index];
|
||||
|
||||
return TemplateTile(
|
||||
amount: template.amount,
|
||||
from: template.depositCurrency,
|
||||
to: template.receiveCurrency,
|
||||
onTap: () {
|
||||
applyTemplate(exchangeStore, template);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Observer(builder: (_) {
|
||||
final description =
|
||||
exchangeStore.provider is XMRTOExchangeProvider
|
||||
? S.of(context).amount_is_guaranteed
|
||||
: S.of(context).amount_is_estimate;
|
||||
return Center(
|
||||
child: Text(
|
||||
description,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.caption.color,
|
||||
fontSize: 12
|
||||
)),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 30, left: 24, bottom: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).send_templates,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display4
|
||||
.color),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
isTemplate
|
||||
? PrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
exchangeTemplateStore.addTemplate(
|
||||
amount: exchangeStore.depositAmount,
|
||||
depositCurrency: exchangeStore.depositCurrency.toString(),
|
||||
receiveCurrency: exchangeStore.receiveCurrency.toString(),
|
||||
provider: exchangeStore.provider.toString(),
|
||||
depositAddress: exchangeStore.depositAddress,
|
||||
receiveAddress: exchangeStore.receiveAddress
|
||||
);
|
||||
exchangeTemplateStore.update();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white
|
||||
)
|
||||
: Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
text: S.of(context).exchange,
|
||||
? Offstage()
|
||||
: Container(
|
||||
height: 40,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.exchangeTemplate),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 1, right: 10),
|
||||
child: DottedBorder(
|
||||
borderType: BorderType.RRect,
|
||||
dashPattern: [6, 4],
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display2
|
||||
.decorationColor,
|
||||
strokeWidth: 2,
|
||||
radius: Radius.circular(20),
|
||||
child: Container(
|
||||
height: 34,
|
||||
width: 75,
|
||||
padding: EdgeInsets.only(
|
||||
left: 10, right: 10),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20)),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).send_new,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display3
|
||||
.color),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
Observer(builder: (_) {
|
||||
final templates = exchangeViewModel.templates;
|
||||
final itemCount =
|
||||
exchangeViewModel.templates.length;
|
||||
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
final template = templates[index];
|
||||
|
||||
return TemplateTile(
|
||||
key: UniqueKey(),
|
||||
amount: template.amount,
|
||||
from: template.depositCurrency,
|
||||
to: template.receiveCurrency,
|
||||
onTap: () {
|
||||
applyTemplate(
|
||||
exchangeViewModel, template);
|
||||
},
|
||||
onRemove: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle:
|
||||
S.of(context).template,
|
||||
alertContent: S
|
||||
.of(context)
|
||||
.confirm_delete_template,
|
||||
leftButtonText:
|
||||
S.of(context).delete,
|
||||
rightButtonText:
|
||||
S.of(context).cancel,
|
||||
actionLeftButton: () {
|
||||
Navigator.of(
|
||||
dialogContext)
|
||||
.pop();
|
||||
exchangeViewModel
|
||||
.exchangeTemplateStore
|
||||
.remove(
|
||||
template:
|
||||
template);
|
||||
exchangeViewModel
|
||||
.exchangeTemplateStore
|
||||
.update();
|
||||
},
|
||||
actionRightButton: () =>
|
||||
Navigator.of(
|
||||
dialogContext)
|
||||
.pop());
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
}),
|
||||
],
|
||||
)))
|
||||
],
|
||||
),
|
||||
bottomSectionPadding:
|
||||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Column(children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 15),
|
||||
child: Observer(builder: (_) {
|
||||
final description =
|
||||
exchangeViewModel.provider is XMRTOExchangeProvider
|
||||
? S.of(context).amount_is_guaranteed
|
||||
: S.of(context).amount_is_estimate;
|
||||
return Center(
|
||||
child: Text(
|
||||
description,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display4
|
||||
.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
isTemplate
|
||||
? PrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
exchangeStore.createTrade();
|
||||
exchangeViewModel.exchangeTemplateStore.addTemplate(
|
||||
amount: exchangeViewModel.depositAmount,
|
||||
depositCurrency:
|
||||
exchangeViewModel.depositCurrency.toString(),
|
||||
receiveCurrency:
|
||||
exchangeViewModel.receiveCurrency.toString(),
|
||||
provider: exchangeViewModel.provider.toString(),
|
||||
depositAddress: exchangeViewModel.depositAddress,
|
||||
receiveAddress: exchangeViewModel.receiveAddress);
|
||||
exchangeViewModel.exchangeTemplateStore.update();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
isLoading: exchangeStore.tradeState is TradeIsCreating,
|
||||
)),
|
||||
]),
|
||||
)),
|
||||
);
|
||||
text: S.of(context).save,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white)
|
||||
: Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
text: S.of(context).exchange,
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
exchangeViewModel.createTrade();
|
||||
}
|
||||
},
|
||||
color: Palette.blueCraiola,
|
||||
textColor: Colors.white,
|
||||
isLoading:
|
||||
exchangeViewModel.tradeState is TradeIsCreating,
|
||||
)),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
void applyTemplate(ExchangeStore store, ExchangeTemplate template) {
|
||||
store.changeDepositCurrency(currency: CryptoCurrency.fromString(template.depositCurrency));
|
||||
store.changeReceiveCurrency(currency: CryptoCurrency.fromString(template.receiveCurrency));
|
||||
void applyTemplate(
|
||||
ExchangeViewModel exchangeViewModel, ExchangeTemplate template) {
|
||||
exchangeViewModel.changeDepositCurrency(
|
||||
currency: CryptoCurrency.fromString(template.depositCurrency));
|
||||
exchangeViewModel.changeReceiveCurrency(
|
||||
currency: CryptoCurrency.fromString(template.receiveCurrency));
|
||||
|
||||
switch (template.provider) {
|
||||
case 'XMR.TO':
|
||||
store.changeProvider(provider: store.providerList[0]);
|
||||
exchangeViewModel.changeProvider(
|
||||
provider: exchangeViewModel.providerList[0]);
|
||||
break;
|
||||
case 'ChangeNOW':
|
||||
store.changeProvider(provider: store.providerList[1]);
|
||||
exchangeViewModel.changeProvider(
|
||||
provider: exchangeViewModel.providerList[1]);
|
||||
break;
|
||||
case 'MorphToken':
|
||||
store.changeProvider(provider: store.providerList[2]);
|
||||
exchangeViewModel.changeProvider(
|
||||
provider: exchangeViewModel.providerList[2]);
|
||||
break;
|
||||
}
|
||||
|
||||
store.changeDepositAmount(amount: template.amount);
|
||||
store.depositAddress = template.depositAddress;
|
||||
store.receiveAddress = template.receiveAddress;
|
||||
exchangeViewModel.changeDepositAmount(amount: template.amount);
|
||||
exchangeViewModel.depositAddress = template.depositAddress;
|
||||
exchangeViewModel.receiveAddress = template.receiveAddress;
|
||||
}
|
||||
|
||||
void _setReactions(
|
||||
BuildContext context, ExchangeStore store, WalletStore walletStore) {
|
||||
BuildContext context, ExchangeViewModel exchangeViewModel) {
|
||||
if (_isReactionsSet) {
|
||||
return;
|
||||
}
|
||||
@@ -347,7 +440,7 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
final depositAmountController = depositKey.currentState.amountController;
|
||||
final receiveAddressController = receiveKey.currentState.addressController;
|
||||
final receiveAmountController = receiveKey.currentState.amountController;
|
||||
final limitsState = store.limitsState;
|
||||
final limitsState = exchangeViewModel.limitsState;
|
||||
|
||||
if (limitsState is LimitsLoadedSuccessfully) {
|
||||
final min = limitsState.limits.min != null
|
||||
@@ -360,63 +453,66 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
key.currentState.changeLimits(min: min, max: max);
|
||||
}
|
||||
|
||||
_onCurrencyChange(store.receiveCurrency, walletStore, receiveKey);
|
||||
_onCurrencyChange(store.depositCurrency, walletStore, depositKey);
|
||||
_onCurrencyChange(
|
||||
exchangeViewModel.receiveCurrency, exchangeViewModel, receiveKey);
|
||||
_onCurrencyChange(
|
||||
exchangeViewModel.depositCurrency, exchangeViewModel, depositKey);
|
||||
|
||||
reaction(
|
||||
(_) => walletStore.name,
|
||||
(String _) => _onWalletNameChange(
|
||||
walletStore, store.receiveCurrency, receiveKey));
|
||||
(_) => exchangeViewModel.wallet.name,
|
||||
(String _) => _onWalletNameChange(
|
||||
exchangeViewModel, exchangeViewModel.receiveCurrency, receiveKey));
|
||||
|
||||
reaction(
|
||||
(_) => walletStore.name,
|
||||
(String _) => _onWalletNameChange(
|
||||
walletStore, store.depositCurrency, depositKey));
|
||||
(_) => exchangeViewModel.wallet.name,
|
||||
(String _) => _onWalletNameChange(
|
||||
exchangeViewModel, exchangeViewModel.depositCurrency, depositKey));
|
||||
|
||||
reaction(
|
||||
(_) => store.receiveCurrency,
|
||||
(CryptoCurrency currency) =>
|
||||
_onCurrencyChange(currency, walletStore, receiveKey));
|
||||
(_) => exchangeViewModel.receiveCurrency,
|
||||
(CryptoCurrency currency) =>
|
||||
_onCurrencyChange(currency, exchangeViewModel, receiveKey));
|
||||
|
||||
reaction(
|
||||
(_) => store.depositCurrency,
|
||||
(CryptoCurrency currency) =>
|
||||
_onCurrencyChange(currency, walletStore, depositKey));
|
||||
(_) => exchangeViewModel.depositCurrency,
|
||||
(CryptoCurrency currency) =>
|
||||
_onCurrencyChange(currency, exchangeViewModel, depositKey));
|
||||
|
||||
reaction((_) => store.depositAmount, (String amount) {
|
||||
reaction((_) => exchangeViewModel.depositAmount, (String amount) {
|
||||
if (depositKey.currentState.amountController.text != amount) {
|
||||
depositKey.currentState.amountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => store.depositAddress, (String address) {
|
||||
reaction((_) => exchangeViewModel.depositAddress, (String address) {
|
||||
if (depositKey.currentState.addressController.text != address) {
|
||||
depositKey.currentState.addressController.text = address;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => store.isDepositAddressEnabled, (bool isEnabled) {
|
||||
reaction((_) => exchangeViewModel.isDepositAddressEnabled,
|
||||
(bool isEnabled) {
|
||||
depositKey.currentState.isAddressEditable(isEditable: isEnabled);
|
||||
});
|
||||
|
||||
reaction((_) => store.receiveAmount, (String amount) {
|
||||
if (receiveKey.currentState.amountController.text !=
|
||||
store.receiveAmount) {
|
||||
reaction((_) => exchangeViewModel.receiveAmount, (String amount) {
|
||||
if (receiveKey.currentState.amountController.text != amount) {
|
||||
receiveKey.currentState.amountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => store.receiveAddress, (String address) {
|
||||
reaction((_) => exchangeViewModel.receiveAddress, (String address) {
|
||||
if (receiveKey.currentState.addressController.text != address) {
|
||||
receiveKey.currentState.addressController.text = address;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => store.isReceiveAddressEnabled, (bool isEnabled) {
|
||||
reaction((_) => exchangeViewModel.isReceiveAddressEnabled,
|
||||
(bool isEnabled) {
|
||||
receiveKey.currentState.isAddressEditable(isEditable: isEnabled);
|
||||
});
|
||||
|
||||
reaction((_) => store.tradeState, (ExchangeTradeState state) {
|
||||
reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) {
|
||||
if (state is TradeIsCreatedFailure) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
@@ -426,18 +522,16 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
alertTitle: S.of(context).error,
|
||||
alertContent: state.error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop()
|
||||
);
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
});
|
||||
}
|
||||
if (state is TradeIsCreatedSuccessfully) {
|
||||
Navigator.of(context)
|
||||
.pushNamed(Routes.exchangeConfirm, arguments: state.trade);
|
||||
Navigator.of(context).pushNamed(Routes.exchangeConfirm);
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => store.limitsState, (LimitsState state) {
|
||||
reaction((_) => exchangeViewModel.limitsState, (LimitsState state) {
|
||||
String min;
|
||||
String max;
|
||||
|
||||
@@ -461,29 +555,31 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
});
|
||||
|
||||
depositAddressController.addListener(
|
||||
() => store.depositAddress = depositAddressController.text);
|
||||
() => exchangeViewModel.depositAddress = depositAddressController.text);
|
||||
|
||||
depositAmountController.addListener(() {
|
||||
if (depositAmountController.text != store.depositAmount) {
|
||||
store.changeDepositAmount(amount: depositAmountController.text);
|
||||
if (depositAmountController.text != exchangeViewModel.depositAmount) {
|
||||
exchangeViewModel.changeDepositAmount(
|
||||
amount: depositAmountController.text);
|
||||
}
|
||||
});
|
||||
|
||||
receiveAddressController.addListener(
|
||||
() => store.receiveAddress = receiveAddressController.text);
|
||||
() => exchangeViewModel.receiveAddress = receiveAddressController.text);
|
||||
|
||||
receiveAmountController.addListener(() {
|
||||
if (receiveAmountController.text != store.receiveAmount) {
|
||||
store.changeReceiveAmount(amount: receiveAmountController.text);
|
||||
if (receiveAmountController.text != exchangeViewModel.receiveAmount) {
|
||||
exchangeViewModel.changeReceiveAmount(
|
||||
amount: receiveAmountController.text);
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => walletStore.address, (String address) {
|
||||
if (store.depositCurrency == CryptoCurrency.xmr) {
|
||||
reaction((_) => exchangeViewModel.wallet.address, (String address) {
|
||||
if (exchangeViewModel.depositCurrency == CryptoCurrency.xmr) {
|
||||
depositKey.currentState.changeAddress(address: address);
|
||||
}
|
||||
|
||||
if (store.receiveCurrency == CryptoCurrency.xmr) {
|
||||
if (exchangeViewModel.receiveCurrency == CryptoCurrency.xmr) {
|
||||
receiveKey.currentState.changeAddress(address: address);
|
||||
}
|
||||
});
|
||||
@@ -491,30 +587,32 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
|
||||
_isReactionsSet = true;
|
||||
}
|
||||
|
||||
void _onCurrencyChange(CryptoCurrency currency, WalletStore walletStore,
|
||||
GlobalKey<ExchangeCardState> key) {
|
||||
final isCurrentTypeWallet = currency == walletStore.type;
|
||||
void _onCurrencyChange(CryptoCurrency currency,
|
||||
ExchangeViewModel exchangeViewModel, GlobalKey<ExchangeCardState> key) {
|
||||
final isCurrentTypeWallet = currency == exchangeViewModel.wallet.currency;
|
||||
|
||||
key.currentState.changeSelectedCurrency(currency);
|
||||
key.currentState
|
||||
.changeWalletName(isCurrentTypeWallet ? walletStore.name : null);
|
||||
key.currentState.changeWalletName(
|
||||
isCurrentTypeWallet ? exchangeViewModel.wallet.name : null);
|
||||
|
||||
key.currentState
|
||||
.changeAddress(address: isCurrentTypeWallet ? walletStore.address : '');
|
||||
key.currentState.changeAddress(
|
||||
address: isCurrentTypeWallet ? exchangeViewModel.wallet.address : '');
|
||||
|
||||
key.currentState.changeAmount(amount: '');
|
||||
}
|
||||
|
||||
void _onWalletNameChange(WalletStore walletStore, CryptoCurrency currency,
|
||||
GlobalKey<ExchangeCardState> key) {
|
||||
final isCurrentTypeWallet = currency == walletStore.type;
|
||||
void _onWalletNameChange(ExchangeViewModel exchangeViewModel,
|
||||
CryptoCurrency currency, GlobalKey<ExchangeCardState> key) {
|
||||
final isCurrentTypeWallet = currency == exchangeViewModel.wallet.currency;
|
||||
|
||||
if (isCurrentTypeWallet) {
|
||||
key.currentState.changeWalletName(walletStore.name);
|
||||
key.currentState.addressController.text = walletStore.address;
|
||||
} else if (key.currentState.addressController.text == walletStore.address) {
|
||||
key.currentState.changeWalletName(exchangeViewModel.wallet.name);
|
||||
key.currentState.addressController.text =
|
||||
exchangeViewModel.wallet.address;
|
||||
} else if (key.currentState.addressController.text ==
|
||||
exchangeViewModel.wallet.address) {
|
||||
key.currentState.changeWalletName(null);
|
||||
key.currentState.addressController.text = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
|
||||
class CurrencyPicker extends StatelessWidget {
|
||||
CurrencyPicker({
|
||||
@@ -16,104 +18,103 @@ class CurrencyPicker extends StatelessWidget {
|
||||
final List<CryptoCurrency> items;
|
||||
final String title;
|
||||
final Function(CryptoCurrency) onItemSelected;
|
||||
final closeButton = Image.asset('assets/images/close.png',
|
||||
color: Palette.darkBlueCraiola,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: Colors.white
|
||||
),
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
height: 400,
|
||||
width: 300,
|
||||
color: Theme.of(context).dividerColor,
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
crossAxisCount: 3,
|
||||
childAspectRatio: 1.25,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisSpacing: 1,
|
||||
mainAxisSpacing: 1,
|
||||
children: List.generate(15, (index) {
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
height: 400,
|
||||
width: 300,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
crossAxisCount: 3,
|
||||
childAspectRatio: 1.25,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisSpacing: 1,
|
||||
mainAxisSpacing: 1,
|
||||
children: List.generate(15, (index) {
|
||||
|
||||
if (index == 14) {
|
||||
return Container(
|
||||
color: Theme.of(context).primaryTextTheme.display1.color,
|
||||
);
|
||||
}
|
||||
if (index == 14) {
|
||||
return Container(
|
||||
color: Theme.of(context).accentTextTheme.title.color,
|
||||
);
|
||||
}
|
||||
|
||||
final item = items[index];
|
||||
final isItemSelected = index == selectedAtIndex;
|
||||
final item = items[index];
|
||||
final isItemSelected = index == selectedAtIndex;
|
||||
|
||||
final color = isItemSelected
|
||||
? Theme.of(context).accentTextTheme.subtitle.decorationColor
|
||||
: Theme.of(context).primaryTextTheme.display1.color;
|
||||
final textColor = isItemSelected
|
||||
? Colors.blue
|
||||
: Theme.of(context).primaryTextTheme.title.color;
|
||||
final color = isItemSelected
|
||||
? Theme.of(context).textTheme.body2.color
|
||||
: Theme.of(context).accentTextTheme.title.color;
|
||||
final textColor = isItemSelected
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).primaryTextTheme.title.color;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (onItemSelected == null) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
onItemSelected(item);
|
||||
},
|
||||
child: Container(
|
||||
color: color,
|
||||
child: Center(
|
||||
child: Text(
|
||||
item.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: textColor
|
||||
),
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (onItemSelected == null) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
onItemSelected(item);
|
||||
},
|
||||
child: Container(
|
||||
color: color,
|
||||
child: Center(
|
||||
child: Text(
|
||||
item.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
decoration: TextDecoration.none,
|
||||
color: textColor
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
AlertCloseButton(image: closeButton)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ class ExchangeCard extends StatefulWidget {
|
||||
this.imageArrow,
|
||||
this.currencyButtonColor = Colors.transparent,
|
||||
this.addressButtonsColor = Colors.transparent,
|
||||
this.borderColor = Colors.transparent,
|
||||
this.currencyValueValidator,
|
||||
this.addressTextFieldValidator})
|
||||
: super(key: key);
|
||||
@@ -37,6 +38,7 @@ class ExchangeCard extends StatefulWidget {
|
||||
final Image imageArrow;
|
||||
final Color currencyButtonColor;
|
||||
final Color addressButtonsColor;
|
||||
final Color borderColor;
|
||||
final FormFieldValidator<String> currencyValueValidator;
|
||||
final FormFieldValidator<String> addressTextFieldValidator;
|
||||
|
||||
@@ -110,10 +112,15 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final copyImage = Image.asset('assets/images/copy_content.png',
|
||||
height: 16, width: 16,
|
||||
color: Theme.of(context).primaryTextTheme.display2.color);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -123,13 +130,13 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
color: Theme.of(context).textTheme.headline.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
BaseTextFormField(
|
||||
@@ -139,11 +146,25 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(15),
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
hintText: '0.0000',
|
||||
validator: widget.currencyValueValidator
|
||||
borderColor: widget.borderColor,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white
|
||||
),
|
||||
placeholderTextStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor
|
||||
),
|
||||
validator: _isAmountEditable
|
||||
? widget.currencyValueValidator
|
||||
: null
|
||||
),
|
||||
Positioned(
|
||||
top: 8,
|
||||
@@ -163,7 +184,7 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).primaryTextTheme.title.color)),
|
||||
color: Colors.white)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: widget.imageArrow,
|
||||
@@ -181,45 +202,102 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_min != null
|
||||
? Text(
|
||||
? Text(
|
||||
S.of(context).min_value(
|
||||
_min, _selectedCurrency.toString()),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor),
|
||||
)
|
||||
: Offstage(),
|
||||
: Offstage(),
|
||||
_min != null ? SizedBox(width: 10) : Offstage(),
|
||||
_max != null
|
||||
? Text(
|
||||
? Text(
|
||||
S.of(context).max_value(
|
||||
_max, _selectedCurrency.toString()),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
height: 1.2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color))
|
||||
: Offstage(),
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor))
|
||||
: Offstage(),
|
||||
]),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
_isAddressEditable
|
||||
? Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
S.of(context).refund_address,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor
|
||||
),
|
||||
)
|
||||
),
|
||||
_isAddressEditable
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: AddressTextField(
|
||||
controller: addressController,
|
||||
isActive: _isAddressEditable,
|
||||
options: _isAddressEditable
|
||||
? _walletName != null
|
||||
? []
|
||||
: [
|
||||
options: [
|
||||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook,
|
||||
]
|
||||
: [],
|
||||
],
|
||||
isBorderExist: false,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor),
|
||||
buttonColor: widget.addressButtonsColor,
|
||||
validator: widget.addressTextFieldValidator,
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Builder(
|
||||
builder: (context) => GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: addressController.text));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 500),
|
||||
));
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
addressController.text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16),
|
||||
child: copyImage,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
||||
|
||||
class PresentProviderPicker extends StatelessWidget {
|
||||
PresentProviderPicker({@required this.exchangeStore});
|
||||
PresentProviderPicker({@required this.exchangeViewModel});
|
||||
|
||||
final ExchangeStore exchangeStore;
|
||||
final ExchangeViewModel exchangeViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Image arrowBottom =
|
||||
final arrowBottom =
|
||||
Image.asset('assets/images/arrow_bottom_purple_icon.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Colors.white,
|
||||
height: 6);
|
||||
|
||||
return FlatButton(
|
||||
@@ -33,19 +33,19 @@ class PresentProviderPicker extends StatelessWidget {
|
||||
Text(S.of(context).exchange,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).primaryTextTheme.title.color)),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white)),
|
||||
Observer(
|
||||
builder: (_) => Text('${exchangeStore.provider.title}',
|
||||
builder: (_) => Text('${exchangeViewModel.provider.title}',
|
||||
style: TextStyle(
|
||||
fontSize: 10.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color)))
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.headline.color)))
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: arrowBottom,
|
||||
)
|
||||
],
|
||||
@@ -54,11 +54,11 @@ class PresentProviderPicker extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _presentProviderPicker(BuildContext context) {
|
||||
final items = exchangeStore.providersForCurrentPair();
|
||||
final selectedItem = items.indexOf(exchangeStore.provider);
|
||||
final images = List<Image>();
|
||||
final items = exchangeViewModel.providersForCurrentPair();
|
||||
final selectedItem = items.indexOf(exchangeViewModel.provider);
|
||||
final images = <Image>[];
|
||||
|
||||
for (ExchangeProvider provider in items) {
|
||||
for (var provider in items) {
|
||||
switch (provider.description) {
|
||||
case ExchangeProviderDescription.xmrto:
|
||||
images.add(Image.asset('assets/images/xmr_btc.png'));
|
||||
@@ -79,7 +79,7 @@ class PresentProviderPicker extends StatelessWidget {
|
||||
selectedAtIndex: selectedItem,
|
||||
title: S.of(context).change_exchange_provider,
|
||||
onItemSelected: (ExchangeProvider provider) =>
|
||||
exchangeStore.changeProvider(provider: provider)),
|
||||
exchangeViewModel.changeProvider(provider: provider)),
|
||||
context: context);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -6,10 +7,12 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/trade.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class ExchangeConfirmPage extends BasePage {
|
||||
ExchangeConfirmPage({@required this.trade});
|
||||
ExchangeConfirmPage({@required this.tradesStore}) : trade = tradesStore.trade;
|
||||
|
||||
final TradesStore tradesStore;
|
||||
final Trade trade;
|
||||
|
||||
@override
|
||||
@@ -17,93 +20,102 @@ class ExchangeConfirmPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final copyImage = Image.asset('assets/images/copy_content.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
padding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).exchange_result_write_down_trade_id,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 60),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Center(
|
||||
child: Text(
|
||||
S.of(context).trade_id,
|
||||
S.of(context).exchange_result_write_down_trade_id,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
)
|
||||
),
|
||||
Container(
|
||||
height: 178,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
border: Border.all(
|
||||
width: 1,
|
||||
color: Theme.of(context).accentTextTheme.caption.color
|
||||
),
|
||||
color: Theme.of(context).accentTextTheme.title.color
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: Builder(
|
||||
builder: (context) => GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 1500),
|
||||
));
|
||||
},
|
||||
child: Container(
|
||||
height: 60,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
trade.id,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
Text(
|
||||
S.of(context).trade_id,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color
|
||||
),
|
||||
),
|
||||
Text(
|
||||
trade.id,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12),
|
||||
child: copyImage,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 1500),
|
||||
));
|
||||
},
|
||||
text: S.of(context).copy_id,
|
||||
color: Theme.of(context).accentTextTheme.caption.backgroundColor,
|
||||
textColor: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Offstage()
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
PrimaryButton(
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.exchangeTrade, arguments: trade),
|
||||
.pushReplacementNamed(Routes.exchangeTrade),
|
||||
text: S.of(context).saved_the_trade_id,
|
||||
color: Colors.green,
|
||||
color: Palette.blueCraiola,
|
||||
textColor: Colors.white)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class ExchangeTradeItem {
|
||||
ExchangeTradeItem({
|
||||
@required this.title,
|
||||
@required this.data,
|
||||
@required this.isCopied,
|
||||
});
|
||||
|
||||
String title;
|
||||
String data;
|
||||
bool isCopied;
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
@@ -19,15 +24,62 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
|
||||
void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
|
||||
final fetchingLabel = S.current.fetching;
|
||||
final trade = exchangeTradeViewModel.trade;
|
||||
final walletName = exchangeTradeViewModel.wallet.name;
|
||||
|
||||
final information = exchangeTradeViewModel.isSendable
|
||||
? S.current.exchange_result_confirm(
|
||||
trade.amount ?? fetchingLabel,
|
||||
trade.from.toString(),
|
||||
walletName)
|
||||
: S.current.exchange_result_description(
|
||||
trade.amount ?? fetchingLabel, trade.from.toString());
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => InformationPage(information: information)
|
||||
);
|
||||
}
|
||||
|
||||
class ExchangeTradePage extends BasePage {
|
||||
ExchangeTradePage({@required this.exchangeTradeViewModel});
|
||||
|
||||
final ExchangeTradeViewModel exchangeTradeViewModel;
|
||||
|
||||
@override
|
||||
String get title => S.current.exchange;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => ExchangeTradeForm();
|
||||
Widget trailing(BuildContext context) {
|
||||
final questionImage = Image.asset('assets/images/question_mark.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color);
|
||||
|
||||
return SizedBox(
|
||||
height: 20.0,
|
||||
width: 20.0,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
child: FlatButton(
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
padding: EdgeInsets.all(0),
|
||||
onPressed: () => showInformation(exchangeTradeViewModel, context),
|
||||
child: questionImage),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => ExchangeTradeForm(exchangeTradeViewModel);
|
||||
}
|
||||
|
||||
class ExchangeTradeForm extends StatefulWidget {
|
||||
ExchangeTradeForm(this.exchangeTradeViewModel);
|
||||
|
||||
final ExchangeTradeViewModel exchangeTradeViewModel;
|
||||
|
||||
@override
|
||||
ExchangeTradeState createState() => ExchangeTradeState();
|
||||
}
|
||||
@@ -39,263 +91,139 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
bool _effectsInstalled = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tradeStore = Provider.of<ExchangeTradeStore>(context);
|
||||
final sendStore = Provider.of<SendStore>(context);
|
||||
final walletStore = Provider.of<WalletStore>(context);
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
||||
}
|
||||
|
||||
_setEffects(context);
|
||||
void afterLayout(dynamic _) {
|
||||
showInformation(widget.exchangeTradeViewModel, context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final copyImage = Image.asset('assets/images/copy_content.png',
|
||||
height: 16, width: 16,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color);
|
||||
|
||||
//_setEffects(context);
|
||||
|
||||
return Container(
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(left: 24, right: 24, top: 24),
|
||||
contentPadding: EdgeInsets.only(top: 10, bottom: 16),
|
||||
content: Observer(builder: (_) {
|
||||
final trade = tradeStore.trade;
|
||||
final walletName = walletStore.name;
|
||||
final trade = widget.exchangeTradeViewModel.trade;
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).id,
|
||||
style: TextStyle(
|
||||
height: 2,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
Text(
|
||||
'${trade.id ?? fetchingLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
height: 2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).amount,
|
||||
style: TextStyle(
|
||||
height: 2,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
Text(
|
||||
'${trade.amount ?? fetchingLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
height: 2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
)
|
||||
],
|
||||
),
|
||||
trade.extraId != null
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).payment_id,
|
||||
style: TextStyle(
|
||||
height: 2,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
Text(
|
||||
'${trade.extraId ?? fetchingLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
height: 2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).status,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
height: 2),
|
||||
),
|
||||
Text(
|
||||
'${trade.state ?? fetchingLabel}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
height: 2,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
)
|
||||
],
|
||||
),
|
||||
trade.expiredAt != null
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).offer_expires_in,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
TimerWidget(trade.expiredAt,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color)
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
trade.expiredAt != null
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).offer_expires_in,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color),
|
||||
),
|
||||
TimerWidget(trade.expiredAt,
|
||||
color: Theme.of(context).primaryTextTheme.title.color)
|
||||
])
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 32),
|
||||
child: Row(children: <Widget>[
|
||||
Spacer(flex: 3),
|
||||
Flexible(
|
||||
flex: 4,
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: QrImage(
|
||||
data: trade.inputAddress ?? fetchingLabel,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Theme.of(context)
|
||||
.accentTextTheme.subtitle.color,
|
||||
)))),
|
||||
Spacer(flex: 3)
|
||||
]),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: QrImage(
|
||||
data: trade.inputAddress ?? fetchingLabel,
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Theme.of(context).primaryTextTheme.display4.color,
|
||||
),
|
||||
),
|
||||
)),
|
||||
Spacer(
|
||||
flex: 1,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
S.of(context).trade_is_powered_by(trade.provider != null
|
||||
? trade.provider.title
|
||||
: fetchingLabel),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: Center(
|
||||
child: Text(
|
||||
trade.inputAddress ?? fetchingLabel,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
padding: EdgeInsets.only(top: 16),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: widget.exchangeTradeViewModel.items.length,
|
||||
separatorBuilder: (context, index) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).accentTextTheme.subtitle.backgroundColor,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final item = widget.exchangeTradeViewModel.items[index];
|
||||
String value;
|
||||
|
||||
final content = Observer(
|
||||
builder: (_) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
value = '${widget.exchangeTradeViewModel.trade.id ?? fetchingLabel}';
|
||||
break;
|
||||
case 1:
|
||||
value = '${widget.exchangeTradeViewModel.trade.amount ?? fetchingLabel}';
|
||||
break;
|
||||
case 2:
|
||||
value = '${widget.exchangeTradeViewModel.trade.state ?? fetchingLabel}';
|
||||
break;
|
||||
case 3:
|
||||
value = widget.exchangeTradeViewModel.trade.inputAddress ?? fetchingLabel;
|
||||
break;
|
||||
}
|
||||
|
||||
return StandartListRow(
|
||||
title: item.title,
|
||||
value: value,
|
||||
valueFontSize: 14,
|
||||
image: item.isCopied ? copyImage : null,
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return item.isCopied
|
||||
? Builder(
|
||||
builder: (context) =>
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: value));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 1500),
|
||||
));
|
||||
},
|
||||
child: content,
|
||||
)
|
||||
)
|
||||
: content;
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(right: 5.0),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.inputAddress));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 1500),
|
||||
));
|
||||
},
|
||||
text: S.of(context).copy_address,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
textColor: Theme.of(context).primaryTextTheme.title.color)
|
||||
),
|
||||
)),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 5.0),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
S.of(context).copied_to_clipboard,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
duration: Duration(milliseconds: 1500),
|
||||
));
|
||||
},
|
||||
text: S.of(context).copy_id,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
textColor: Theme.of(context).primaryTextTheme.title.color)
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Text(
|
||||
tradeStore.isSendable
|
||||
? S.of(context).exchange_result_confirm(
|
||||
trade.amount ?? fetchingLabel,
|
||||
trade.from.toString(),
|
||||
walletName)
|
||||
: S.of(context).exchange_result_description(
|
||||
trade.amount ?? fetchingLabel, trade.from.toString()),
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
S.of(context).exchange_result_write_down_ID,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
bottomSectionPadding: EdgeInsets.all(24),
|
||||
bottomSection: Observer(
|
||||
bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
|
||||
bottomSection: PrimaryButton(
|
||||
onPressed: () {},
|
||||
text: S.of(context).confirm,
|
||||
color: Palette.blueCraiola,
|
||||
textColor: Colors.white
|
||||
)
|
||||
/*Observer(
|
||||
builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr &&
|
||||
!(sendStore.state is TransactionCommitted)
|
||||
? LoadingPrimaryButton(
|
||||
@@ -312,7 +240,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
: S.of(context).send_xmr,
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white)
|
||||
: Offstage()),
|
||||
: Offstage()),*/
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -322,7 +250,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
return;
|
||||
}
|
||||
|
||||
final sendStore = Provider.of<SendStore>(context);
|
||||
/*final sendStore = Provider.of<SendStore>(context);
|
||||
|
||||
reaction((_) => sendStore.state, (SendingState state) {
|
||||
if (state is SendingFailed) {
|
||||
@@ -376,7 +304,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
_effectsInstalled = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
|
||||
class InformationPage extends StatelessWidget {
|
||||
InformationPage({@required this.information});
|
||||
|
||||
final String information;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertBackground(
|
||||
child: Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
color: Theme.of(context).textTheme.body2.decorationColor
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 28, 24, 24),
|
||||
child: Text(
|
||||
information,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Poppins',
|
||||
decoration: TextDecoration.none,
|
||||
color: Theme.of(context).accentTextTheme.caption.decorationColor
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
|
||||
child: PrimaryButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
text: S.of(context).send_got_it,
|
||||
color: Theme.of(context).accentTextTheme.caption.backgroundColor,
|
||||
textColor: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -53,10 +53,16 @@ class TimerWidgetState extends State<TimerWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
return _isExpired
|
||||
? Text(S.of(context).expired,
|
||||
style: TextStyle(fontSize: 14.0, color: Colors.red))
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.red))
|
||||
: Text(
|
||||
S.of(context).time(_minutes.toString(), _seconds.toString()),
|
||||
style: TextStyle(fontSize: 14.0, color: widget.color),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: widget.color),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:cake_wallet/view_model/monero_account_list/monero_account_edit_o
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class MoneroAccountEditOrCreatePage extends BasePage {
|
||||
MoneroAccountEditOrCreatePage({@required this.moneroAccountCreationViewModel})
|
||||
@@ -24,12 +23,6 @@ class MoneroAccountEditOrCreatePage extends BasePage {
|
||||
@override
|
||||
String get title => S.current.account;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => PaletteDark.backgroundColor;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.backgroundColor;
|
||||
|
||||
final GlobalKey<FormState> _formKey;
|
||||
final TextEditingController _textController;
|
||||
|
||||
@@ -45,7 +38,6 @@ class MoneroAccountEditOrCreatePage extends BasePage {
|
||||
child: Center(
|
||||
child: BaseTextFormField(
|
||||
controller: _textController,
|
||||
textColor: Colors.white,
|
||||
hintText: S.of(context).account,
|
||||
validator: MoneroLabelValidator(),
|
||||
))),
|
||||
|
||||
@@ -27,7 +27,9 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
final MoneroAccountListViewModel accountListViewModel;
|
||||
final closeIcon = Image.asset('assets/images/close.png');
|
||||
final closeIcon = Image.asset('assets/images/close.png',
|
||||
color: Palette.darkBlueCraiola,
|
||||
);
|
||||
|
||||
ScrollController controller;
|
||||
double backgroundHeight;
|
||||
@@ -64,7 +66,7 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
height: 296,
|
||||
color: PaletteDark.deepPurpleBlue,
|
||||
color: Theme.of(context).textTheme.display4.decorationColor,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -83,7 +85,7 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
separatorBuilder: (context, index) =>
|
||||
Container(
|
||||
height: 1,
|
||||
color: PaletteDark.dividerColor,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
itemCount: accounts.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
@@ -121,7 +123,7 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
.pushNamed(Routes.accountCreation),
|
||||
child: Container(
|
||||
height: 62,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).textTheme.subtitle.decorationColor,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Center(
|
||||
child: Row(
|
||||
@@ -129,7 +131,7 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.add,
|
||||
color: PaletteDark.darkNightBlue,
|
||||
color: Colors.white,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
@@ -138,7 +140,7 @@ class MoneroAccountListPage extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: PaletteDark.darkNightBlue,
|
||||
color: Colors.white,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class AccountTile extends StatelessWidget {
|
||||
AccountTile({
|
||||
@@ -14,8 +13,12 @@ class AccountTile extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = isCurrent ? PaletteDark.lightOceanBlue : Colors.transparent;
|
||||
final textColor = isCurrent ? Colors.blue : Colors.white;
|
||||
final color = isCurrent
|
||||
? Theme.of(context).textTheme.subtitle.decorationColor
|
||||
: Theme.of(context).textTheme.display4.decorationColor;
|
||||
final textColor = isCurrent
|
||||
? Theme.of(context).textTheme.subtitle.color
|
||||
: Theme.of(context).textTheme.display4.color;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
|
||||
@@ -14,7 +14,6 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_h
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class ReceivePage extends BasePage {
|
||||
ReceivePage({this.addressListViewModel});
|
||||
@@ -25,10 +24,26 @@ class ReceivePage extends BasePage {
|
||||
String get title => S.current.receive;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => PaletteDark.backgroundColor;
|
||||
Color get backgroundLightColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.backgroundColor;
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Color get titleColor => Colors.white;
|
||||
|
||||
@override
|
||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||
(BuildContext context, Widget scaffold) => Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).accentColor,
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
Theme.of(context).primaryColor,
|
||||
],
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft)),
|
||||
child: scaffold);
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
@@ -66,7 +81,9 @@ class ReceivePage extends BasePage {
|
||||
Observer(
|
||||
builder: (_) => ListView.separated(
|
||||
separatorBuilder: (context, _) =>
|
||||
Container(height: 1, color: PaletteDark.dividerColor),
|
||||
Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor),
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: addressListViewModel.items.length,
|
||||
@@ -83,7 +100,7 @@ class ReceivePage extends BasePage {
|
||||
icon: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).textTheme.display1.color,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -95,7 +112,7 @@ class ReceivePage extends BasePage {
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).textTheme.display1.color,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -105,11 +122,11 @@ class ReceivePage extends BasePage {
|
||||
final isCurrent = item.address ==
|
||||
addressListViewModel.address.address;
|
||||
final backgroundColor = isCurrent
|
||||
? PaletteDark.lightOceanBlue
|
||||
: PaletteDark.nightBlue;
|
||||
? Theme.of(context).textTheme.display3.decorationColor
|
||||
: Theme.of(context).textTheme.display2.decorationColor;
|
||||
final textColor = isCurrent
|
||||
? Colors.blue
|
||||
: Colors.white;
|
||||
? Theme.of(context).textTheme.display3.color
|
||||
: Theme.of(context).textTheme.display2.color;
|
||||
|
||||
return AddressCell.fromItem(item,
|
||||
isCurrent: isCurrent,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class HeaderTile extends StatelessWidget {
|
||||
HeaderTile({
|
||||
@@ -23,7 +22,7 @@ class HeaderTile extends StatelessWidget {
|
||||
top: 24,
|
||||
bottom: 24
|
||||
),
|
||||
color: PaletteDark.nightBlue,
|
||||
color: Theme.of(context).textTheme.display2.decorationColor,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -32,8 +31,8 @@ class HeaderTile extends StatelessWidget {
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.display2.color
|
||||
),
|
||||
),
|
||||
Container(
|
||||
@@ -41,7 +40,7 @@ class HeaderTile extends StatelessWidget {
|
||||
width: 32,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: PaletteDark.distantNightBlue
|
||||
color: Theme.of(context).textTheme.display1.decorationColor
|
||||
),
|
||||
child: icon,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/core/amount_validator.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class QRWidget extends StatelessWidget {
|
||||
QRWidget({
|
||||
@@ -27,7 +26,7 @@ class QRWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final copyImage = Image.asset('assets/images/copy_address.png',
|
||||
color: PaletteDark.lightBlueGrey);
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor);
|
||||
final addressTopOffset = isAmountFieldShow ? 60.0 : 40.0;
|
||||
|
||||
return Column(
|
||||
@@ -45,7 +44,7 @@ class QRWidget extends StatelessWidget {
|
||||
child: QrImage(
|
||||
data: addressListViewModel.uri.toString(),
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: PaletteDark.lightBlueGrey,
|
||||
foregroundColor: Theme.of(context).textTheme.headline.color,
|
||||
))))),
|
||||
Spacer(flex: 3)
|
||||
]),
|
||||
@@ -56,7 +55,7 @@ class QRWidget extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: PaletteDark.cyanBlue
|
||||
color: Theme.of(context).indicatorColor
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -79,13 +78,14 @@ class QRWidget extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
hintText: S.of(context).receive_amount,
|
||||
textColor: Colors.white,
|
||||
borderColor: PaletteDark.darkGrey,
|
||||
borderColor: Theme.of(context).textTheme.headline.decorationColor,
|
||||
validator: AmountValidator(
|
||||
type: addressListViewModel.type
|
||||
type: addressListViewModel.type,
|
||||
isAutovalidate: true
|
||||
),
|
||||
autovalidate: true,
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: PaletteDark.cyanBlue,
|
||||
color: Theme.of(context).hoverColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500))))
|
||||
],
|
||||
|
||||
+540
-520
File diff suppressed because it is too large
Load Diff
@@ -1,277 +1,47 @@
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
import 'package:cake_wallet/src/stores/balance/balance_store.dart';
|
||||
import 'package:cake_wallet/src/stores/send/send_store.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/top_panel.dart';
|
||||
import 'package:cake_wallet/src/stores/send_template/send_template_store.dart';
|
||||
import 'package:cake_wallet/view_model/send_view_model.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/base_send_widget.dart';
|
||||
|
||||
class SendTemplatePage extends BasePage {
|
||||
@override
|
||||
String get title => S.current.send_title;
|
||||
SendTemplatePage({@required this.sendViewModel});
|
||||
|
||||
final SendViewModel sendViewModel;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => Palette.lavender;
|
||||
String get title => S.current.exchange_new_template;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.lightNightBlue;
|
||||
Color get titleColor => Colors.white;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => Colors.transparent;
|
||||
|
||||
@override
|
||||
bool get resizeToAvoidBottomPadding => false;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => SendTemplateForm();
|
||||
}
|
||||
|
||||
class SendTemplateForm extends StatefulWidget {
|
||||
@override
|
||||
SendTemplateFormState createState() => SendTemplateFormState();
|
||||
}
|
||||
|
||||
class SendTemplateFormState extends State<SendTemplateForm> {
|
||||
final _nameController = TextEditingController();
|
||||
final _addressController = TextEditingController();
|
||||
final _cryptoAmountController = TextEditingController();
|
||||
final _fiatAmountController = TextEditingController();
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
bool _effectsInstalled = false;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
_addressController.dispose();
|
||||
_cryptoAmountController.dispose();
|
||||
_fiatAmountController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
Widget body(BuildContext context) =>
|
||||
BaseSendWidget(
|
||||
sendViewModel: sendViewModel,
|
||||
leading: leading(context),
|
||||
middle: middle(context),
|
||||
isTemplate: true
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settingsStore = Provider.of<SettingsStore>(context);
|
||||
final balanceStore = Provider.of<BalanceStore>(context);
|
||||
final sendStore = Provider.of<SendStore>(context);
|
||||
sendStore.settingsStore = settingsStore;
|
||||
final sendTemplateStore = Provider.of<SendTemplateStore>(context);
|
||||
|
||||
_setEffects(context);
|
||||
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
TopPanel(
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
widget: Form(
|
||||
key: _formKey,
|
||||
child: Column(children: <Widget>[
|
||||
TextFormField(
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
hintText: S.of(context).send_name,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0))),
|
||||
validator: (value) {
|
||||
sendTemplateStore.validateTemplate(value);
|
||||
return sendTemplateStore.errorMessage;
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: AddressTextField(
|
||||
controller: _addressController,
|
||||
placeholder: S.of(context).send_monero_address,
|
||||
onURIScanned: (uri) {
|
||||
var address = '';
|
||||
var amount = '';
|
||||
|
||||
if (uri != null) {
|
||||
address = uri.path;
|
||||
amount = uri.queryParameters['tx_amount'];
|
||||
} else {
|
||||
address = uri.toString();
|
||||
}
|
||||
|
||||
_addressController.text = address;
|
||||
_cryptoAmountController.text = amount;
|
||||
},
|
||||
options: [
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
buttonColor: Theme.of(context).accentTextTheme.title.color,
|
||||
validator: (value) {
|
||||
sendTemplateStore.validateTemplate(value);
|
||||
return sendTemplateStore.errorMessage;
|
||||
},
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: TextFormField(
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
controller: _cryptoAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: Text('XMR:',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
)),
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
hintText: '0.0000',
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0))),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: TextFormField(
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
controller: _fiatAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: Text(
|
||||
'${settingsStore.fiatCurrency.toString()}:',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
)),
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color),
|
||||
hintText: '0.00',
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1.0)))),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: PrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
sendTemplateStore.addTemplate(
|
||||
name: _nameController.text,
|
||||
address: _addressController.text,
|
||||
cryptoCurrency: 'XMR',
|
||||
amount: _cryptoAmountController.text
|
||||
);
|
||||
sendTemplateStore.update();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white
|
||||
),
|
||||
),
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
||||
body: Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: body(context)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
if (_effectsInstalled) {
|
||||
return;
|
||||
}
|
||||
|
||||
final sendStore = Provider.of<SendStore>(context);
|
||||
|
||||
reaction((_) => sendStore.fiatAmount, (String amount) {
|
||||
if (amount != _fiatAmountController.text) {
|
||||
_fiatAmountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => sendStore.cryptoAmount, (String amount) {
|
||||
if (amount != _cryptoAmountController.text) {
|
||||
_cryptoAmountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
_fiatAmountController.addListener(() {
|
||||
final fiatAmount = _fiatAmountController.text;
|
||||
|
||||
if (sendStore.fiatAmount != fiatAmount) {
|
||||
sendStore.changeFiatAmount(fiatAmount);
|
||||
}
|
||||
});
|
||||
|
||||
_cryptoAmountController.addListener(() {
|
||||
final cryptoAmount = _cryptoAmountController.text;
|
||||
|
||||
if (sendStore.cryptoAmount != cryptoAmount) {
|
||||
sendStore.changeCryptoAmount(cryptoAmount);
|
||||
}
|
||||
});
|
||||
|
||||
_effectsInstalled = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/send_view_model.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/address_text_field.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/widgets/top_panel.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart';
|
||||
import 'package:cake_wallet/src/widgets/template_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
|
||||
class BaseSendWidget extends StatelessWidget {
|
||||
BaseSendWidget({
|
||||
@required this.sendViewModel,
|
||||
@required this.leading,
|
||||
@required this.middle,
|
||||
this.isTemplate = false
|
||||
});
|
||||
|
||||
final SendViewModel sendViewModel;
|
||||
final bool isTemplate;
|
||||
final Widget leading;
|
||||
final Widget middle;
|
||||
|
||||
final _addressController = TextEditingController();
|
||||
final _cryptoAmountController = TextEditingController();
|
||||
final _fiatAmountController = TextEditingController();
|
||||
final _nameController = TextEditingController();
|
||||
final _focusNode = FocusNode();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
bool _effectsInstalled = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
_setEffects(context);
|
||||
|
||||
return ScrollableWithBottomSection(
|
||||
contentPadding: EdgeInsets.only(bottom: 24),
|
||||
content: Column(
|
||||
children: <Widget>[
|
||||
TopPanel(
|
||||
edgeInsets: EdgeInsets.all(0),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).primaryTextTheme.subhead.color,
|
||||
Theme.of(context).primaryTextTheme.subhead.decorationColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight),
|
||||
widget: Form(
|
||||
key: _formKey,
|
||||
child: Column(children: <Widget>[
|
||||
CupertinoNavigationBar(
|
||||
leading: leading,
|
||||
middle: middle,
|
||||
backgroundColor: Colors.transparent,
|
||||
border: null,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(24, 24, 24, 32),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
isTemplate
|
||||
? BaseTextFormField(
|
||||
controller: _nameController,
|
||||
hintText: S.of(context).send_name,
|
||||
borderColor: Theme.of(context).primaryTextTheme.headline.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
validator: sendViewModel.templateValidator,
|
||||
)
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: isTemplate ? 20 : 0),
|
||||
child: AddressTextField(
|
||||
controller: _addressController,
|
||||
placeholder: S.of(context).send_address(
|
||||
sendViewModel.cryptoCurrencyTitle),
|
||||
focusNode: _focusNode,
|
||||
onURIScanned: (uri) {
|
||||
var address = '';
|
||||
var amount = '';
|
||||
|
||||
if (uri != null) {
|
||||
address = uri.path;
|
||||
amount = uri.queryParameters['tx_amount'];
|
||||
} else {
|
||||
address = uri.toString();
|
||||
}
|
||||
|
||||
_addressController.text = address;
|
||||
_cryptoAmountController.text = amount;
|
||||
},
|
||||
options: [
|
||||
AddressTextFieldOption.paste,
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
buttonColor: Theme.of(context).primaryTextTheme.display1.color,
|
||||
borderColor: Theme.of(context).primaryTextTheme.headline.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.headline.decorationColor
|
||||
),
|
||||
validator: sendViewModel.addressValidator,
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
controller: _cryptoAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 9),
|
||||
child: Text(sendViewModel.currency.title + ':',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
suffixIcon: isTemplate
|
||||
? Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(bottom: 2),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width/2,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
' / ' + sendViewModel.balance,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).primaryTextTheme.headline.decorationColor
|
||||
)
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 34,
|
||||
width: 34,
|
||||
margin: EdgeInsets.only(left: 12, bottom: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryTextTheme.display1.color,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6))
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () => sendViewModel.setSendAll(),
|
||||
child: Center(
|
||||
child: Text(S.of(context).all,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
hintText: '0.0000',
|
||||
borderColor: Theme.of(context).primaryTextTheme.headline.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
validator: sendViewModel.amountValidator
|
||||
)
|
||||
);
|
||||
}
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
controller: _fiatAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 9),
|
||||
child: Text(
|
||||
sendViewModel.fiat.title + ':',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
hintText: '0.00',
|
||||
borderColor: Theme.of(context).primaryTextTheme.headline.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
)
|
||||
),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(S.of(context).send_estimated_fee,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white
|
||||
)),
|
||||
Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
sendViewModel.estimatedFee.toString() + ' '
|
||||
+ sendViewModel.currency.title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Colors.white,),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30,
|
||||
left: 24,
|
||||
bottom: 24
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).send_templates,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.display4.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
isTemplate
|
||||
? Offstage()
|
||||
: Container(
|
||||
height: 40,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(context)
|
||||
.pushNamed(Routes.sendTemplate),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 1, right: 10),
|
||||
child: DottedBorder(
|
||||
borderType: BorderType.RRect,
|
||||
dashPattern: [6, 4],
|
||||
color: Theme.of(context).primaryTextTheme.display2.decorationColor,
|
||||
strokeWidth: 2,
|
||||
radius: Radius.circular(20),
|
||||
child: Container(
|
||||
height: 34,
|
||||
width: 75,
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Text(
|
||||
S.of(context).send_new,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.display3.color
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
final templates = sendViewModel.templates;
|
||||
final itemCount = templates.length;
|
||||
|
||||
return ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
final template = templates[index];
|
||||
|
||||
return TemplateTile(
|
||||
key: UniqueKey(),
|
||||
to: template.name,
|
||||
amount: template.amount,
|
||||
from: template.cryptoCurrency,
|
||||
onTap: () {
|
||||
_addressController.text = template.address;
|
||||
_cryptoAmountController.text = template.amount;
|
||||
getOpenaliasRecord(context);
|
||||
},
|
||||
onRemove: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).template,
|
||||
alertContent: S.of(context).confirm_delete_template,
|
||||
leftButtonText: S.of(context).delete,
|
||||
rightButtonText: S.of(context).cancel,
|
||||
actionLeftButton: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
sendViewModel.sendTemplateStore.remove(template: template);
|
||||
sendViewModel.sendTemplateStore.update();
|
||||
},
|
||||
actionRightButton: () => Navigator.of(dialogContext).pop()
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: isTemplate
|
||||
? PrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
sendViewModel.sendTemplateStore.addTemplate(
|
||||
name: _nameController.text,
|
||||
address: _addressController.text,
|
||||
cryptoCurrency: sendViewModel.currency.title,
|
||||
amount: _cryptoAmountController.text
|
||||
);
|
||||
sendViewModel.sendTemplateStore.update();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
text: S.of(context).save,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white)
|
||||
: Observer(builder: (_) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
print('SENT!!!');
|
||||
}
|
||||
},
|
||||
text: S.of(context).send,
|
||||
color: Palette.blueCraiola,
|
||||
textColor: Colors.white,
|
||||
isLoading: sendViewModel.state is TransactionIsCreating ||
|
||||
sendViewModel.state is TransactionCommitting,
|
||||
isDisabled:
|
||||
false // FIXME !(syncStore.status is SyncedSyncStatus),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
void _setEffects(BuildContext context) {
|
||||
if (_effectsInstalled) {
|
||||
return;
|
||||
}
|
||||
|
||||
reaction((_) => sendViewModel.fiatAmount, (String amount) {
|
||||
if (amount != _fiatAmountController.text) {
|
||||
_fiatAmountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => sendViewModel.cryptoAmount, (String amount) {
|
||||
if (amount != _cryptoAmountController.text) {
|
||||
_cryptoAmountController.text = amount;
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => sendViewModel.address, (String address) {
|
||||
if (address != _addressController.text) {
|
||||
_addressController.text = address;
|
||||
}
|
||||
});
|
||||
|
||||
_addressController.addListener(() {
|
||||
final address = _addressController.text;
|
||||
|
||||
if (sendViewModel.address != address) {
|
||||
sendViewModel.changeAddress(address);
|
||||
}
|
||||
});
|
||||
|
||||
_fiatAmountController.addListener(() {
|
||||
final fiatAmount = _fiatAmountController.text;
|
||||
|
||||
if (sendViewModel.fiatAmount != fiatAmount) {
|
||||
sendViewModel.changeFiatAmount(fiatAmount);
|
||||
}
|
||||
});
|
||||
|
||||
_cryptoAmountController.addListener(() {
|
||||
final cryptoAmount = _cryptoAmountController.text;
|
||||
|
||||
if (sendViewModel.cryptoAmount != cryptoAmount) {
|
||||
sendViewModel.changeCryptoAmount(cryptoAmount);
|
||||
}
|
||||
});
|
||||
|
||||
_focusNode.addListener(() {
|
||||
if (!_focusNode.hasFocus && _addressController.text.isNotEmpty) {
|
||||
getOpenaliasRecord(context);
|
||||
}
|
||||
});
|
||||
|
||||
reaction((_) => sendViewModel.state, (SendViewModelState state) {
|
||||
if (state is SendingFailed) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).error),
|
||||
content: Text(state.error),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(S.of(context).ok),
|
||||
onPressed: () => Navigator.of(context).pop())
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (state is TransactionCreatedSuccessfully) {
|
||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ConfirmSendingAlert(
|
||||
// alertTitle: S.of(context).confirm_sending,
|
||||
// amount: S.of(context).send_amount,
|
||||
// amountValue: sendStore.pendingTransaction.amount,
|
||||
// fee: S.of(context).send_fee,
|
||||
// feeValue: sendStore.pendingTransaction.fee,
|
||||
// leftButtonText: S.of(context).ok,
|
||||
// rightButtonText: S.of(context).cancel,
|
||||
// actionLeftButton: () {
|
||||
// Navigator.of(context).pop();
|
||||
// sendStore.commitTransaction();
|
||||
// showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return SendingAlert(sendStore: sendStore);
|
||||
// });
|
||||
// },
|
||||
// actionRightButton: () => Navigator.of(context).pop());
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_addressController.text = '';
|
||||
_cryptoAmountController.text = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
_effectsInstalled = true;
|
||||
}
|
||||
|
||||
Future<void> getOpenaliasRecord(BuildContext context) async {
|
||||
final isOpenalias = await sendViewModel.isOpenaliasRecord(_addressController.text);
|
||||
|
||||
if (isOpenalias) {
|
||||
_addressController.text = sendViewModel.recordAddress;
|
||||
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).openalias_alert_title,
|
||||
alertContent: S.of(context).openalias_alert_content(sendViewModel.recordName),
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop()
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import 'package:cake_wallet/core/address_label_validator.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class AddressEditOrCreatePage extends BasePage {
|
||||
AddressEditOrCreatePage({@required this.addressEditOrCreateViewModel})
|
||||
@@ -29,12 +28,6 @@ class AddressEditOrCreatePage extends BasePage {
|
||||
@override
|
||||
String get title => S.current.new_subaddress_title;
|
||||
|
||||
@override
|
||||
Color get backgroundLightColor => PaletteDark.backgroundColor;
|
||||
|
||||
@override
|
||||
Color get backgroundDarkColor => PaletteDark.backgroundColor;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
reaction((_) => addressEditOrCreateViewModel.state,
|
||||
@@ -55,7 +48,6 @@ class AddressEditOrCreatePage extends BasePage {
|
||||
child: Center(
|
||||
child: BaseTextFormField(
|
||||
controller: _labelController,
|
||||
textColor: Colors.white,
|
||||
hintText: S.of(context).new_subaddress_label_name,
|
||||
validator: AddressLabelValidator()))),
|
||||
Observer(
|
||||
|
||||
@@ -24,7 +24,6 @@ class TradeDetailsPage extends BasePage {
|
||||
formatDefault: "dd.MM.yyyy, HH:mm");
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: Observer(builder: (_) {
|
||||
final trade = exchangeStore.trade;
|
||||
final items = [
|
||||
@@ -59,17 +58,15 @@ class TradeDetailsPage extends BasePage {
|
||||
separatorBuilder: (_, __) => Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
),
|
||||
),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final item = items[index];
|
||||
|
||||
final isDrawTop = index == 0 ? true : false;
|
||||
final isDrawBottom = index == items.length - 1 ? true : false;
|
||||
|
||||
return GestureDetector(
|
||||
@@ -87,7 +84,6 @@ class TradeDetailsPage extends BasePage {
|
||||
child: StandartListRow(
|
||||
title: '${item.title}',
|
||||
value: '${item.value}',
|
||||
isDrawTop: isDrawTop,
|
||||
isDrawBottom: isDrawBottom,
|
||||
));
|
||||
});
|
||||
|
||||
@@ -73,22 +73,19 @@ class TransactionDetailsPage extends BasePage {
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (context, index) => Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
),
|
||||
),
|
||||
itemCount: _items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = _items[index];
|
||||
|
||||
final isDrawTop = index == 0 ? true : false;
|
||||
final isDrawBottom = index == _items.length - 1 ? true : false;
|
||||
|
||||
return GestureDetector(
|
||||
@@ -106,7 +103,6 @@ class TransactionDetailsPage extends BasePage {
|
||||
child: StandartListRow(
|
||||
title: '${item.title}:',
|
||||
value: item.value,
|
||||
isDrawTop: isDrawTop,
|
||||
isDrawBottom: isDrawBottom),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -37,11 +37,14 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
final bitcoinIcon =
|
||||
Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
|
||||
final scrollController = ScrollController();
|
||||
final double tileHeight = 60;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final newWalletImage = Image.asset('assets/images/new_wallet.png',
|
||||
height: 12, width: 12, color: Palette.oceanBlue);
|
||||
height: 12,
|
||||
width: 12,
|
||||
color: Theme.of(context).accentTextTheme.headline.decorationColor);
|
||||
final restoreWalletImage = Image.asset('assets/images/restore_wallet.png',
|
||||
height: 12,
|
||||
width: 12,
|
||||
@@ -58,7 +61,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
separatorBuilder: (_, index) => Divider(
|
||||
color: Theme.of(context).backgroundColor, height: 16),
|
||||
color: Theme.of(context).backgroundColor, height: 32),
|
||||
itemCount: widget.walletListViewModel.wallets.length,
|
||||
itemBuilder: (__, index) {
|
||||
final wallet = widget.walletListViewModel.wallets[index];
|
||||
@@ -72,7 +75,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
.generateImagesForWalletMenu(wallet.isCurrent);
|
||||
|
||||
return Container(
|
||||
height: 108,
|
||||
height: tileHeight,
|
||||
width: double.infinity,
|
||||
child: CustomScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -82,7 +85,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
pinned: false,
|
||||
floating: true,
|
||||
delegate: WalletTile(
|
||||
min: screenWidth - 228,
|
||||
min: screenWidth - 170,
|
||||
max: screenWidth,
|
||||
image: _imageFor(type: wallet.type),
|
||||
walletName: wallet.name,
|
||||
@@ -93,10 +96,11 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((context, index) {
|
||||
final item = items[index];
|
||||
final color = colors[index];
|
||||
final image = images[index];
|
||||
final firstColor = colors[index*2];
|
||||
final secondColor = colors[index*2 + 1];
|
||||
|
||||
final radius = index == 0 ? 12.0 : 0.0;
|
||||
final radius = index == 0 ? 10.0 : 0.0;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
@@ -109,8 +113,8 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
wallet.isCurrent);
|
||||
},
|
||||
child: Container(
|
||||
height: 108,
|
||||
width: 108,
|
||||
height: tileHeight,
|
||||
width: 80,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 5),
|
||||
@@ -118,18 +122,27 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(radius),
|
||||
bottomLeft: Radius.circular(radius)),
|
||||
color: color),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
firstColor,
|
||||
secondColor
|
||||
]
|
||||
)
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(height: 5),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
item,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontSize: 7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white),
|
||||
)
|
||||
],
|
||||
@@ -151,9 +164,8 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
Navigator.of(context).pushNamed(Routes.newWalletType),
|
||||
image: newWalletImage,
|
||||
text: S.of(context).wallet_list_create_new_wallet,
|
||||
color: Colors.white,
|
||||
textColor: Palette.oceanBlue,
|
||||
borderColor: Palette.oceanBlue,
|
||||
color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
|
||||
textColor: Theme.of(context).accentTextTheme.headline.decorationColor,
|
||||
),
|
||||
SizedBox(height: 10.0),
|
||||
PrimaryImageButton(
|
||||
@@ -161,7 +173,7 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
.pushNamed(Routes.restoreWalletType),
|
||||
image: restoreWalletImage,
|
||||
text: S.of(context).wallet_list_restore_wallet,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color,
|
||||
color: Theme.of(context).accentTextTheme.caption.color,
|
||||
textColor: Theme.of(context).primaryTextTheme.title.color)
|
||||
])),
|
||||
));
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/stores/wallet_list/wallet_list_store.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class WalletMenu {
|
||||
WalletMenu(this.context, this.walletListViewModel);
|
||||
@@ -20,18 +21,25 @@ class WalletMenu {
|
||||
S.current.rescan
|
||||
];
|
||||
|
||||
final List<Color> listColors = [
|
||||
Colors.blue,
|
||||
Colors.orange,
|
||||
Colors.red,
|
||||
Colors.green
|
||||
final List<Color> firstColors = [
|
||||
Palette.cornflower,
|
||||
Palette.moderateOrangeYellow,
|
||||
Palette.lightRed,
|
||||
Palette.shineGreen
|
||||
];
|
||||
|
||||
final List<Color> secondColors = [
|
||||
Palette.royalBlue,
|
||||
Palette.moderateOrange,
|
||||
Palette.persianRed,
|
||||
Palette.moderateGreen
|
||||
];
|
||||
|
||||
final List<Image> listImages = [
|
||||
Image.asset('assets/images/load.png', height: 32, width: 32, color: Colors.white),
|
||||
Image.asset('assets/images/eye_action.png', height: 32, width: 32, color: Colors.white),
|
||||
Image.asset('assets/images/trash.png', height: 32, width: 32, color: Colors.white),
|
||||
Image.asset('assets/images/scanner.png', height: 32, width: 32, color: Colors.white)
|
||||
Image.asset('assets/images/load.png', height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/eye_action.png', height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/trash.png', height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/scanner.png', height: 24, width: 24, color: Colors.white)
|
||||
];
|
||||
|
||||
List<String> generateItemsForWalletMenu(bool isCurrentWallet) {
|
||||
@@ -46,18 +54,30 @@ class WalletMenu {
|
||||
}
|
||||
|
||||
List<Color> generateColorsForWalletMenu(bool isCurrentWallet) {
|
||||
final colors = List<Color>();
|
||||
final colors = <Color>[];
|
||||
|
||||
if (!isCurrentWallet) colors.add(listColors[0]);
|
||||
if (isCurrentWallet) colors.add(listColors[1]);
|
||||
if (!isCurrentWallet) colors.add(listColors[2]);
|
||||
if (isCurrentWallet) colors.add(listColors[3]);
|
||||
if (!isCurrentWallet) {
|
||||
colors.add(firstColors[0]);
|
||||
colors.add(secondColors[0]);
|
||||
}
|
||||
if (isCurrentWallet) {
|
||||
colors.add(firstColors[1]);
|
||||
colors.add(secondColors[1]);
|
||||
}
|
||||
if (!isCurrentWallet) {
|
||||
colors.add(firstColors[2]);
|
||||
colors.add(secondColors[2]);
|
||||
}
|
||||
if (isCurrentWallet) {
|
||||
colors.add(firstColors[3]);
|
||||
colors.add(secondColors[3]);
|
||||
}
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
List<Image> generateImagesForWalletMenu(bool isCurrentWallet) {
|
||||
final images = List<Image>();
|
||||
final images = <Image>[];
|
||||
|
||||
if (!isCurrentWallet) images.add(listImages[0]);
|
||||
if (isCurrentWallet) images.add(listImages[1]);
|
||||
|
||||
@@ -17,17 +17,18 @@ class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
final String walletName;
|
||||
final String walletAddress;
|
||||
final bool isCurrent;
|
||||
final double tileHeight = 60;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
var opacity = 1 - shrinkOffset / (max - min);
|
||||
opacity = opacity >= 0 ? opacity : 0;
|
||||
|
||||
var panelWidth = 12 * opacity;
|
||||
panelWidth = panelWidth < 12 ? 0 : 12;
|
||||
var panelWidth = 10 * opacity;
|
||||
panelWidth = panelWidth < 10 ? 0 : 10;
|
||||
|
||||
final currentColor = isCurrent
|
||||
? Theme.of(context).accentTextTheme.caption.color
|
||||
? Theme.of(context).accentTextTheme.subtitle.decorationColor
|
||||
: Theme.of(context).backgroundColor;
|
||||
|
||||
return Stack(
|
||||
@@ -38,7 +39,7 @@ class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
top: 0,
|
||||
right: max - 4,
|
||||
child: Container(
|
||||
height: 108,
|
||||
height: tileHeight,
|
||||
width: 4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
|
||||
@@ -48,13 +49,30 @@ class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 12,
|
||||
right: 10,
|
||||
child: Container(
|
||||
height: 108,
|
||||
width: max - 16,
|
||||
height: tileHeight,
|
||||
width: max - 14,
|
||||
padding: EdgeInsets.only(left: 20, right: 20),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
//mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
walletName,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
/*Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
@@ -92,7 +110,7 @@ class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
),
|
||||
),*/
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
@@ -101,29 +119,18 @@ class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
child: Opacity(
|
||||
opacity: opacity,
|
||||
child: Container(
|
||||
height: 108,
|
||||
height: tileHeight,
|
||||
width: panelWidth,
|
||||
padding: EdgeInsets.only(
|
||||
top: 1,
|
||||
left: 1,
|
||||
bottom: 1
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(12), bottomLeft: Radius.circular(12)),
|
||||
color: Theme.of(context).accentTextTheme.subtitle.color
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(12), bottomLeft: Radius.circular(12)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Theme.of(context).accentTextTheme.caption.backgroundColor,
|
||||
Theme.of(context).accentTextTheme.caption.decorationColor
|
||||
]
|
||||
)
|
||||
),
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Theme.of(context).accentTextTheme.headline.color,
|
||||
Theme.of(context).accentTextTheme.headline.backgroundColor
|
||||
]
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/domain/common/contact.dart';
|
||||
import 'package:cake_wallet/src/domain/monero/subaddress.dart';
|
||||
import 'package:cake_wallet/src/domain/common/qr_scanner.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
enum AddressTextFieldOption { qrCode, addressBook, subaddressList }
|
||||
enum AddressTextFieldOption { paste, qrCode, addressBook, subaddressList }
|
||||
|
||||
class AddressTextField extends StatelessWidget {
|
||||
AddressTextField(
|
||||
{@required this.controller,
|
||||
this.isActive = true,
|
||||
this.placeholder,
|
||||
this.options = const [
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
this.onURIScanned,
|
||||
this.focusNode,
|
||||
this.isBorderExist = true,
|
||||
this.buttonColor,
|
||||
this.validator});
|
||||
this.isActive = true,
|
||||
this.placeholder,
|
||||
this.options = const [
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
this.onURIScanned,
|
||||
this.focusNode,
|
||||
this.isBorderExist = true,
|
||||
this.buttonColor,
|
||||
this.borderColor,
|
||||
this.textStyle,
|
||||
this.hintStyle,
|
||||
this.validator});
|
||||
|
||||
static const prefixIconWidth = 34.0;
|
||||
static const prefixIconHeight = 34.0;
|
||||
@@ -34,6 +39,9 @@ class AddressTextField extends StatelessWidget {
|
||||
final FormFieldValidator<String> validator;
|
||||
final bool isBorderExist;
|
||||
final Color buttonColor;
|
||||
final Color borderColor;
|
||||
final TextStyle textStyle;
|
||||
final TextStyle hintStyle;
|
||||
FocusNode focusNode;
|
||||
|
||||
@override
|
||||
@@ -45,106 +53,133 @@ class AddressTextField extends StatelessWidget {
|
||||
enabled: isActive,
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
style: TextStyle(
|
||||
style: textStyle ?? TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
color: Colors.white
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: SizedBox(
|
||||
width: prefixIconWidth * options.length +
|
||||
(spaceBetweenPrefixIcons * options.length),
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
hintStyle: hintStyle ?? TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
color: PaletteDark.darkCyanBlue
|
||||
),
|
||||
hintText: placeholder ?? S.current.widgets_address,
|
||||
focusedBorder: isBorderExist
|
||||
? UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).dividerColor,
|
||||
color: borderColor ?? Theme.of(context).dividerColor,
|
||||
width: 1.0))
|
||||
: InputBorder.none,
|
||||
disabledBorder: isBorderExist
|
||||
? UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Theme.of(context).dividerColor, width: 1.0))
|
||||
BorderSide(color: borderColor ?? Theme.of(context).dividerColor, width: 1.0))
|
||||
: InputBorder.none,
|
||||
enabledBorder: isBorderExist
|
||||
? UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Theme.of(context).dividerColor, width: 1.0))
|
||||
BorderSide(color: borderColor ?? Theme.of(context).dividerColor, width: 1.0))
|
||||
: InputBorder.none,
|
||||
),
|
||||
validator: validator,
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: prefixIconWidth * options.length +
|
||||
(spaceBetweenPrefixIcons * options.length),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
if (this.options.contains(AddressTextFieldOption.qrCode)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presentQRScanner(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset('assets/images/qr_code_icon.png')),
|
||||
))
|
||||
top: 2,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: prefixIconWidth * options.length +
|
||||
(spaceBetweenPrefixIcons * options.length),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
if (this
|
||||
.options
|
||||
.contains(AddressTextFieldOption.paste)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _pasteAddress(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/duplicate.png',
|
||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||
)),
|
||||
)),
|
||||
],
|
||||
if (this.options.contains(AddressTextFieldOption.qrCode)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presentQRScanner(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset('assets/images/qr_code_icon.png',
|
||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||
)),
|
||||
))
|
||||
],
|
||||
if (this
|
||||
.options
|
||||
.contains(AddressTextFieldOption.addressBook)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presetAddressBookPicker(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/open_book.png',
|
||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||
)),
|
||||
))
|
||||
],
|
||||
if (this
|
||||
.options
|
||||
.contains(AddressTextFieldOption.subaddressList)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presetSubaddressListPicker(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/receive_icon_raw.png',
|
||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||
)),
|
||||
)),
|
||||
],
|
||||
],
|
||||
if (this
|
||||
.options
|
||||
.contains(AddressTextFieldOption.addressBook)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presetAddressBookPicker(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/open_book.png')),
|
||||
))
|
||||
],
|
||||
if (this
|
||||
.options
|
||||
.contains(AddressTextFieldOption.subaddressList)) ...[
|
||||
Container(
|
||||
width: prefixIconWidth,
|
||||
height: prefixIconHeight,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: InkWell(
|
||||
onTap: () async => _presetSubaddressListPicker(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/receive_icon_raw.png')),
|
||||
))
|
||||
],
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
@@ -189,4 +224,14 @@ class AddressTextField extends StatelessWidget {
|
||||
controller.text = subaddress.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pasteAddress(BuildContext context) async {
|
||||
String address;
|
||||
|
||||
await Clipboard.getData('text/plain').then((value) => address = value.text);
|
||||
|
||||
if (address.isNotEmpty) {
|
||||
controller.text = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class AlertWithOneAction extends BaseAlertDialog {
|
||||
AlertWithOneAction({
|
||||
@@ -31,13 +32,7 @@ class AlertWithOneAction extends BaseAlertDialog {
|
||||
width: 300,
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)
|
||||
),
|
||||
color: Colors.white
|
||||
),
|
||||
color: Palette.blueCraiola,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
@@ -50,7 +45,7 @@ class AlertWithOneAction extends BaseAlertDialog {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.blue,
|
||||
color: Colors.white,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -17,6 +17,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
decoration: TextDecoration.none,
|
||||
@@ -30,7 +31,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Poppins',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
@@ -38,55 +39,39 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget actionButtons(BuildContext context) {
|
||||
return Container(
|
||||
width: 300,
|
||||
height: 52,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)
|
||||
),
|
||||
color: Colors.white
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24)),
|
||||
),
|
||||
color: Palette.blueCraiola,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
onPressed: actionLeft,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
child: Text(
|
||||
leftActionButtonText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.blue,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
onPressed: actionLeft,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
child: Text(
|
||||
leftActionButtonText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
),
|
||||
)
|
||||
),
|
||||
Container(
|
||||
height: 52,
|
||||
width: 1,
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
),
|
||||
Flexible(
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(bottomRight: Radius.circular(24)),
|
||||
),
|
||||
color: Palette.alizarinRed,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
@@ -98,16 +83,16 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.red,
|
||||
color: Colors.white,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -126,44 +111,30 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
child: Center(
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: Container(
|
||||
width: 300,
|
||||
height: 257,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24)),
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 300,
|
||||
height: 77,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(24),
|
||||
topRight: Radius.circular(24)
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
child: Container(
|
||||
width: 300,
|
||||
color: Theme.of(context).accentTextTheme.title.decorationColor,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(24, 32, 24, 32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
title(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: content(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: title(context),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 300,
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
Container(
|
||||
width: 300,
|
||||
height: 127,
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Center(
|
||||
child: content(context),
|
||||
),
|
||||
),
|
||||
actionButtons(context)
|
||||
],
|
||||
actionButtons(context)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,11 +15,14 @@ class BaseTextFormField extends StatelessWidget {
|
||||
this.hintColor,
|
||||
this.borderColor,
|
||||
this.prefix,
|
||||
this.prefixIcon,
|
||||
this.suffix,
|
||||
this.suffixIcon,
|
||||
this.enabled = true,
|
||||
this.validator,
|
||||
this.placeholderTextStyle});
|
||||
this.textStyle,
|
||||
this.placeholderTextStyle,
|
||||
this.maxLength});
|
||||
|
||||
final TextEditingController controller;
|
||||
final TextInputType keyboardType;
|
||||
@@ -33,11 +36,14 @@ class BaseTextFormField extends StatelessWidget {
|
||||
final Color hintColor;
|
||||
final Color borderColor;
|
||||
final Widget prefix;
|
||||
final Widget prefixIcon;
|
||||
final Widget suffix;
|
||||
final Widget suffixIcon;
|
||||
final bool enabled;
|
||||
final FormFieldValidator<String> validator;
|
||||
final TextStyle placeholderTextStyle;
|
||||
final TextStyle textStyle;
|
||||
final int maxLength;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -50,26 +56,31 @@ class BaseTextFormField extends StatelessWidget {
|
||||
maxLines: maxLines,
|
||||
inputFormatters: inputFormatters,
|
||||
enabled: enabled,
|
||||
style: TextStyle(
|
||||
maxLength: maxLength,
|
||||
style: textStyle ?? TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: textColor ?? Theme.of(context).primaryTextTheme.title.color),
|
||||
decoration: InputDecoration(
|
||||
prefix: prefix,
|
||||
prefixIcon: prefixIcon,
|
||||
suffix: suffix,
|
||||
suffixIcon: suffixIcon,
|
||||
hintStyle: placeholderTextStyle ??
|
||||
TextStyle(
|
||||
color: hintColor ??
|
||||
Theme.of(context).primaryTextTheme.caption.color,
|
||||
color: hintColor ?? Theme.of(context).hintColor,
|
||||
fontSize: 16),
|
||||
hintText: hintText,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? Theme.of(context).dividerColor,
|
||||
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
width: 1.0)),
|
||||
disabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
width: 1.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? Theme.of(context).dividerColor,
|
||||
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
width: 1.0))),
|
||||
validator: validator,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class CakeScrollbar extends StatelessWidget {
|
||||
CakeScrollbar({
|
||||
@@ -20,7 +19,7 @@ class CakeScrollbar extends StatelessWidget {
|
||||
height: backgroundHeight,
|
||||
width: 6,
|
||||
decoration: BoxDecoration(
|
||||
color: PaletteDark.violetBlue,
|
||||
color: Theme.of(context).textTheme.body1.decorationColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(3))
|
||||
),
|
||||
child: Stack(
|
||||
@@ -32,7 +31,7 @@ class CakeScrollbar extends StatelessWidget {
|
||||
height: thumbHeight,
|
||||
width: 6.0,
|
||||
decoration: BoxDecoration(
|
||||
color: PaletteDark.wildBlueGrey,
|
||||
color: Theme.of(context).textTheme.body1.color,
|
||||
borderRadius: BorderRadius.all(Radius.circular(3))
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CheckboxWidget extends StatefulWidget {
|
||||
CheckboxWidget({
|
||||
@required this.value,
|
||||
@required this.caption,
|
||||
@required this.onChanged});
|
||||
|
||||
final bool value;
|
||||
final String caption;
|
||||
final Function(bool) onChanged;
|
||||
|
||||
@override
|
||||
CheckboxWidgetState createState() => CheckboxWidgetState(value, caption, onChanged);
|
||||
}
|
||||
|
||||
class CheckboxWidgetState extends State<CheckboxWidget> {
|
||||
CheckboxWidgetState(this.value, this.caption, this.onChanged);
|
||||
|
||||
bool value;
|
||||
String caption;
|
||||
Function(bool) onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
value = !value;
|
||||
onChanged(value);
|
||||
setState(() {});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 16,
|
||||
width: 16,
|
||||
decoration: BoxDecoration(
|
||||
color: value
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).accentTextTheme.subhead.decorationColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
border: Border.all(
|
||||
color: value
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).accentTextTheme.overline.color,
|
||||
width: 1
|
||||
)
|
||||
),
|
||||
child: value
|
||||
? Center(
|
||||
child: Icon(
|
||||
Icons.done,
|
||||
color: Colors.white,
|
||||
size: 14,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 16),
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.none
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,8 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
EdgeInsetsDirectional.only(bottom: _paddingBottom, top: paddingTop),
|
||||
child: CupertinoNavigationBar(
|
||||
leading: leading,
|
||||
automaticallyImplyLeading: false,
|
||||
automaticallyImplyMiddle: false,
|
||||
middle: middle,
|
||||
trailing: trailing,
|
||||
backgroundColor: backgroundColor,
|
||||
|
||||
+98
-56
@@ -1,15 +1,20 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class Picker<Item extends Object> extends StatelessWidget {
|
||||
class Picker<Item extends Object> extends StatefulWidget {
|
||||
Picker({
|
||||
@required this.selectedAtIndex,
|
||||
@required this.items,
|
||||
this.images,
|
||||
@required this.title,
|
||||
@required this.onItemSelected,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.isAlwaysShowScrollThumb = false
|
||||
});
|
||||
|
||||
final int selectedAtIndex;
|
||||
@@ -18,59 +23,87 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
final String title;
|
||||
final Function(Item) onItemSelected;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final bool isAlwaysShowScrollThumb;
|
||||
|
||||
@override
|
||||
PickerState createState() => PickerState<Item>(items, images, onItemSelected);
|
||||
}
|
||||
|
||||
class PickerState<Item> extends State<Picker> {
|
||||
PickerState(this.items, this.images, this.onItemSelected);
|
||||
|
||||
final Function(Item) onItemSelected;
|
||||
final List<Item> items;
|
||||
final List<Image> images;
|
||||
|
||||
final closeButton = Image.asset('assets/images/close.png',
|
||||
color: Palette.darkBlueCraiola,
|
||||
);
|
||||
ScrollController controller = ScrollController();
|
||||
|
||||
final double backgroundHeight = 193;
|
||||
final double thumbHeight = 72;
|
||||
double fromTop = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: Colors.white
|
||||
),
|
||||
),
|
||||
controller.addListener(() {
|
||||
fromTop = controller.hasClients
|
||||
? (controller.offset / controller.position.maxScrollExtent * (backgroundHeight - thumbHeight))
|
||||
: 0;
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Text(
|
||||
widget.title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.none,
|
||||
color: Colors.white
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
height: 233,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
child: ListView.separated(
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
|
||||
child: GestureDetector(
|
||||
onTap: () => null,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
height: 233,
|
||||
color: Theme.of(context).accentTextTheme.title.color,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
ListView.separated(
|
||||
controller: controller,
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
color: Theme.of(context).dividerColor,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
height: 1,
|
||||
),
|
||||
itemCount: items == null ? 0 : items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
final image = images != null? images[index] : null;
|
||||
final isItemSelected = index == selectedAtIndex;
|
||||
final isItemSelected = index == widget.selectedAtIndex;
|
||||
|
||||
final color = isItemSelected
|
||||
? Theme.of(context).accentTextTheme.subtitle.decorationColor
|
||||
: Colors.transparent;
|
||||
? Theme.of(context).textTheme.body2.color
|
||||
: Theme.of(context).accentTextTheme.title.color;
|
||||
final textColor = isItemSelected
|
||||
? Colors.blue
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).primaryTextTheme.title.color;
|
||||
|
||||
return GestureDetector(
|
||||
@@ -87,21 +120,22 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
color: color,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: mainAxisAlignment,
|
||||
mainAxisAlignment: widget.mainAxisAlignment,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
image != null
|
||||
? image
|
||||
: Offstage(),
|
||||
? image
|
||||
: Offstage(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: image != null ? 12 : 0
|
||||
left: image != null ? 12 : 0
|
||||
),
|
||||
child: Text(
|
||||
item.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: textColor,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
@@ -112,17 +146,25 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
widget.isAlwaysShowScrollThumb
|
||||
? CakeScrollbar(
|
||||
backgroundHeight: backgroundHeight,
|
||||
thumbHeight: thumbHeight,
|
||||
fromTop: fromTop
|
||||
)
|
||||
),
|
||||
),
|
||||
: Offstage(),
|
||||
],
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
AlertCloseButton(image: closeButton)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
const PrimaryButton(
|
||||
@@ -38,7 +37,7 @@ class PrimaryButton extends StatelessWidget {
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isDisabled
|
||||
? Colors.grey.withOpacity(0.5)
|
||||
? textColor.withOpacity(0.5)
|
||||
: textColor)),
|
||||
));
|
||||
}
|
||||
@@ -78,7 +77,7 @@ class LoadingPrimaryButton extends StatelessWidget {
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isDisabled
|
||||
? Colors.grey.withOpacity(0.5)
|
||||
? textColor.withOpacity(0.5)
|
||||
: textColor
|
||||
)),
|
||||
));
|
||||
|
||||
@@ -1,65 +1,82 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandartListRow extends StatelessWidget {
|
||||
StandartListRow(
|
||||
{this.title,
|
||||
this.value,
|
||||
this.isDrawTop = false,
|
||||
this.titleFontSize = 14,
|
||||
this.valueFontSize = 16,
|
||||
this.image,
|
||||
this.isDrawBottom = false});
|
||||
|
||||
final String title;
|
||||
final String value;
|
||||
final bool isDrawTop;
|
||||
final double titleFontSize;
|
||||
final double valueFontSize;
|
||||
final Image image;
|
||||
final bool isDrawBottom;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
isDrawTop
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
)
|
||||
: Offstage(),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
|
||||
const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: titleFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.caption.color),
|
||||
Theme.of(context).primaryTextTheme.overline.color),
|
||||
textAlign: TextAlign.left),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: valueFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color)),
|
||||
),
|
||||
image != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: image,
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
isDrawBottom
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor,
|
||||
)
|
||||
: Offstage(),
|
||||
? Container(
|
||||
height: 1,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,77 +1,153 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class TemplateTile extends StatelessWidget {
|
||||
class TemplateTile extends StatefulWidget {
|
||||
TemplateTile({
|
||||
Key key,
|
||||
@required this.to,
|
||||
@required this.amount,
|
||||
@required this.from,
|
||||
@required this.onTap
|
||||
});
|
||||
@required this.onTap,
|
||||
@required this.onRemove
|
||||
}) : super(key: key);
|
||||
|
||||
final String to;
|
||||
final String amount;
|
||||
final String from;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onRemove;
|
||||
|
||||
@override
|
||||
TemplateTileState createState() => TemplateTileState(
|
||||
to,
|
||||
amount,
|
||||
from,
|
||||
onTap,
|
||||
onRemove
|
||||
);
|
||||
}
|
||||
|
||||
class TemplateTileState extends State<TemplateTile> {
|
||||
TemplateTileState(
|
||||
this.to,
|
||||
this.amount,
|
||||
this.from,
|
||||
this.onTap,
|
||||
this.onRemove
|
||||
);
|
||||
|
||||
final String to;
|
||||
final String amount;
|
||||
final String from;
|
||||
final VoidCallback onTap;
|
||||
final VoidCallback onRemove;
|
||||
final trash = Image.asset('assets/images/trash.png', height: 16, width: 16, color: Colors.white);
|
||||
|
||||
bool isRemovable = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final toIcon = Image.asset('assets/images/to_icon.png',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
);
|
||||
final color = isRemovable ? Colors.white : Theme.of(context).primaryTextTheme.title.color;
|
||||
final toIcon = Image.asset('assets/images/to_icon.png', color: color);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.only(right: 10),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
amount,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
from,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: toIcon,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
to,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
final content = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
amount,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
from,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: toIcon,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: Text(
|
||||
to,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final tile = Container(
|
||||
padding: EdgeInsets.only(right: 10),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
onLongPress: () {
|
||||
setState(() {
|
||||
isRemovable = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
color: Theme.of(context).primaryTextTheme.display3.decorationColor,
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
final removableTile = Container(
|
||||
padding: EdgeInsets.only(right: 10),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isRemovable = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.only(left: 24, right: 10),
|
||||
color: Colors.red,
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: onRemove,
|
||||
child: Container(
|
||||
height: 40,
|
||||
width: 44,
|
||||
color: Palette.darkRed,
|
||||
child: Center(
|
||||
child: trash,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return isRemovable ? removableTile : tile;
|
||||
}
|
||||
}
|
||||
@@ -2,25 +2,28 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class TopPanel extends StatefulWidget {
|
||||
TopPanel({
|
||||
@required this.color,
|
||||
@required this.widget,
|
||||
this.edgeInsets = const EdgeInsets.all(24)
|
||||
this.edgeInsets = const EdgeInsets.all(24),
|
||||
this.color,
|
||||
this.gradient
|
||||
});
|
||||
|
||||
final Color color;
|
||||
final Widget widget;
|
||||
final EdgeInsets edgeInsets;
|
||||
final Gradient gradient;
|
||||
|
||||
@override
|
||||
TopPanelState createState() => TopPanelState(color, widget, edgeInsets);
|
||||
TopPanelState createState() => TopPanelState(widget, edgeInsets, color, gradient);
|
||||
}
|
||||
|
||||
class TopPanelState extends State<TopPanel> {
|
||||
TopPanelState(this._color, this._widget, this._edgeInsets);
|
||||
TopPanelState(this._widget, this._edgeInsets, this._color, this._gradient);
|
||||
|
||||
final Color _color;
|
||||
final Widget _widget;
|
||||
final EdgeInsets _edgeInsets;
|
||||
final Gradient _gradient;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -32,7 +35,8 @@ class TopPanelState extends State<TopPanel> {
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)
|
||||
),
|
||||
color: _color
|
||||
color: _color,
|
||||
gradient: _gradient
|
||||
),
|
||||
child: _widget,
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ class TrailButton extends StatelessWidget {
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.caption.color,
|
||||
color: Theme.of(context).textTheme.subhead.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user