CWA-216 | applied new design to settings page and change language page; reworked settings widgets, standard switch and picker; deleted provider picker; changed background colors in the faq page

This commit is contained in:
Oleksandr Sobol 2020-05-21 21:01:12 +03:00
parent 8769e93025
commit 1bed82327b
13 changed files with 375 additions and 437 deletions

View file

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_store.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_description.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart'; import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/provider_picker.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
class PresentProviderPicker extends StatelessWidget { class PresentProviderPicker extends StatelessWidget {
PresentProviderPicker({@required this.exchangeStore}); PresentProviderPicker({@required this.exchangeStore});
@ -72,7 +72,7 @@ class PresentProviderPicker extends StatelessWidget {
} }
showDialog<void>( showDialog<void>(
builder: (_) => ProviderPicker( builder: (_) => Picker(
items: items, items: items,
images: images, images: images,
selectedAtIndex: selectedItem, selectedAtIndex: selectedItem,

View file

@ -1,124 +0,0 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart';
class ProviderPicker extends StatelessWidget {
ProviderPicker({
@required this.selectedAtIndex,
@required this.items,
@required this.images,
@required this.title,
@required this.onItemSelected,
});
final int selectedAtIndex;
final List<ExchangeProvider> items;
final List<Image> images;
final String title;
final Function(ExchangeProvider) onItemSelected;
@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.historyPanel.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
),
),
),
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: PaletteDark.menuList,
child: ListView.separated(
separatorBuilder: (context, index) => Divider(
color: PaletteDark.mainBackgroundColor,
height: 1,
),
itemCount: items == null ? 0 : items.length,
itemBuilder: (context, index) {
final item = items[index];
final image = images[index];
final isItemSelected = index == selectedAtIndex;
final color = isItemSelected
? PaletteDark.menuHeader
: Colors.transparent;
final textColor = isItemSelected
? Colors.blue
: Colors.white;
return GestureDetector(
onTap: () {
if (onItemSelected == null) {
return;
}
Navigator.of(context).pop();
onItemSelected(item);
},
child: Container(
height: 77,
padding: EdgeInsets.only(left: 24, right: 24),
color: color,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
Padding(
padding: EdgeInsets.only(left: 12),
child: Text(
item.toString(),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: textColor,
decoration: TextDecoration.none,
),
),
)
],
),
),
);
},
)
),
),
),
)
],
),
)
),
),
),
);
}
}

View file

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -10,41 +11,55 @@ class FaqPage extends BasePage {
@override @override
String get title => S.current.faq; String get title => S.current.faq;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
return FutureBuilder( return Container(
builder: (context, snapshot) { color: PaletteDark.historyPanel,
final faqItems = jsonDecode(snapshot.data.toString()) as List; padding: EdgeInsets.only(top: 12),
child: Container(
color: PaletteDark.menuList,
child: FutureBuilder(
builder: (context, snapshot) {
final faqItems = jsonDecode(snapshot.data.toString()) as List;
return ListView.separated( return ListView.separated(
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final itemTitle = faqItems[index]["question"].toString(); final itemTitle = faqItems[index]["question"].toString();
final itemChild = faqItems[index]["answer"].toString(); final itemChild = faqItems[index]["answer"].toString();
return ExpansionTile( return ExpansionTile(
title: Text(itemTitle), title: Padding(
children: <Widget>[ padding: EdgeInsets.only(left: 8, top: 12, bottom: 12),
Row( child: Text(itemTitle),
mainAxisAlignment: MainAxisAlignment.start, ),
backgroundColor: PaletteDark.menuHeader,
children: <Widget>[ children: <Widget>[
Expanded( Row(
child: Container( mainAxisAlignment: MainAxisAlignment.start,
padding: EdgeInsets.only(left: 15.0, right: 15.0), children: <Widget>[
child: Text( Expanded(
itemChild, child: Container(
), padding: EdgeInsets.only(left: 24.0, right: 24.0, bottom: 4),
)) child: Text(
itemChild,
),
))
],
)
], ],
) );
], },
separatorBuilder: (_, __) =>
Divider(color: PaletteDark.mainBackgroundColor, height: 1.0),
itemCount: faqItems == null ? 0 : faqItems.length,
); );
}, },
separatorBuilder: (_, __) => future: rootBundle.loadString(getFaqPath(context)),
Divider(color: Theme.of(context).dividerTheme.color, height: 1.0), ),
itemCount: faqItems == null ? 0 : faqItems.length, ),
);
},
future: rootBundle.loadString(getFaqPath(context)),
); );
} }

