CAKE-30 | created settings_version_cell, language_row, version_list_item; applied new design to settings, faq, disclaimer, pin code, change language pages; fixed items of settings page

OleksandrSobol committed Sep 7, 2020 at 20:35 UTC 30665aac1ca0f31f52af8d9072496f88412a7f76
20 files changed +278 -176
lib/palette.dart
+2
@@ -90,6 +90,8 @@ class PaletteDark {
90 static const Color distantBlue = Color.fromRGBO(72, 85, 131, 1.0);
91 static const Color moderateVioletBlue = Color.fromRGBO(62, 73, 113, 1.0);
92 static const Color deepVioletBlue = Color.fromRGBO(52, 66, 104, 1.0);
93 + static const Color lightPurpleBlue = Color.fromRGBO(120, 133, 170, 1.0);
94 + static const Color indicatorVioletBlue = Color.fromRGBO(59, 72, 119, 1.0);
95
96 // FIXME: Rename.
97 static const Color eee = Color.fromRGBO(236, 239, 245, 1.0);
lib/src/domain/common/language.dart
+1 -1
@@ -30,7 +30,7 @@ class Language with ChangeNotifier {
30 }
31
32 static Future<String> localeDetection() async {
33 - String locale = await Devicelocale.currentLocale;
33 + var locale = await Devicelocale.currentLocale;
34 locale = Intl.shortLocale(locale);
35
36 return languages.keys.contains(locale) ? locale : 'en';
lib/src/screens/disclaimer/disclaimer_page.dart
+5 -3
@@ -1,4 +1,5 @@
1 import 'dart:ui';
2 +import 'package:cake_wallet/palette.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
5 import 'package:flutter/services.dart';
@@ -132,6 +133,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
133 _fileText,
134 style: TextStyle(
135 fontSize: 12.0,
136 + fontWeight: FontWeight.normal,
137 color: Theme.of(context).primaryTextTheme.title.color
138 ),
139 ))
@@ -169,7 +171,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
171 xmrtoUrl,
172 textAlign: TextAlign.left,
173 style: TextStyle(
172 - color: Colors.blue,
174 + color: Palette.blueCraiola,
175 fontSize: 14.0,
176 fontWeight: FontWeight.normal,
177 decoration: TextDecoration.underline),
@@ -190,7 +192,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
192 changenowUrl,
193 textAlign: TextAlign.left,
194 style: TextStyle(
193 - color: Colors.blue,
195 + color: Palette.blueCraiola,
196 fontSize: 14.0,
197 fontWeight: FontWeight.normal,
198 decoration: TextDecoration.underline),
@@ -211,7 +213,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
213 morphUrl,
214 textAlign: TextAlign.left,
215 style: TextStyle(
214 - color: Colors.blue,
216 + color: Palette.blueCraiola,
217 fontSize: 14.0,
218 fontWeight: FontWeight.normal,
219 decoration: TextDecoration.underline),
lib/src/screens/faq/faq_page.dart
+73 -79
@@ -1,4 +1,6 @@
1 import 'dart:convert';
2 +import 'package:cake_wallet/palette.dart';
3 +import 'package:cake_wallet/src/widgets/standard_list.dart';
4 import 'package:flutter/material.dart';
5 import 'package:flutter/services.dart';
6 import 'package:provider/provider.dart';
@@ -27,93 +29,85 @@ class FaqFormState extends State<FaqForm> {
29 @override
30 Widget build(BuildContext context) {
31 final addIcon = Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
30 - final removeIcon = Icon(Icons.remove, color: Colors.green);
32 + final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
33
34 return Container(
33 - padding: EdgeInsets.only(top: 12),
34 - child: Container(
35 - color: Theme.of(context).accentTextTheme.headline.color,
36 - child: FutureBuilder(
37 - builder: (context, snapshot) {
38 - final faqItems = jsonDecode(snapshot.data.toString()) as List;
35 + padding: EdgeInsets.only(top: 12, left: 24),
36 + child: FutureBuilder(
37 + builder: (context, snapshot) {
38 + final faqItems = jsonDecode(snapshot.data.toString()) as List;
39
40 - if (snapshot.hasData) {
41 - setIconsAndColors(context, faqItems.length, addIcon);
42 - }
40 + if (snapshot.hasData) {
41 + setIconsAndColors(context, faqItems.length, addIcon);
42 + }
43
44 - return SingleChildScrollView(
45 - child: ListView.separated(
46 - shrinkWrap: true,
47 - physics: NeverScrollableScrollPhysics(),
48 - itemBuilder: (BuildContext context, int index) {
49 - final itemTitle = faqItems[index]["question"].toString();
50 - final itemChild = faqItems[index]["answer"].toString();
44 + return SingleChildScrollView(
45 + child: Column(
46 + children: <Widget>[
47 + StandardListSeparator(),
48 + ListView.separated(
49 + shrinkWrap: true,
50 + physics: NeverScrollableScrollPhysics(),
51 + itemBuilder: (BuildContext context, int index) {
52 + final itemTitle = faqItems[index]["question"].toString();
53 + final itemChild = faqItems[index]["answer"].toString();
54
52 - return ExpansionTile(
53 - title: Padding(
54 - padding: EdgeInsets.only(left: 8, top: 12, bottom: 12),
55 - child: Text(
56 - itemTitle,
57 - style: TextStyle(
58 - fontSize: 14,
59 - fontWeight: FontWeight.w600,
60 - color: colors[index]
55 + return ListTileTheme(
56 + contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
57 + child: ExpansionTile(
58 + title: Text(
59 + itemTitle,
60 + style: TextStyle(
61 + fontSize: 14,
62 + fontWeight: FontWeight.w500,
63 + color: colors[index]
64 + ),
65 ),
62 - ),
63 - ),
64 - trailing: Padding(
65 - padding: EdgeInsets.only(right: 24),
66 - child: Container(
67 - width: double.minPositive,
68 - child: Center(
69 - child: icons[index]
70 - ),
71 - ),
72 - ),
73 - backgroundColor: Theme.of(context).accentTextTheme.headline.backgroundColor,
74 - onExpansionChanged: (value) {
75 - setState(() {
76 - if (value) {
77 - icons[index] = removeIcon;
78 - colors[index] = Colors.green;
79 - } else {
80 - icons[index] = addIcon;
81 - colors[index] = Theme.of(context).primaryTextTheme.title.color;
82 - }
83 - });
84 - },
85 - children: <Widget>[
86 - Row(
87 - mainAxisAlignment: MainAxisAlignment.start,
66 + trailing: icons[index],
67 + onExpansionChanged: (value) {
68 + setState(() {
69 + if (value) {
70 + icons[index] = removeIcon;
71 + colors[index] = Palette.blueCraiola;
72 + } else {
73 + icons[index] = addIcon;
74 + colors[index] = Theme.of(context).primaryTextTheme.title.color;
75 + }
76 + });
77 + },
78 children: <Widget>[
89 - Expanded(
90 - child: Container(
91 - padding: EdgeInsets.only(
92 - left: 24.0,
93 - right: 24.0,
94 - bottom: 8
95 - ),
96 - child: Text(
97 - itemChild,
98 - style: TextStyle(
99 - fontSize: 12,
100 - color: Theme.of(context).primaryTextTheme.title.color
101 - ),
102 - ),
103 - ))
79 + Row(
80 + mainAxisAlignment: MainAxisAlignment.start,
81 + children: <Widget>[
82 + Expanded(
83 + child: Container(
84 + padding: EdgeInsets.only(
85 + right: 24.0,
86 + ),
87 + child: Text(
88 + itemChild,
89 + style: TextStyle(
90 + fontSize: 14,
91 + fontWeight: FontWeight.normal,
92 + color: Theme.of(context).primaryTextTheme.title.color
93 + ),
94 + ),
95 + ))
96 + ],
97 + )
98 ],
105 - )
106 - ],
107 - );
108 - },
109 - separatorBuilder: (_, __) =>
110 - Container(color: Theme.of(context).dividerColor, height: 1.0),
111 - itemCount: faqItems == null ? 0 : faqItems.length,
112 - ),
113 - );
114 - },
115 - future: rootBundle.loadString(getFaqPath(context)),
116 - ),
99 + ),
100 + );
101 + },
102 + separatorBuilder: (_, __) =>
103 + StandardListSeparator(),
104 + itemCount: faqItems == null ? 0 : faqItems.length,
105 + )
106 + ],
107 + ),
108 + );
109 + },
110 + future: rootBundle.loadString(getFaqPath(context)),
111 ),
112 );
113 }
lib/src/screens/pin_code/pin_code.dart
+5 -4
@@ -108,7 +108,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
108 Text(title,
109 style: TextStyle(
110 fontSize: 20,
111 - fontWeight: FontWeight.bold,
111 + fontWeight: FontWeight.w500,
112 color: Theme.of(context).primaryTextTheme.title.color)),
113 Spacer(flex: 3),
114 Container(
@@ -126,7 +126,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
126 shape: BoxShape.circle,
127 color: isFilled
128 ? Theme.of(context).primaryTextTheme.title.color
129 - : Theme.of(context).primaryTextTheme.caption.color,
129 + : Theme.of(context).accentTextTheme.body1.color,
130 ));
131 }),
132 ),
@@ -143,7 +143,8 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
143 _changePinLengthText(),
144 style: TextStyle(
145 fontSize: 14.0,
146 - color: Theme.of(context).primaryTextTheme.caption.color),
146 + fontWeight: FontWeight.normal,
147 + color: Theme.of(context).accentTextTheme.body1.decorationColor),
148 ))
149 ],
150 Spacer(flex: 1),
@@ -227,7 +228,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
228 child: Text('$index',
229 style: TextStyle(
230 fontSize: 30.0,
230 - fontWeight: FontWeight.bold,
231 + fontWeight: FontWeight.w600,
232 color: Theme.of(context)
233 .primaryTextTheme
234 .title
lib/src/screens/settings/change_language.dart
+31 -67
@@ -1,3 +1,5 @@
1 +import 'package:cake_wallet/src/screens/settings/widgets/language_row.dart';
2 +import 'package:cake_wallet/src/widgets/standard_list.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
5 import 'package:provider/provider.dart';
@@ -16,29 +18,13 @@ class ChangeLanguage extends BasePage {
18 final settingsStore = Provider.of<SettingsStore>(context);
19 final currentLanguage = Provider.of<Language>(context);
20
19 - final currentColor = Colors.green;
20 - final notCurrentColor = Theme.of(context).primaryTextTheme.title.color;
21 -
22 - final shortDivider = Container(
23 - height: 1,
24 - padding: EdgeInsets.only(left: 24),
25 - color: Theme.of(context).accentTextTheme.title.backgroundColor,
26 - child: Container(
27 - height: 1,
28 - color: Theme.of(context).dividerColor,
29 - ),
30 - );
31 -
32 - final longDivider = Container(
33 - height: 1,
34 - color: Theme.of(context).dividerColor,
35 - );
36 -
21 return Container(
22 padding: EdgeInsets.only(top: 10.0),
39 - child: ListView.builder(
40 - itemCount: languages.values.length,
41 - itemBuilder: (BuildContext context, int index) {
23 + child: SectionStandardList(
24 + sectionCount: 1,
25 + context: context,
26 + itemCounter: (int sectionIndex) => languages.values.length,
27 + itemBuilder: (_, sectionIndex, index) {
28 final item = languages.values.elementAt(index);
29 final code = languages.keys.elementAt(index);
30
@@ -46,52 +32,30 @@ class ChangeLanguage extends BasePage {
32 ? false
33 : code == settingsStore.languageCode;
34
49 - return Column(
50 - children: <Widget>[
51 - index == 0 ? longDivider : Offstage(),
52 - Container(
53 - padding: EdgeInsets.only(top: 4, bottom: 4),
54 - color: Theme.of(context).accentTextTheme.title.backgroundColor,
55 - child: ListTile(
56 - contentPadding: EdgeInsets.only(left: 24, right: 24),
57 - title: Text(
58 - item,
59 - style: TextStyle(
60 - fontSize: 14.0,
61 - fontWeight: FontWeight.w600,
62 - color: isCurrent ? currentColor : notCurrentColor
63 - ),
64 - ),
65 - trailing: isCurrent
66 - ? Icon(Icons.done, color: currentColor)
67 - : Offstage(),
68 - onTap: () async {
69 - if (!isCurrent) {
70 - await showDialog<void>(
71 - context: context,
72 - builder: (BuildContext context) {
73 - return AlertWithTwoActions(
74 - alertTitle: S.of(context).change_language,
75 - alertContent: S.of(context).change_language_to(item),
76 - leftButtonText: S.of(context).change,
77 - rightButtonText: S.of(context).cancel,
78 - actionLeftButton: () {
79 - settingsStore.saveLanguageCode(
80 - languageCode: code);
81 - currentLanguage.setCurrentLanguage(code);
82 - Navigator.of(context).pop();
83 - },
84 - actionRightButton: () => Navigator.of(context).pop()
85 - );
86 - });
87 - }
88 - },
89 - ),
90 - ),
91 - item == languages.values.last
92 - ? longDivider
93 - : shortDivider
94 - ],
35 + return LanguageRow(
36 + title: item,
37 + isSelected: isCurrent,
38 + handler: (context) async {
39 + if (!isCurrent) {
40 + await showDialog<void>(
41 + context: context,
42 + builder: (BuildContext context) {
43 + return AlertWithTwoActions(
44 + alertTitle: S.of(context).change_language,
45 + alertContent: S.of(context).change_language_to(item),
46 + leftButtonText: S.of(context).change,
47 + rightButtonText: S.of(context).cancel,
48 + actionLeftButton: () {
49 + settingsStore.saveLanguageCode(
50 + languageCode: code);
51 + currentLanguage.setCurrentLanguage(code);
52 + Navigator.of(context).pop();
53 + },
54 + actionRightButton: () => Navigator.of(context).pop()
55 + );
56 + });
57 + }
58 + },
59 );
60 },
61 )
lib/src/screens/settings/settings.dart
+12 -1
@@ -1,3 +1,5 @@
1 +import 'package:cake_wallet/src/screens/settings/widgets/settings_version_cell.dart';
2 +import 'package:cake_wallet/view_model/settings/version_list_item.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
5 import 'package:flutter_mobx/flutter_mobx.dart';
@@ -41,6 +43,8 @@ class SettingsPage extends BasePage {
43 return SettingsPickerCell<dynamic>(
44 title: item.title,
45 selectedItem: item.selectedItem(),
46 + setItem: (dynamic value) => item.setItem(value),
47 + isAlwaysShowScrollThumb: item.isAlwaysShowScrollThumb,
48 items: item.items);
49 });
50 }
@@ -55,7 +59,7 @@ class SettingsPage extends BasePage {
59 }
60
61 if (item is RegularListItem) {
58 - return SettingsCellWithArrow(title: item.title);
62 + return SettingsCellWithArrow(title: item.title, handler: item.handler);
63 }
64
65 if (item is LinkListItem) {
@@ -66,6 +70,13 @@ class SettingsPage extends BasePage {
70 linkTitle: item.linkTitle);
71 }
72
73 + if (item is VersionListItem) {
74 + return Observer(builder: (_) {
75 + return SettingsVersionCell(
76 + title: S.of(context).version(settingsViewModel.currentVersion));
77 + });
78 + }
79 +
80 return Container();
81 });
82 }
lib/src/screens/settings/widgets/language_row.dart new
+30
@@ -0,0 +1,30 @@
1 +import 'package:cake_wallet/palette.dart';
2 +import 'package:flutter/material.dart';
3 +import 'package:cake_wallet/src/widgets/standard_list.dart';
4 +
5 +class LanguageRow extends StandardListRow {
6 + LanguageRow({@required String title, @required this.isSelected, @required Function(BuildContext context) handler}) :
7 + super(title: title, isSelected: isSelected, onTap: handler);
8 +
9 + @override
10 + final bool isSelected;
11 +
12 + @override
13 + Widget buildCenter(BuildContext context, {@required bool hasLeftOffset}) {
14 + return Expanded(
15 + child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
16 + if (hasLeftOffset) SizedBox(width: 10),
17 + Text(title,
18 + style: TextStyle(
19 + fontSize: 14,
20 + fontWeight: FontWeight.w500,
21 + color: titleColor(context)))
22 + ]));
23 + }
24 +
25 + @override
26 + Widget buildTrailing(BuildContext context) =>
27 + isSelected
28 + ? Icon(Icons.done, color: Palette.blueCraiola)
29 + : Offstage();
30 +}
\ No newline at end of file
lib/src/screens/settings/widgets/settings_cell_with_arrow.dart
+3 -3
@@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
2 import 'package:cake_wallet/src/widgets/standard_list.dart';
3
4 class SettingsCellWithArrow extends StandardListRow {
5 - SettingsCellWithArrow({@required String title})
6 - : super(title: title, isSelected: false);
5 + SettingsCellWithArrow({@required String title, @required Function(BuildContext context) handler})
6 + : super(title: title, isSelected: false, onTap: handler);
7
8 @override
9 Widget buildTrailing(BuildContext context) =>
10 Image.asset('assets/images/select_arrow.png',
11 - color: Theme.of(context).primaryTextTheme.caption.color);
11 + color: Theme.of(context).primaryTextTheme.overline.color);
12 }
\ No newline at end of file
lib/src/screens/settings/widgets/settings_link_provider_cell.dart
+10 -2
@@ -1,5 +1,7 @@
1 +import 'package:cake_wallet/palette.dart';
2 import 'package:flutter/material.dart';
3 import 'package:cake_wallet/src/widgets/standard_list.dart';
4 +import 'package:url_launcher/url_launcher.dart';
5
6 class SettingsLinkProviderCell extends StandardListRow {
7 SettingsLinkProviderCell(
@@ -7,7 +9,7 @@ class SettingsLinkProviderCell extends StandardListRow {
9 @required this.icon,
10 @required this.link,
11 @required this.linkTitle})
10 - : super(title: title, isSelected: false);
12 + : super(title: title, isSelected: false, onTap: (BuildContext context) => _launchUrl(link) );
13
14 final String icon;
15 final String link;
@@ -20,5 +22,11 @@ class SettingsLinkProviderCell extends StandardListRow {
22 @override
23 Widget buildTrailing(BuildContext context) => Text(linkTitle,
24 style: TextStyle(
23 - fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.blue));
25 + fontSize: 14.0,
26 + fontWeight: FontWeight.w500,
27 + color: Palette.blueCraiola));
28 +
29 + static void _launchUrl(String url) async {
30 + if (await canLaunch(url)) await launch(url);
31 + }
32 }
\ No newline at end of file
lib/src/screens/settings/widgets/settings_picker_cell.dart
+7 -3
@@ -4,7 +4,8 @@ import 'package:cake_wallet/src/widgets/standard_list.dart';
4 import 'package:cake_wallet/generated/i18n.dart';
5
6 class SettingsPickerCell<ItemType> extends StandardListRow {
7 - SettingsPickerCell({@required String title, this.selectedItem, this.items})
7 + SettingsPickerCell({@required String title, this.selectedItem, this.items,
8 + this.setItem, this.isAlwaysShowScrollThumb})
9 : super(
10 title: title,
11 isSelected: false,
@@ -18,11 +19,14 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
19 selectedAtIndex: selectedAtIndex,
20 title: S.current.please_select,
21 mainAxisAlignment: MainAxisAlignment.center,
21 - onItemSelected: (Object _) {}));
22 + isAlwaysShowScrollThumb: isAlwaysShowScrollThumb,
23 + onItemSelected: (ItemType value) => setItem(value)));
24 });
25
26 final ItemType selectedItem;
27 final List<ItemType> items;
28 + final Function(ItemType) setItem;
29 + final bool isAlwaysShowScrollThumb;
30
31 @override
32 Widget buildTrailing(BuildContext context) {
@@ -32,7 +36,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
36 style: TextStyle(
37 fontSize: 14.0,
38 fontWeight: FontWeight.w500,
35 - color: Theme.of(context).primaryTextTheme.caption.color),
39 + color: Theme.of(context).primaryTextTheme.overline.color),
40 );
41 }
42 }
\ No newline at end of file
lib/src/screens/settings/widgets/settings_version_cell.dart new
+28
@@ -0,0 +1,28 @@
1 +import 'package:flutter/material.dart';
2 +
3 +class SettingsVersionCell extends StatelessWidget {
4 + SettingsVersionCell({@required this.title});
5 +
6 + final String title;
7 +
8 + @override
9 + Widget build(BuildContext context) {
10 + return Padding(
11 + padding: EdgeInsets.only(bottom: 24),
12 + child: Row(
13 + mainAxisSize: MainAxisSize.max,
14 + mainAxisAlignment: MainAxisAlignment.center,
15 + children: <Widget>[
16 + Text(
17 + title,
18 + style: TextStyle(
19 + fontSize: 12,
20 + fontWeight: FontWeight.normal,
21 + color: Theme.of(context).primaryTextTheme.overline.color
22 + ),
23 + )
24 + ],
25 + ),
26 + );
27 + }
28 +}
\ No newline at end of file
lib/src/screens/setup_pin_code/setup_pin_code.dart
+1 -1
@@ -53,7 +53,7 @@ class _SetupPinCodeFormState<WidgetType extends SetupPinCodeForm>
53 state.clear();
54 } else {
55 if (listEquals<int>(state.pin, _originalPin)) {
56 - final String pin = state.pin.fold("", (ac, val) => ac + '$val');
56 + final String pin = state.pin.fold('', (ac, val) => ac + '$val');
57 _userStore.set(password: pin);
58 _settingsStore.setDefaultPinLength(pinLength: state.pinLength);
59
lib/src/widgets/picker.dart
+1 -3
@@ -123,9 +123,7 @@ class PickerState<Item> extends State<Picker> {
123 mainAxisAlignment: widget.mainAxisAlignment,
124 crossAxisAlignment: CrossAxisAlignment.center,
125 children: <Widget>[
126 - image != null
127 - ? image
128 - : Offstage(),
126 + image ?? Offstage(),
127 Padding(
128 padding: EdgeInsets.only(
129 left: image != null ? 12 : 0
lib/src/widgets/standard_list.dart
+10 -7
@@ -41,18 +41,17 @@ class StandardListRow extends StatelessWidget {
41 style: TextStyle(
42 fontSize: 14,
43 fontWeight: FontWeight.normal,
44 - color: _titleColor(context)))
44 + color: titleColor(context)))
45 ]));
46 }
47
48 Widget buildTrailing(BuildContext context) => null;
49
50 - Color _titleColor(BuildContext context) => isSelected
50 + Color titleColor(BuildContext context) => isSelected
51 ? Palette.blueCraiola
52 : Theme.of(context).primaryTextTheme.title.color;
53
54 Color _backgroundColor(BuildContext context) {
55 -// return Theme.of(context).accentTextTheme.subtitle.decorationColor;
55 return Theme.of(context).backgroundColor;
56 }
57 }
@@ -114,16 +113,20 @@ class SectionStandardList extends StatelessWidget {
113 {@required this.itemCounter,
114 @required this.itemBuilder,
115 @required this.sectionCount,
116 + this.hasTopSeparator = false,
117 BuildContext context})
118 - : totalRows = transform(context, sectionCount, itemCounter, itemBuilder);
118 + : totalRows = transform(hasTopSeparator, context, sectionCount,
119 + itemCounter, itemBuilder);
120
121 final int sectionCount;
122 + final bool hasTopSeparator;
123 final int Function(int sectionIndex) itemCounter;
124 final Widget Function(BuildContext context, int sectionIndex, int itemIndex)
125 itemBuilder;
126 final List<Widget> totalRows;
127
128 static List<Widget> transform(
129 + bool hasTopSeparator,
130 BuildContext context,
131 int sectionCount,
132 int Function(int sectionIndex) itemCounter,
@@ -132,9 +135,9 @@ class SectionStandardList extends StatelessWidget {
135 final items = <Widget>[];
136
137 for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
135 - /*if (sectionIndex == 0) {
136 - items.add(StandardListSeparator());
137 - }*/
138 + if ((sectionIndex == 0)&&(hasTopSeparator)) {
139 + items.add(StandardListSeparator(padding: EdgeInsets.only(left: 24)));
140 + }
141
142 final itemCount = itemCounter(sectionIndex);
143
lib/src/widgets/standart_switch.dart
+1 -1
@@ -26,7 +26,7 @@ class StandartSwitchState extends State<StandartSwitch> {
26 decoration: BoxDecoration(
27 color: widget.value
28 ? Colors.green
29 - : PaletteDark.distantBlue,
29 + : Theme.of(context).accentTextTheme.display4.color,
30 borderRadius: BorderRadius.all(Radius.circular(14.0))),
31 child: Container(
32 width: 24.0,
lib/themes.dart
+14
@@ -160,6 +160,13 @@ class Themes {
160 color: Palette.darkGray, // hint text (new wallet page)
161 decorationColor: Palette.periwinkleCraiola // underline (new wallet page)
162 ),
163 + display4: TextStyle(
164 + color: Palette.darkGray, // switch background (settings page)
165 + ),
166 + body1: TextStyle(
167 + color: Palette.darkGray, // indicators (PIN code)
168 + decorationColor: Palette.darkGray // switch (PIN code)
169 + )
170 ),
171
172
@@ -331,6 +338,13 @@ class Themes {
338 color: PaletteDark.cyanBlue, // hint text (new wallet page)
339 decorationColor: PaletteDark.darkGrey // underline (new wallet page)
340 ),
341 + display4: TextStyle(
342 + color: PaletteDark.deepVioletBlue, // switch background (settings page)
343 + ),
344 + body1: TextStyle(
345 + color: PaletteDark.indicatorVioletBlue, // indicators (PIN code)
346 + decorationColor: PaletteDark.lightPurpleBlue // switch (PIN code)
347 + )
348 ),
349
350
lib/view_model/settings/picker_list_item.dart
+5 -1
@@ -5,9 +5,13 @@ class PickerListItem<ItemType> extends SettingsListItem {
5 PickerListItem(
6 {@required String title,
7 @required this.selectedItem,
8 - @required this.items})
8 + @required this.setItem,
9 + @required this.items,
10 + this.isAlwaysShowScrollThumb = false})
11 : super(title);
12
13 final ItemType Function() selectedItem;
14 + final Function(ItemType value) setItem;
15 final List<ItemType> items;
16 + final bool isAlwaysShowScrollThumb;
17 }
lib/view_model/settings/settings_view_model.dart
+33
@@ -1,6 +1,7 @@
1 import 'package:cake_wallet/di.dart';
2 import 'package:cake_wallet/store/theme_changer_store.dart';
3 import 'package:cake_wallet/themes.dart';
4 +import 'package:cake_wallet/view_model/settings/version_list_item.dart';
5 import 'package:flutter/cupertino.dart';
6 import 'package:mobx/mobx.dart';
7 import 'package:cake_wallet/routes.dart';
@@ -17,6 +18,7 @@ import 'package:cake_wallet/view_model/settings/picker_list_item.dart';
18 import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
19 import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
20 import 'package:cake_wallet/view_model/settings/switcher_list_item.dart';
21 +import 'package:package_info/package_info.dart';
22
23 part 'settings_view_model.g.dart';
24
@@ -24,19 +26,27 @@ class SettingsViewModel = SettingsViewModelBase with _$SettingsViewModel;
26
27 abstract class SettingsViewModelBase with Store {
28 SettingsViewModelBase(this._settingsStore) : itemHeaders = {} {
29 + currentVersion = '';
30 + PackageInfo.fromPlatform().then((PackageInfo packageInfo) => currentVersion = packageInfo.version);
31 +
32 sections = [
33 [
34 PickerListItem(
35 title: S.current.settings_display_balance_as,
36 items: BalanceDisplayMode.all,
37 + setItem: (dynamic value) => balanceDisplayMode = value as BalanceDisplayMode,
38 selectedItem: () => balanceDisplayMode),
39 PickerListItem(
40 title: S.current.settings_currency,
41 items: FiatCurrency.all,
42 + setItem: (dynamic value) => fiatCurrency = value as FiatCurrency,
43 + isAlwaysShowScrollThumb: true,
44 selectedItem: () => fiatCurrency),
45 PickerListItem(
46 title: S.current.settings_fee_priority,
47 items: TransactionPriority.all,
48 + setItem: (dynamic value) => transactionPriority = value as TransactionPriority,
49 + isAlwaysShowScrollThumb: true,
50 selectedItem: () => transactionPriority),
51 SwitcherListItem(
52 title: S.current.settings_save_recipient_address,
@@ -111,11 +121,22 @@ abstract class SettingsViewModelBase with Store {
121 title: S.current.settings_terms_and_conditions,
122 handler: (BuildContext context) =>
123 Navigator.of(context).pushNamed(Routes.disclaimer),
124 + ),
125 + RegularListItem(
126 + title: S.current.faq,
127 + handler: (BuildContext context) =>
128 + Navigator.pushNamed(context, Routes.faq),
129 )
130 + ],
131 + [
132 + VersionListItem(title: currentVersion)
133 ]
134 ];
135 }
136
137 + @observable
138 + String currentVersion;
139 +
140 @computed
141 Node get node => _settingsStore.node;
142
@@ -150,6 +171,18 @@ abstract class SettingsViewModelBase with Store {
171 set allowBiometricalAuthentication(bool value) =>
172 _settingsStore.allowBiometricalAuthentication = value;
173
174 + @action
175 + set balanceDisplayMode(BalanceDisplayMode value) =>
176 + _settingsStore.balanceDisplayMode = value;
177 +
178 + @action
179 + set fiatCurrency(FiatCurrency value) =>
180 + _settingsStore.fiatCurrency = value;
181 +
182 + @action
183 + set transactionPriority(TransactionPriority value) =>
184 + _settingsStore.transactionPriority = value;
185 +
186 // @observable
187 // bool isDarkTheme;
188 //
lib/view_model/settings/version_list_item.dart new
+6
@@ -0,0 +1,6 @@
1 +import 'package:flutter/foundation.dart';
2 +import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
3 +
4 +class VersionListItem extends SettingsListItem {
5 + VersionListItem({@required String title}) : super(title);
6 +}
\ No newline at end of file