From cba4188665905b29463639136b91b0f8867b66d8 Mon Sep 17 00:00:00 2001 From: M Date: Thu, 22 Oct 2020 18:11:52 +0300 Subject: [PATCH] Comments. --- lib/generated/i18n.dart | 2 +- .../dashboard/widgets/date_section_raw.dart | 2 +- .../screens/wallet_list/wallet_list_page.dart | 2 +- lib/utils/date_formatter.dart | 16 ++++++++++++---- pubspec.lock | 14 +++++++------- res/values/strings_en.arb | 2 +- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 3cf819d59..41866be19 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -285,7 +285,7 @@ class S implements WidgetsLocalizations { String get transaction_sent => "Transaction sent!"; String get transactions => "Transactions"; String get transactions_by_date => "Transactions by date"; - String get use => "Use "; + String get use => "Switch to "; String get view_key_private => "View key (private)"; String get view_key_public => "View key (public)"; String get wallet_keys => "Wallet keys"; diff --git a/lib/src/screens/dashboard/widgets/date_section_raw.dart b/lib/src/screens/dashboard/widgets/date_section_raw.dart index 4c0f9c389..6cbe9a181 100644 --- a/lib/src/screens/dashboard/widgets/date_section_raw.dart +++ b/lib/src/screens/dashboard/widgets/date_section_raw.dart @@ -15,7 +15,7 @@ class DateSectionRaw extends StatelessWidget { final isToday = nowDate.day == date.day && nowDate.month == date.month && nowDate.year == date.year; - final dateSectionDateFormat = DateFormatter.withCurrentLocal(); + final dateSectionDateFormat = DateFormatter.withCurrentLocal(hasTime: false); var title = ""; if (isToday) { diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index da329bece..75f78c658 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -165,7 +165,7 @@ class WalletListBodyState extends State { bottomSection: Column(children: [ PrimaryImageButton( onPressed: () => - Navigator.of(context).pushNamed(Routes.newWalletType), + Navigator.of(context).pushNamed(Routes.newWallet), image: newWalletImage, text: S.of(context).wallet_list_create_new_wallet, color: Theme.of(context).accentTextTheme.subtitle.decorationColor, diff --git a/lib/utils/date_formatter.dart b/lib/utils/date_formatter.dart index 9707a9a70..f75c4d729 100644 --- a/lib/utils/date_formatter.dart +++ b/lib/utils/date_formatter.dart @@ -3,13 +3,21 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/store/settings_store.dart'; class DateFormatter { - static String get currentLocalFormat { + static String currentLocalFormat({bool hasTime = true}) { final isUSA = getIt.get().languageCode.toLowerCase() == 'en'; - final format = isUSA ? 'yyyy.MM.dd, HH:mm' : 'dd.MM.yyyy, HH:mm'; + final format = + isUSA ? usaStyleFormat(hasTime) : regularStyleFormat(hasTime); return format; } - static DateFormat withCurrentLocal() => - DateFormat(currentLocalFormat, getIt.get().languageCode); + static DateFormat withCurrentLocal({bool hasTime = true}) => DateFormat( + currentLocalFormat(hasTime: hasTime), + getIt.get().languageCode); + + static String usaStyleFormat(bool hasTime) => + hasTime ? 'yyyy.MM.dd, HH:mm' : 'yyyy.MM.dd'; + + static String regularStyleFormat(bool hasTime) => + hasTime ? 'dd.MM.yyyy, HH:mm' : 'dd.MM.yyyy'; } diff --git a/pubspec.lock b/pubspec.lock index 973e3cd7b..b745cd3f5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -133,7 +133,7 @@ packages: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" + version: "1.4.2" build_runner: dependency: "direct dev" description: @@ -273,7 +273,7 @@ packages: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.7" + version: "1.3.8" dartx: dependency: transitive description: @@ -930,14 +930,14 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.5" + version: "5.7.6" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+1" + version: "0.0.1+3" url_launcher_macos: dependency: transitive description: @@ -951,14 +951,14 @@ packages: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.8" + version: "1.0.9" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.4+1" + version: "0.1.5" url_launcher_windows: dependency: transitive description: @@ -1024,4 +1024,4 @@ packages: version: "2.2.1" sdks: dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + flutter: ">=1.22.0 <2.0.0" diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 2ec1150dc..3904e8401 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -131,7 +131,7 @@ "add_new_node" : "Add new node", - "use" : "Use ", + "use" : "Switch to ", "digit_pin" : "-digit PIN",