CWA-176 | changed date format in the date_section_raw and in the dashboard_page according to current locale

This commit is contained in:
Oleksandr Sobol 2020-02-27 19:05:23 +02:00
parent ed31909694
commit 480eab397a
2 changed files with 7 additions and 5 deletions

View file

@ -112,8 +112,6 @@ class DashboardPageBody extends StatefulWidget {
}
class DashboardPageBodyState extends State<DashboardPageBody> {
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<DashboardPageBody> {
final actionListStore = Provider.of<ActionListStore>(context);
final syncStore = Provider.of<SyncStore>(context);
final settingsStore = Provider.of<SettingsStore>(context);
final transactionDateFormat = DateFormat("MMMM d, yyyy HH:mm", settingsStore.languageCode);
return Observer(
key: _listObserverKey,

View file

@ -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<SettingsStore>(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);