View file

@ -5,76 +5,101 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/common/language.dart'; import 'package:cake_wallet/src/domain/common/language.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart'; import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
class ChangeLanguage extends BasePage { class ChangeLanguage extends BasePage {
@override @override
String get title => S.current.settings_change_language; String get title => S.current.settings_change_language;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
final currentLanguage = Provider.of<Language>(context); final currentLanguage = Provider.of<Language>(context);
final currentColor = Theme.of(context).selectedRowColor; final currentColor = Colors.green;
final notCurrentColor = Theme.of(context).accentTextTheme.subhead.backgroundColor; final notCurrentColor = Colors.white;
final shortDivider = Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: PaletteDark.menuList,
child: Container(
height: 1,
color: PaletteDark.mainBackgroundColor,
),
);
final longDivider = Container(
height: 1,
color: PaletteDark.mainBackgroundColor,
);
return Container( return Container(
padding: EdgeInsets.only(top: 10.0, bottom: 10.0), color: PaletteDark.historyPanel,
padding: EdgeInsets.only(top: 10.0),
child: ListView.builder( child: ListView.builder(
itemCount: languages.values.length, itemCount: languages.values.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final item = languages.values.elementAt(index);
final code = languages.keys.elementAt(index);
final isCurrent = settingsStore.languageCode == null final isCurrent = settingsStore.languageCode == null
? false ? false
: languages.keys.elementAt(index) == : code == settingsStore.languageCode;
settingsStore.languageCode;
return Container( return Column(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0), children: <Widget>[
color: isCurrent ? currentColor : notCurrentColor, index == 0 ? longDivider : Offstage(),
child: ListTile( Container(
title: Text( padding: EdgeInsets.only(top: 4, bottom: 4),
languages.values.elementAt(index), color: PaletteDark.menuList,
style: TextStyle( child: ListTile(
fontSize: 16.0, contentPadding: EdgeInsets.only(left: 24, right: 24),
color: Theme.of(context).primaryTextTheme.title.color), title: Text(
), item,
onTap: () async { style: TextStyle(
if (!isCurrent) { fontSize: 14.0,
await showDialog<void>( fontWeight: FontWeight.w600,
context: context, color: isCurrent ? currentColor : notCurrentColor
builder: (BuildContext context) { ),
return AlertDialog( ),
title: Text( trailing: isCurrent
S.of(context).change_language, ? Icon(Icons.done, color: currentColor)
textAlign: TextAlign.center, : Offstage(),
), onTap: () async {
content: Text( if (!isCurrent) {
S.of(context).change_language_to( await showDialog<void>(
languages.values.elementAt(index)), context: context,
textAlign: TextAlign.center, builder: (BuildContext context) {
), return AlertWithTwoActions(
actions: <Widget>[ alertTitle: S.of(context).change_language,
FlatButton( alertContent: S.of(context).change_language_to(item),
onPressed: () => Navigator.of(context).pop(), leftButtonText: S.of(context).change,
child: Text(S.of(context).cancel)), rightButtonText: S.of(context).cancel,
FlatButton( actionLeftButton: () {
onPressed: () {
settingsStore.saveLanguageCode( settingsStore.saveLanguageCode(
languageCode: languageCode: code);
languages.keys.elementAt(index)); currentLanguage.setCurrentLanguage(code);
currentLanguage.setCurrentLanguage(
languages.keys.elementAt(index));
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Text(S.of(context).change)), actionRightButton: () => Navigator.of(context).pop()
], );
); });
}); }
} },
}, ),
), ),
item == languages.values.last
? longDivider
: shortDivider
],
); );
}, },
)); )
);
} }
} }

View file

@ -17,7 +17,7 @@ import 'package:cake_wallet/src/screens/settings/attributes.dart';
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart'; import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
import 'package:cake_wallet/src/screens/settings/items/settings_item.dart'; import 'package:cake_wallet/src/screens/settings/items/settings_item.dart';
import 'package:cake_wallet/src/screens/settings/items/item_headers.dart'; import 'package:cake_wallet/src/screens/settings/items/item_headers.dart';
import 'package:cake_wallet/src/widgets/present_picker.dart'; import 'package:cake_wallet/src/widgets/picker.dart';
// Settings widgets // Settings widgets
import 'package:cake_wallet/src/screens/settings/widgets/settings_arrow_list_row.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_arrow_list_row.dart';
import 'package:cake_wallet/src/screens/settings/widgets/settings_header_list_row.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_header_list_row.dart';
@ -31,10 +31,7 @@ class SettingsPage extends BasePage {
String get title => S.current.settings_title; String get title => S.current.settings_title;
@override @override
bool get isModalBackButton => true; Color get backgroundColor => PaletteDark.historyPanel;
@override
Color get backgroundColor => Palette.lightGrey2;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
@ -73,21 +70,6 @@ class SettingsFormState extends State<SettingsForm> {
settingsStore.setItemHeaders(); settingsStore.setItemHeaders();
_items.addAll([ _items.addAll([
SettingsItem(title: ItemHeaders.nodes, attribute: Attributes.header),
SettingsItem(
onTaped: () => Navigator.of(context).pushNamed(Routes.nodeList),
title: ItemHeaders.currentNode,
widget: Observer(
builder: (_) => Text(
settingsStore.node == null ? '' : settingsStore.node.uri,
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 16.0,
color:
Theme.of(context).primaryTextTheme.subtitle.color),
)),
attribute: Attributes.widget),
SettingsItem(title: ItemHeaders.wallets, attribute: Attributes.header),
SettingsItem( SettingsItem(
onTaped: () => _setBalance(context), onTaped: () => _setBalance(context),
title: ItemHeaders.displayBalanceAs, title: ItemHeaders.displayBalanceAs,
@ -96,9 +78,8 @@ class SettingsFormState extends State<SettingsForm> {
settingsStore.balanceDisplayMode.toString(), settingsStore.balanceDisplayMode.toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: color: PaletteDark.walletCardText),
Theme.of(context).primaryTextTheme.subtitle.color),
)), )),
attribute: Attributes.widget), attribute: Attributes.widget),
SettingsItem( SettingsItem(
@ -109,9 +90,8 @@ class SettingsFormState extends State<SettingsForm> {
settingsStore.fiatCurrency.toString(), settingsStore.fiatCurrency.toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: color: PaletteDark.walletCardText),
Theme.of(context).primaryTextTheme.subtitle.color),
)), )),
attribute: Attributes.widget), attribute: Attributes.widget),
SettingsItem( SettingsItem(
@ -122,15 +102,14 @@ class SettingsFormState extends State<SettingsForm> {
settingsStore.transactionPriority.toString(), settingsStore.transactionPriority.toString(),
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: color: PaletteDark.walletCardText),
Theme.of(context).primaryTextTheme.subtitle.color),
)), )),
attribute: Attributes.widget), attribute: Attributes.widget),
SettingsItem( SettingsItem(
title: ItemHeaders.saveRecipientAddress, title: ItemHeaders.saveRecipientAddress,
attribute: Attributes.switcher), attribute: Attributes.switcher),
SettingsItem(title: ItemHeaders.personal, attribute: Attributes.header), SettingsItem(title: '', attribute: Attributes.header),
SettingsItem( SettingsItem(
onTaped: () { onTaped: () {
Navigator.of(context).pushNamed(Routes.auth, Navigator.of(context).pushNamed(Routes.auth,
@ -196,17 +175,14 @@ class SettingsFormState extends State<SettingsForm> {
], ],
child: Container( child: Container(
height: 56, height: 56,
padding: EdgeInsets.only(left: 20, right: 20), padding: EdgeInsets.only(left: 24, right: 24),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(S.of(context).settings_display_on_dashboard_list, Text(S.of(context).settings_display_on_dashboard_list,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 14,
color: Theme.of(context) color: Colors.white)),
.primaryTextTheme
.title
.color)),
Observer(builder: (_) { Observer(builder: (_) {
var title = ''; var title = '';
@ -233,17 +209,14 @@ class SettingsFormState extends State<SettingsForm> {
return Text(title, return Text(title,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: Theme.of(context) color: PaletteDark.walletCardText));
.primaryTextTheme
.subtitle
.color));
}) })
]), ]),
)); ));
}, },
attribute: Attributes.rawWidget), attribute: Attributes.rawWidget),
SettingsItem(title: ItemHeaders.support, attribute: Attributes.header), SettingsItem(title: '', attribute: Attributes.header),
SettingsItem( SettingsItem(
onTaped: () => _launchUrl(_emailUrl), onTaped: () => _launchUrl(_emailUrl),
title: 'Email', title: 'Email',
@ -253,13 +226,13 @@ class SettingsFormState extends State<SettingsForm> {
SettingsItem( SettingsItem(
onTaped: () => _launchUrl(_telegramUrl), onTaped: () => _launchUrl(_telegramUrl),
title: 'Telegram', title: 'Telegram',
link: 't.me/cakewallet_bot', link: 'Cake_Wallet',
image: _telegramImage, image: _telegramImage,
attribute: Attributes.link), attribute: Attributes.link),
SettingsItem( SettingsItem(
onTaped: () => _launchUrl(_twitterUrl), onTaped: () => _launchUrl(_twitterUrl),
title: 'Twitter', title: 'Twitter',
link: 'twitter.com/CakewalletXMR', link: '@CakeWalletXMR',
image: _twitterImage, image: _twitterImage,
attribute: Attributes.link), attribute: Attributes.link),
SettingsItem( SettingsItem(
@ -268,18 +241,18 @@ class SettingsFormState extends State<SettingsForm> {
link: 'support@changenow.io', link: 'support@changenow.io',
image: _changeNowImage, image: _changeNowImage,
attribute: Attributes.link), attribute: Attributes.link),
SettingsItem(
onTaped: () => _launchUrl(_morphUrl),
title: 'Morph',
link: 'support@morphtoken.com',
image: _morphImage,
attribute: Attributes.link),
SettingsItem( SettingsItem(
onTaped: () => _launchUrl(_xmrToUrl), onTaped: () => _launchUrl(_xmrToUrl),
title: 'XMR.to', title: 'XMR.to',
link: 'support@xmr.to', link: 'support@xmr.to',
image: _xmrBtcImage, image: _xmrBtcImage,
attribute: Attributes.link), attribute: Attributes.link),
SettingsItem(
onTaped: () => _launchUrl(_morphUrl),
title: 'MorphToken',
link: 'support@morphtoken.com',
image: _morphImage,
attribute: Attributes.link),
SettingsItem( SettingsItem(
onTaped: () { onTaped: () {
Navigator.push( Navigator.push(
@ -345,87 +318,116 @@ class SettingsFormState extends State<SettingsForm> {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
settingsStore.setItemHeaders(); settingsStore.setItemHeaders();
return SingleChildScrollView( final shortDivider = Container(
child: Column( height: 1,
children: <Widget>[ padding: EdgeInsets.only(left: 24),
ListView.builder( color: PaletteDark.menuList,
shrinkWrap: true, child: Container(
physics: NeverScrollableScrollPhysics(), height: 1,
itemCount: _items.length, color: PaletteDark.mainBackgroundColor,
itemBuilder: (context, index) { ),
final item = _items[index]; );
bool _isDrawDivider = true;
if (item.attribute == Attributes.header || item == _items.last) { final longDivider = Container(
_isDrawDivider = false; height: 1,
} else { color: PaletteDark.mainBackgroundColor,
if (_items[index + 1].attribute == Attributes.header) { );
_isDrawDivider = false;
}
}
return Column( return Container(
children: <Widget>[ color: PaletteDark.historyPanel,
_getWidget(item), padding: EdgeInsets.only(top: 12),
_isDrawDivider child: SingleChildScrollView(
? Container( child: Column(
color: Theme.of(context) children: <Widget>[
.accentTextTheme longDivider,
.headline ListView.builder(
.backgroundColor, shrinkWrap: true,
padding: EdgeInsets.only( physics: NeverScrollableScrollPhysics(),
left: 20.0, itemCount: _items.length,
right: 20.0, itemBuilder: (context, index) {
), final item = _items[index];
child: Divider(
color: Theme.of(context).dividerColor, Widget divider;
height: 1.0,
), if (item.attribute == Attributes.header || item == _items.last) {
) divider = longDivider;
: Offstage() } else if (_items[index + 1].attribute == Attributes.header){
], divider = longDivider;
); } else {
}), divider = shortDivider;
ListTile( }
contentPadding: EdgeInsets.only(left: 20.0),
title: Text( return Column(
settingsStore.itemHeaders[ItemHeaders.version], children: <Widget>[
style: TextStyle( _getWidget(item),
fontSize: 14.0, color: Palette.wildDarkBlue) divider
), ],
) );
], }),
)); Padding(
padding: EdgeInsets.only(top: 12),
child: ListTile(
title: Center(
child: Text(
settingsStore.itemHeaders[ItemHeaders.version],
style: TextStyle(
fontSize: 14.0, color: PaletteDark.walletCardText)
),
),
),
)
],
)),
);
} }
Future<void> _setBalance(BuildContext context) async { Future<void> _setBalance(BuildContext context) async {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
final selectedDisplayMode = final items = BalanceDisplayMode.all;
await presentPicker(context, BalanceDisplayMode.all); final selectedItem = items.indexOf(settingsStore.balanceDisplayMode);
if (selectedDisplayMode != null) { await showDialog<void>(
await settingsStore.setCurrentBalanceDisplayMode( builder: (_) => Picker(
balanceDisplayMode: selectedDisplayMode); items: items,
} selectedAtIndex: selectedItem,
title: S.of(context).please_select,
mainAxisAlignment: MainAxisAlignment.center,
onItemSelected: (BalanceDisplayMode mode) async =>
await settingsStore.setCurrentBalanceDisplayMode(
balanceDisplayMode: mode)),
context: context);
} }
Future<void> _setCurrency(BuildContext context) async { Future<void> _setCurrency(BuildContext context) async {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
final selectedCurrency = await presentPicker(context, FiatCurrency.all); final items = FiatCurrency.all;
final selectedItem = items.indexOf(settingsStore.fiatCurrency);
if (selectedCurrency != null) { await showDialog<void>(
await settingsStore.setCurrentFiatCurrency(currency: selectedCurrency); builder: (_) => Picker(
} items: items,
selectedAtIndex: selectedItem,
title: S.of(context).please_select,
mainAxisAlignment: MainAxisAlignment.center,
onItemSelected: (FiatCurrency currency) async =>
await settingsStore.setCurrentFiatCurrency(currency: currency)),
context: context);
} }
Future<void> _setTransactionPriority(BuildContext context) async { Future<void> _setTransactionPriority(BuildContext context) async {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
final selectedPriority = final items = TransactionPriority.all;
await presentPicker(context, TransactionPriority.all); final selectedItem = items.indexOf(settingsStore.transactionPriority);
if (selectedPriority != null) { await showDialog<void>(
await settingsStore.setCurrentTransactionPriority( builder: (_) => Picker(
priority: selectedPriority); items: items,
} selectedAtIndex: selectedItem,
title: S.of(context).please_select,
mainAxisAlignment: MainAxisAlignment.center,
onItemSelected: (TransactionPriority priority) async =>
await settingsStore.setCurrentTransactionPriority(
priority: priority)),
context: context);
} }
} }

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/palette.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -8,22 +9,23 @@ class SettingsArrowListRow extends StatelessWidget {
final VoidCallback onTaped; final VoidCallback onTaped;
final String title; final String title;
final _cakeArrowImage = Image.asset('assets/images/cake_arrow.png'); final _cakeArrowImage = Image.asset('assets/images/select_arrow.png',
color: PaletteDark.walletCardText);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
return Container( return Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, color: PaletteDark.menuList,
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0), contentPadding: EdgeInsets.only(left: 24.0, right: 24.0),
title: Observer( title: Observer(
builder: (_) => Text( builder: (_) => Text(
settingsStore.itemHeaders[title], settingsStore.itemHeaders[title],
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: Theme.of(context).primaryTextTheme.title.color), color: Colors.white),
)), )),
trailing: _cakeArrowImage, trailing: _cakeArrowImage,
onTap: onTaped), onTap: onTaped),

View file

@ -16,7 +16,7 @@ class SettingsHeaderListRow extends StatelessWidget {
return Column( return Column(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 28.0, height: 20.0,
), ),
Container( Container(
padding: EdgeInsets.only(left: 20.0), padding: EdgeInsets.only(left: 20.0),
@ -25,7 +25,9 @@ class SettingsHeaderListRow extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Observer( Observer(
builder: (_) => Text( builder: (_) => Text(
settingsStore.itemHeaders[title], title.isNotEmpty
? settingsStore.itemHeaders[title]
: '',
style: TextStyle( style: TextStyle(
fontSize: 15.0, color: Palette.wildDarkBlue), fontSize: 15.0, color: Palette.wildDarkBlue),
)) ))

View file

@ -13,9 +13,9 @@ class SettingsLinktListRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, color: PaletteDark.menuList,
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0), contentPadding: EdgeInsets.only(left: 24.0, right: 24.0),
title: Row( title: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -26,16 +26,15 @@ class SettingsLinktListRow extends StatelessWidget {
child: Text( child: Text(
title, title,
style: TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 14.0,
fontWeight: FontWeight.w500, color: Colors.white),
color: Theme.of(context).primaryTextTheme.title.color),
), ),
) )
], ],
), ),
trailing: Text( trailing: Text(
link, link,
style: TextStyle(fontSize: 14.0, color: Palette.cakeGreen), style: TextStyle(fontSize: 14.0, color: Colors.blue),
), ),
onTap: onTaped, onTap: onTaped,
), ),

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class SettingRawWidgetListRow extends StatelessWidget { class SettingRawWidgetListRow extends StatelessWidget {
SettingRawWidgetListRow({@required this.widgetBuilder}); SettingRawWidgetListRow({@required this.widgetBuilder});
@ -8,7 +9,7 @@ class SettingRawWidgetListRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, color: PaletteDark.menuList,
child: widgetBuilder(context) ?? Container(), child: widgetBuilder(context) ?? Container(),
); );
} }

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -61,14 +62,14 @@ class SettingsSwitchListRow extends StatelessWidget {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
return Container( return Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, color: PaletteDark.menuList,
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0), contentPadding: EdgeInsets.only(left: 24.0, right: 24.0),
title: Observer( title: Observer(
builder: (_) => Text(settingsStore.itemHeaders[title], builder: (_) => Text(settingsStore.itemHeaders[title],
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14,
color: Theme.of(context).primaryTextTheme.title.color)), color: Colors.white)),
), ),
trailing: _getSwitch(context)), trailing: _getSwitch(context)),
); );

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/palette.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -15,9 +16,9 @@ class SettingsTextListRow extends StatelessWidget {
final settingsStore = Provider.of<SettingsStore>(context); final settingsStore = Provider.of<SettingsStore>(context);
return Container( return Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, color: PaletteDark.menuList,
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0), contentPadding: EdgeInsets.only(left: 24.0, right: 24.0),
title: Row( title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -26,8 +27,8 @@ class SettingsTextListRow extends StatelessWidget {
builder: (_) => Text( builder: (_) => Text(
settingsStore.itemHeaders[title], settingsStore.itemHeaders[title],
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 14.0,
color: Theme.of(context).primaryTextTheme.title.color), color: Colors.white),
)), )),
), ),
Flexible( Flexible(

View file

@ -1,19 +1,23 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class Picker<Item extends Object> extends StatelessWidget { class Picker<Item extends Object> extends StatelessWidget {
Picker( Picker({
{@required this.selectedAtIndex, @required this.selectedAtIndex,
@required this.items, @required this.items,
@required this.title, this.images,
this.pickerHeight = 300, @required this.title,
this.onItemSelected}); @required this.onItemSelected,
this.mainAxisAlignment = MainAxisAlignment.start
});
final int selectedAtIndex; final int selectedAtIndex;
final List<Item> items; final List<Item> items;
final List<Image> images;
final String title; final String title;
final double pickerHeight;
final Function(Item) onItemSelected; final Function(Item) onItemSelected;
final MainAxisAlignment mainAxisAlignment;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -24,83 +28,98 @@ class Picker<Item extends Object> extends StatelessWidget {
child: BackdropFilter( child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.55)), decoration: BoxDecoration(color: PaletteDark.historyPanel.withOpacity(0.75)),
child: Column( child: Center(
mainAxisAlignment: MainAxisAlignment.end, child: Column(
children: [ mainAxisSize: MainAxisSize.min,
GestureDetector( children: <Widget>[
onTap: () => null, Container(
child: Container( padding: EdgeInsets.only(left: 24, right: 24),
width: double.infinity, child: Text(
height: pickerHeight, title,
color: Theme.of(context).backgroundColor, textAlign: TextAlign.center,
child: ListView.separated( style: TextStyle(
itemCount: items.length + 1, fontSize: 18,
separatorBuilder: (_, index) => index == 0 fontWeight: FontWeight.bold,
? SizedBox() decoration: TextDecoration.none,
: Divider( color: Colors.white
height: 1, ),
color: Color.fromRGBO(235, 238, 242, 1)), ),
itemBuilder: (_, index) { ),
if (index == 0) { Padding(
return Container( padding: EdgeInsets.only(left: 24, right: 24, top: 24),
height: 100, child: GestureDetector(
width: double.infinity, onTap: () => null,
color: Theme.of(context).backgroundColor, child: ClipRRect(
child: Center( borderRadius: BorderRadius.all(Radius.circular(14)),
child: Text( child: Container(
title, height: 233,
textAlign: TextAlign.center, color: PaletteDark.menuList,
style: TextStyle( child: ListView.separated(
fontSize: 26, separatorBuilder: (context, index) => Divider(
fontWeight: FontWeight.w600, color: PaletteDark.mainBackgroundColor,
fontFamily: 'Lato', height: 1,
decoration: TextDecoration.none,
color: Theme.of(context)
.primaryTextTheme
.caption
.color),
), ),
), itemCount: items == null ? 0 : items.length,
); itemBuilder: (context, index) {
} final item = items[index];
final image = images != null? images[index] : null;
final isItemSelected = index == selectedAtIndex;
index -= 1; final color = isItemSelected
final item = items[index]; ? PaletteDark.menuHeader
: Colors.transparent;
final textColor = isItemSelected
? Colors.blue
: Colors.white;
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (onItemSelected == null) { if (onItemSelected == null) {
return; return;
} }
Navigator.of(context).pop(); Navigator.of(context).pop();
onItemSelected(item); onItemSelected(item);
}, },
child: Container( child: Container(
color: Colors.transparent, height: 77,
padding: EdgeInsets.only(top: 18, bottom: 18), padding: EdgeInsets.only(left: 24, right: 24),
child: Center( color: color,
child: Text( child: Row(
item.toString(), mainAxisSize: MainAxisSize.max,
style: TextStyle( mainAxisAlignment: mainAxisAlignment,
decoration: TextDecoration.none, crossAxisAlignment: CrossAxisAlignment.center,
fontSize: 18, children: <Widget>[
fontWeight: FontWeight.normal, image != null
fontFamily: 'Lato', ? image
color: index == selectedAtIndex : Offstage(),
? Color.fromRGBO(138, 80, 255, 1) Padding(
: Theme.of(context) padding: EdgeInsets.only(
.primaryTextTheme left: image != null ? 12 : 0
.caption ),
.color), child: Text(
)), item.toString(),
), style: TextStyle(
); fontSize: 18,
}, fontWeight: FontWeight.bold,
)), color: textColor,
) decoration: TextDecoration.none,
], ),
), ),
)
],
),
),
);
},
)
),
),
),
)
],
),
)
), ),
), ),
), ),

View file

@ -1,3 +1,5 @@
import 'package:cake_wallet/palette.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class StandartSwitch extends StatefulWidget { class StandartSwitch extends StatefulWidget {
@ -16,29 +18,22 @@ class StandartSwitchState extends State<StandartSwitch> {
return GestureDetector( return GestureDetector(
onTap: widget.onTaped, onTap: widget.onTaped,
child: AnimatedContainer( child: AnimatedContainer(
padding: EdgeInsets.only(left: 4.0, right: 4.0), padding: EdgeInsets.only(left: 2.0, right: 2.0),
alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft, alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft,
duration: Duration(milliseconds: 250), duration: Duration(milliseconds: 250),
width: 55.0, width: 50,
height: 33.0, height: 28,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).toggleButtonsTheme.color, color: widget.value
border: Border.all( ? Colors.green
color: Theme.of(context).toggleButtonsTheme.borderColor), : PaletteDark.mainBackgroundColor,
borderRadius: BorderRadius.all(Radius.circular(10.0))), borderRadius: BorderRadius.all(Radius.circular(14.0))),
child: Container( child: Container(
width: 25.0, width: 24.0,
height: 25.0, height: 24.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.value color: Colors.white,
? Theme.of(context).toggleButtonsTheme.selectedColor shape: BoxShape.circle),
: Theme.of(context).toggleButtonsTheme.disabledColor,
borderRadius: BorderRadius.all(Radius.circular(8.0))),
child: Icon(
widget.value ? Icons.check : Icons.close,
color: Colors.white,
size: 16.0,
),
), ),
), ),
); );