CWA-176 | changed date format in the date_section_raw and in the dashboard_page according to current locale
Oleksandr Sobol committed
Feb 27, 2020 at 19:05 UTC
480eab397a51448c41981afa46e1911bba98b39a
2 files changed
+7
-5
lib/src/screens/dashboard/dashboard_page.dart
+1
-2
@@ -112,8 +112,6 @@ class DashboardPageBody extends StatefulWidget {
112
}
113
114
class DashboardPageBodyState extends State<DashboardPageBody> {
115
- static final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm");
116
-
115
final _connectionStatusObserverKey = GlobalKey();
116
final _balanceObserverKey = GlobalKey();
117
final _balanceTitleObserverKey = GlobalKey();
@@ -127,6 +125,7 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
125
final actionListStore = Provider.of<ActionListStore>(context);
126
final syncStore = Provider.of<SyncStore>(context);
127
final settingsStore = Provider.of<SettingsStore>(context);
128
+ final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm", settingsStore.languageCode);
129
130
return Observer(
131
key: _listObserverKey,
lib/src/screens/dashboard/date_section_raw.dart
+6
-3
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
2
import 'package:cake_wallet/palette.dart';
3
import 'package:intl/intl.dart';
4
import 'package:cake_wallet/generated/i18n.dart';
5
+import 'package:provider/provider.dart';
6
+import 'package:cake_wallet/src/stores/settings/settings_store.dart';
7
8
class DateSectionRaw extends StatelessWidget {
9
DateSectionRaw({this.date});
10
9
- static final dateSectionDateFormat = DateFormat("d MMM");
11
static final nowDate = DateTime.now();
11
-
12
final DateTime date;
13
14
@override
@@ -17,6 +17,9 @@ class DateSectionRaw extends StatelessWidget {
17
final isToday = nowDate.day == date.day &&
18
nowDate.month == date.month &&
19
nowDate.year == date.year;
20
+ final settingsStore = Provider.of<SettingsStore>(context);
21
+ final currentLanguage = settingsStore.languageCode;
22
+ final dateSectionDateFormat = DateFormat("d MMM", currentLanguage);
23
var title = "";
24
25
if (isToday) {
@@ -24,7 +27,7 @@ class DateSectionRaw extends StatelessWidget {
27
} else if (diffDays == 0) {
28
title = S.of(context).yesterday;
29
} else if (diffDays > -7 && diffDays < 0) {
27
- final dateFormat = DateFormat("EEEE");
30
+ final dateFormat = DateFormat.EEEE(currentLanguage);
31
title = dateFormat.format(date);
32
} else {
33
title = dateSectionDateFormat.format(date);