From 480eab397a51448c41981afa46e1911bba98b39a Mon Sep 17 00:00:00 2001 From: Oleksandr Sobol Date: Thu, 27 Feb 2020 19:05:23 +0200 Subject: [PATCH] CWA-176 | changed date format in the date_section_raw and in the dashboard_page according to current locale --- lib/src/screens/dashboard/dashboard_page.dart | 3 +-- lib/src/screens/dashboard/date_section_raw.dart | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index 2d01a8351..753a32fe3 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -112,8 +112,6 @@ class DashboardPageBody extends StatefulWidget { } class DashboardPageBodyState extends State { - static final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm"); - final _connectionStatusObserverKey = GlobalKey(); final _balanceObserverKey = GlobalKey(); final _balanceTitleObserverKey = GlobalKey(); @@ -127,6 +125,7 @@ class DashboardPageBodyState extends State { final actionListStore = Provider.of(context); final syncStore = Provider.of(context); final settingsStore = Provider.of(context); + final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm", settingsStore.languageCode); return Observer( key: _listObserverKey, diff --git a/lib/src/screens/dashboard/date_section_raw.dart b/lib/src/screens/dashboard/date_section_raw.dart index 155bbc22b..fb41f674f 100644 --- a/lib/src/screens/dashboard/date_section_raw.dart +++ b/lib/src/screens/dashboard/date_section_raw.dart @@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/palette.dart'; 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'; class DateSectionRaw extends StatelessWidget { DateSectionRaw({this.date}); - static final dateSectionDateFormat = DateFormat("d MMM"); static final nowDate = DateTime.now(); - final DateTime date; @override @@ -17,6 +17,9 @@ class DateSectionRaw extends StatelessWidget { final isToday = nowDate.day == date.day && nowDate.month == date.month && nowDate.year == date.year; + final settingsStore = Provider.of(context); + final currentLanguage = settingsStore.languageCode; + final dateSectionDateFormat = DateFormat("d MMM", currentLanguage); var title = ""; if (isToday) { @@ -24,7 +27,7 @@ class DateSectionRaw extends StatelessWidget { } else if (diffDays == 0) { title = S.of(context).yesterday; } else if (diffDays > -7 && diffDays < 0) { - final dateFormat = DateFormat("EEEE"); + final dateFormat = DateFormat.EEEE(currentLanguage); title = dateFormat.format(date); } else { title = dateSectionDateFormat.format(date);