Skip to content

Commit

Permalink
uiStrings for widgets common, daily, and home widgets; renamed home d…
Browse files Browse the repository at this point in the history
…ialog directory
  • Loading branch information
FelberMartin committed Sep 10, 2024
1 parent e1fab6a commit 7f296af
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 22 deletions.
35 changes: 35 additions & 0 deletions lib/config/flavors/ui_string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ abstract class UiString {
abstract String ttlDailyLevelContainer;
abstract String lblFeatureLockedTillLevel;
abstract String lblLevelIndicator;
abstract String lblHiddenLevelDone;
abstract String lblHiddenLevel;
abstract String btnPlayHiddenLevel;
abstract String lblDailyGoals;

// Settings
abstract String ttlSettings;
Expand All @@ -33,6 +37,9 @@ abstract class UiString {
abstract String ttlDailyLevels;
abstract String smtPreviousMonth;
abstract String smtNextMonth;
abstract String ttlDialogPlayPastDaily;
abstract String lblDialogPlayPastDailySubtitle;
abstract String lblAd;

// Game
abstract String ttlHiddenLevel;
Expand All @@ -57,32 +64,46 @@ abstract class UiString {
class UiStringDe extends UiString {
UiStringDe(super.flavor);

// Home
String btnPlayDailyLevel = "Start";
String ttlDailyLevelContainer = "Tägliches Rätsel";
String lblFeatureLockedTillLevel = "ab Level ${UiString.placeholder}";
String lblLevelIndicator = "Level";
String lblHiddenLevelDone = "Verstecktes Level absolviert!";
String lblHiddenLevel = "Verstecktes Level";
String btnPlayHiddenLevel = "Spielen";
String lblDailyGoals = "Tagesziele";

// Settings
String ttlSettings = "Einstellungen";
String ttlNotifications = "Benachrichtigungen";
String lblNotificationForDailies = "für Tägliche Rätsel";
String ttlPrivacyPolicy = "Datenschutzerklärung";
String lblClickForPrivacyPolicy = "Klicke hier, um unsere Datenschutzerklärung zu lesen (Englisch).";

// DailyOverview
String ttlDailyLevels = "Tägliche Rätsel";
String smtPreviousMonth = "Vorheriger Monat";
String smtNextMonth = "Nächster Monat";
String ttlDialogPlayPastDaily = "Vergangenes tägliches Rätsel!";
String lblDialogPlayPastDailySubtitle = "Aber keine Sorge, du kannst es noch nachholen!";
String lblAd = "Werbung";

// Game
String ttlHiddenLevel = "Verstecktes Level";
String lblChainGameLevel = "Wortkette";

// Ads
String lblDoYouEnjoy = "Gefällt dir";
String lblThenTellYourFriends = "Dann empfehle es deinen Freunden!";
String btnShare = "Teilen";

// Notification
String ttlDefaultNotificationTitle = "Tägliches Rätsel";
List<String> ttlNotificationVariants = ["Wer rastet, der rostet", "Täglich grüßt das Murmeltier"];
String lblNotificationDescription = "Dein tägliches Rätsel wartet noch darauf gelöst zu werden!";

// Misc
late String shareText = "Entdecke jetzt meine neue Lieblings-App '${flavor.storeAppName}'!\n\n"
"Android: ${flavor.playStoreLink}\niOS: ${flavor.appStoreLink}";

Expand All @@ -104,32 +125,46 @@ class UiStringDe extends UiString {
class UiStringEn extends UiString {
UiStringEn(super.flavor);

// Home
String btnPlayDailyLevel = "Play";
String ttlDailyLevelContainer = "Daily Level";
String lblFeatureLockedTillLevel = "from level ${UiString.placeholder}";
String lblLevelIndicator = "Level";
String lblHiddenLevelDone = "Hidden level completed!";
String lblHiddenLevel = "Hidden Level";
String btnPlayHiddenLevel = "Play";
String lblDailyGoals = "Daily Goals";

// Settings
String ttlSettings = "Settings";
String ttlNotifications = "Notifications";
String lblNotificationForDailies = "for Daily Levels";
String ttlPrivacyPolicy = "Privacy Policy";
String lblClickForPrivacyPolicy = "Click here to read our privacy policy.";

// DailyOverview
String ttlDailyLevels = "Daily Levels";
String smtPreviousMonth = "Previous Month";
String smtNextMonth = "Next Month";
String ttlDialogPlayPastDaily = "Past Daily Level!";
String lblDialogPlayPastDailySubtitle = "But don't worry, you can still catch up!";
String lblAd = "Ad";

// Game
String ttlHiddenLevel = "Hidden Level";
String lblChainGameLevel = "Chain";

// Ads
String lblDoYouEnjoy = "Do you enjoy";
String lblThenTellYourFriends = "Then tell your friends!";
String btnShare = "Share";

// Notification
String ttlDefaultNotificationTitle = "Daily Level";
List<String> ttlNotificationVariants = ["Who rests, rusts", "Every day is Groundhog Day"];
String lblNotificationDescription = "Your daily level is waiting to be solved!";

// Misc
late String shareText = "Discover my new favorite app '${flavor.storeAppName}'!\n\n"
"Android: ${flavor.playStoreLink}\niOS: ${flavor.appStoreLink}";

Expand Down
6 changes: 6 additions & 0 deletions lib/util/extensions/format_util.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:intl/intl.dart';

String getThousandSeparator(String locale) {
var format = NumberFormat("#,##0", locale);
return format.symbols.GROUP_SEP;
}
8 changes: 4 additions & 4 deletions lib/util/update_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import 'package:flutter/material.dart';
import 'package:kompositum/data/key_value_store.dart';
import 'package:kompositum/util/app_version_provider.dart';
import 'package:kompositum/widgets/home/dialogs/daily_goals_update_dialog.dart';
import 'package:kompositum/widgets/home/dialogs/ios_update_dialog.dart';
import 'package:kompositum/widgets/home/dialogs/pre_redesign_update_dialog.dart';
import 'package:kompositum/widgets/home/update_dialogs/ios_update_dialog.dart';
import 'package:kompositum/widgets/home/update_dialogs/pre_redesign_update_dialog.dart';
import 'package:kompositum/widgets/home/update_dialogs/redesign_update_dialog.dart';

import '../widgets/home/dialogs/redesign_update_dialog.dart';
import '../widgets/home/update_dialogs/daily_goals_update_dialog.dart';

class UpdateDialog {
final Widget dialog;
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/common/my_app_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:animated_flip_counter/animated_flip_counter.dart';
import 'package:flutter/material.dart';
import 'package:kompositum/config/flavors/flavor.dart';
import 'package:kompositum/util/extensions/format_util.dart';
import 'package:kompositum/widgets/common/util/clip_shadow_path.dart';
import 'package:kompositum/widgets/common/util/corner_radius.dart';
import 'package:kompositum/widgets/common/util/rounded_edge_clipper.dart';
Expand Down Expand Up @@ -47,7 +49,7 @@ class MyDefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
AnimatedFlipCounter(
duration: Duration(milliseconds: animateStarCount ? 300 : 0),
value: starCount,
thousandSeparator: ".",
thousandSeparator: getThousandSeparator(Flavor.instance.locale.languageCode),
textStyle: Theme.of(context).textTheme.labelLarge,
),
SizedBox(width: 4.0),
Expand Down
2 changes: 0 additions & 2 deletions lib/widgets/common/my_bottom_navigation_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ class _MyBottomNavigationBarState extends State<MyBottomNavigationBar> {
key: Key("tabBarHome"),
MyIcons.home
),
label: "Home",
),
BottomNavigationBarItem(
icon: Icon(
key: Key("tabBarDaily"),
MyIcons.daily),
label: "Daily",
),
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:kompositum/config/flavors/flavor.dart';
import 'package:kompositum/config/star_costs_rewards.dart';
import 'package:kompositum/widgets/common/my_buttons.dart';
import 'package:kompositum/widgets/common/my_dialog.dart';
Expand Down Expand Up @@ -35,8 +36,8 @@ class PlayPastDailyDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MyDialog(
title: "Vergangenes tägliches Rätsel!",
subtitle: "Aber keine Sorge, du kannst es noch nachholen!",
title: Flavor.instance.uiString.ttlDialogPlayPastDaily,
subtitle: Flavor.instance.uiString.lblDialogPlayPastDailySubtitle,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expand All @@ -61,7 +62,7 @@ class PlayPastDailyDialog extends StatelessWidget {
onPressed: () {
_close(context, PlayPastDailyDialogResult.playWithAd);
},
text: "Werbung",
text: Flavor.instance.uiString.lblAd,
trailingIcon: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Icon(
Expand Down
17 changes: 12 additions & 5 deletions lib/widgets/home/daily_goals_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:animated_flip_counter/animated_flip_counter.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:kompositum/config/flavors/flavor.dart';
import 'package:kompositum/config/flavors/ui_string.dart';
import 'package:kompositum/config/my_icons.dart';
import 'package:kompositum/config/my_theme.dart';
import 'package:kompositum/data/models/daily_goal_set.dart';
Expand Down Expand Up @@ -243,7 +245,6 @@ class _DailyGoalsContainerState extends State<DailyGoalsContainer> with SingleTi
colors: [
MyColorPalette.of(context).primary,
MyColorPalette.of(context).secondary,
// Color.lerp(MyColorPalette.of(context).secondary, MyColorPalette.of(context).primary, progress)!,
],
stops: [stop1, stop2],
begin: Alignment.centerLeft,
Expand All @@ -259,6 +260,12 @@ class _Locked extends StatelessWidget {

@override
Widget build(BuildContext context) {
String text = Flavor.instance.uiString.lblFeatureLockedTillLevel;
text = text.replaceFirst(
UiString.placeholder,
FeatureLockManager.dailyGoalsFeatureLockLevel.toString()
);

return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
Expand All @@ -271,7 +278,7 @@ class _Locked extends StatelessWidget {
),
SizedBox(width: 8),
Text(
'ab Level ${FeatureLockManager.dailyGoalsFeatureLockLevel}',
text,
style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: MyColorPalette.of(context).textSecondary,
),
Expand All @@ -295,7 +302,7 @@ class _SecretLevelDone extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Verstecktes Level absolviert!',
Flavor.instance.uiString.lblHiddenLevelDone,
style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: MyColorPalette.of(context).onPrimary,
),
Expand Down Expand Up @@ -332,15 +339,15 @@ class _PlaySecretLevel extends StatelessWidget {
SizedBox(width: 12),
Expanded(
child: Text(
'Verstecktes Level',
Flavor.instance.uiString.lblHiddenLevel,
style: Theme.of(context).textTheme.labelSmall!.copyWith(
color: MyColorPalette.of(context).onPrimary,
),
),
),
MySecondaryTextButton(
onPressed: onSecretLevelPlay,
text: 'Spielen',
text: Flavor.instance.uiString.btnPlayHiddenLevel,
),
],
),
Expand Down
12 changes: 6 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,10 @@ packages:
dependency: "direct main"
description:
name: format
sha256: da3aeae9507f9e9ba3bd75308d5c0be14b97b0001abd74eba2e025457869b2a0
sha256: "94f93703645ec4d7d19f02d7d87617a5463169e252c0d45b125f13a54a90d037"
url: "https://pub.dev"
source: hosted
version: "1.5.1"
version: "1.5.2"
frontend_server_client:
dependency: transitive
description:
Expand Down Expand Up @@ -620,10 +620,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.18.1"
version: "0.19.0"
io:
dependency: transitive
description:
Expand Down Expand Up @@ -1113,10 +1113,10 @@ packages:
dependency: "direct main"
description:
name: table_calendar
sha256: "1e3521a3e6d3fc7f645a58b135ab663d458ab12504f1ea7f9b4b81d47086c478"
sha256: "4ca32b2fc919452c9974abd4c6ea611a63e33b9e4f0b8c38dba3ac1f4a6549d1"
url: "https://pub.dev"
source: hosted
version: "3.0.9"
version: "3.1.2"
term_glyph:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies:
cloud_firestore: ^4.13.3
animated_flip_counter: ^0.2.6
flutter_svg: ^2.0.9
intl: ^0.18.1
intl: ^0.19.0
table_calendar: ^3.0.9
objectbox: 2.4.0 # There have been problems with updating eg to 2.5.1
objectbox_flutter_libs: any
Expand Down

0 comments on commit 7f296af

Please sign in to comment.