mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-02-02 11:16:26 +00:00
CWA-180 | added getCurrentDateFormat() to settings store, refactored date_section_raw, trade_details_page, transaction_details_page, dashboard_page
This commit is contained in:
parent
75c33370f1
commit
3d0d0521e4
5 changed files with 19 additions and 15 deletions
|
@ -1,5 +1,4 @@
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
import 'package:date_range_picker/date_range_picker.dart' as date_rage_picker;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -125,9 +124,9 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
|
||||||
final actionListStore = Provider.of<ActionListStore>(context);
|
final actionListStore = Provider.of<ActionListStore>(context);
|
||||||
final syncStore = Provider.of<SyncStore>(context);
|
final syncStore = Provider.of<SyncStore>(context);
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final transactionDateFormat = settingsStore.currentLocale == 'en_US'
|
final transactionDateFormat = settingsStore.getCurrentDateFormat(
|
||||||
? DateFormat("MMMM d, yyyy, HH:mm", settingsStore.languageCode)
|
formatUSA: "MMMM d, yyyy, HH:mm",
|
||||||
: DateFormat("d MMMM yyyy, HH:mm", settingsStore.languageCode);
|
formatDefault: "d MMMM yyyy, HH:mm");
|
||||||
|
|
||||||
return Observer(
|
return Observer(
|
||||||
key: _listObserverKey,
|
key: _listObserverKey,
|
||||||
|
|
|
@ -19,9 +19,9 @@ class DateSectionRaw extends StatelessWidget {
|
||||||
nowDate.year == date.year;
|
nowDate.year == date.year;
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final currentLanguage = settingsStore.languageCode;
|
final currentLanguage = settingsStore.languageCode;
|
||||||
final dateSectionDateFormat = settingsStore.currentLocale == 'en_US'
|
final dateSectionDateFormat = settingsStore.getCurrentDateFormat(
|
||||||
? DateFormat("MMM d", settingsStore.languageCode)
|
formatUSA: "MMM d",
|
||||||
: DateFormat("d MMM", settingsStore.languageCode);
|
formatDefault: "d MMM");
|
||||||
var title = "";
|
var title = "";
|
||||||
|
|
||||||
if (isToday) {
|
if (isToday) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ 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/src/screens/transaction_details/standart_list_item.dart';
|
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
|
||||||
import 'package:cake_wallet/src/screens/transaction_details/standart_list_row.dart';
|
import 'package:cake_wallet/src/screens/transaction_details/standart_list_row.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
class TradeDetailsPage extends BasePage {
|
class TradeDetailsPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
|
@ -22,9 +21,9 @@ class TradeDetailsPage extends BasePage {
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
final exchangeStore = Provider.of<ExchangeTradeStore>(context);
|
final exchangeStore = Provider.of<ExchangeTradeStore>(context);
|
||||||
final settingsStore = Provider.of<SettingsStore>(context);
|
final settingsStore = Provider.of<SettingsStore>(context);
|
||||||
final createdAtFormat = settingsStore.currentLocale == 'en_US'
|
final createdAtFormat = settingsStore.getCurrentDateFormat(
|
||||||
? DateFormat('yyyy.MM.dd, HH:mm')
|
formatUSA: "yyyy.MM.dd, HH:mm",
|
||||||
: DateFormat('dd.MM.yyyy, HH:mm');
|
formatDefault: "dd.MM.yyyy, HH:mm");
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20, right: 15),
|
padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20, right: 15),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -46,9 +45,9 @@ class TransactionDetailsFormState extends State<TransactionDetailsForm> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
final _dateFormat = widget.settingsStore.currentLocale == 'en_US'
|
final _dateFormat = widget.settingsStore.getCurrentDateFormat(
|
||||||
? DateFormat('yyyy.MM.dd, HH:mm')
|
formatUSA: "yyyy.MM.dd, HH:mm",
|
||||||
: DateFormat('dd.MM.yyyy, HH:mm');
|
formatDefault: "dd.MM.yyyy, HH:mm");
|
||||||
final items = [
|
final items = [
|
||||||
StandartListItem(
|
StandartListItem(
|
||||||
title: S.current.transaction_details_transaction_id,
|
title: S.current.transaction_details_transaction_id,
|
||||||
|
|
|
@ -15,6 +15,7 @@ import 'package:cake_wallet/src/domain/common/default_settings_migration.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
import 'package:cake_wallet/src/domain/common/language.dart';
|
import 'package:cake_wallet/src/domain/common/language.dart';
|
||||||
import 'package:devicelocale/devicelocale.dart';
|
import 'package:devicelocale/devicelocale.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
part 'settings_store.g.dart';
|
part 'settings_store.g.dart';
|
||||||
|
|
||||||
|
@ -287,4 +288,10 @@ abstract class SettingsStoreBase with Store {
|
||||||
await changeCurrentNodeToDefault(sharedPreferences: _sharedPreferences, nodes: _nodes);
|
await changeCurrentNodeToDefault(sharedPreferences: _sharedPreferences, nodes: _nodes);
|
||||||
await loadSettings();
|
await loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateFormat getCurrentDateFormat({
|
||||||
|
@required String formatUSA,
|
||||||
|
@required String formatDefault}) => currentLocale == 'en_US'
|
||||||
|
? DateFormat(formatUSA, languageCode)
|
||||||
|
: DateFormat(formatDefault, languageCode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue