From 2d8ad293b92ca83aba72ab3e5e0bb62e91327e60 Mon Sep 17 00:00:00 2001 From: Curtly Critchlow Date: Mon, 18 Nov 2024 20:01:20 -0400 Subject: [PATCH] fix: mandarin and cantonese state is saved across app restarts. --- .../lib/features/settings/models/settings.g.dart | 7 ++++--- packages/dart/npt_flutter/lib/styles/sizes.dart | 5 +---- packages/dart/npt_flutter/lib/util/language.dart | 2 +- packages/dart/npt_flutter/pubspec.lock | 10 +++++----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/dart/npt_flutter/lib/features/settings/models/settings.g.dart b/packages/dart/npt_flutter/lib/features/settings/models/settings.g.dart index 2ccc6be9c..dc01289d3 100644 --- a/packages/dart/npt_flutter/lib/features/settings/models/settings.g.dart +++ b/packages/dart/npt_flutter/lib/features/settings/models/settings.g.dart @@ -11,8 +11,7 @@ Settings _$SettingsFromJson(Map json) => Settings( overrideRelay: json['overrideRelay'] as bool, viewLayout: $enumDecode(_$PreferredViewLayoutEnumMap, json['viewLayout']), darkMode: json['darkMode'] as bool? ?? false, - language: $enumDecodeNullable(_$LanguageEnumMap, json['language']) ?? - Language.english, + language: $enumDecode(_$LanguageEnumMap, json['language']), ); Map _$SettingsToJson(Settings instance) => { @@ -31,5 +30,7 @@ const _$PreferredViewLayoutEnumMap = { const _$LanguageEnumMap = { Language.english: 'en', Language.spanish: 'es', - Language.portuguese: 'pt-br', + Language.portuguese: 'pt', + Language.mandarin: 'cn', + Language.cantonese: 'hk', }; diff --git a/packages/dart/npt_flutter/lib/styles/sizes.dart b/packages/dart/npt_flutter/lib/styles/sizes.dart index 7234716ad..173966b92 100644 --- a/packages/dart/npt_flutter/lib/styles/sizes.dart +++ b/packages/dart/npt_flutter/lib/styles/sizes.dart @@ -150,8 +150,6 @@ class SizeConfig { deviceTextFactor = _mediaQueryData.textScaler.scale(20) / 20; - // print("height is::: $screenHeight"); - if (screenHeight < 1200) { blockSizeHorizontal = screenWidth / 100; blockSizeVertical = screenHeight / 100; @@ -180,7 +178,6 @@ class SizeConfig { // } double res = (val / refWidth) * 100; double temp = res * blockSizeHorizontal; - // print("width$temp"); return temp; } @@ -205,7 +202,7 @@ class SizeConfig { } else { temp = res * safeBlockVertical + (val * 0.2473919523099851) * textFactor; } - // print('$val,$temp,$refHeight,$refWidth'); + final maxSize = val + Sizes.p4; if (temp > maxSize) { return maxSize; diff --git a/packages/dart/npt_flutter/lib/util/language.dart b/packages/dart/npt_flutter/lib/util/language.dart index e2543a82a..20e2406c1 100644 --- a/packages/dart/npt_flutter/lib/util/language.dart +++ b/packages/dart/npt_flutter/lib/util/language.dart @@ -7,7 +7,7 @@ enum Language { english, @JsonValue("es") spanish, - @JsonValue("pt-br") + @JsonValue("pt") portuguese, @JsonValue("cn") mandarin, diff --git a/packages/dart/npt_flutter/pubspec.lock b/packages/dart/npt_flutter/pubspec.lock index 3a7b544e4..2601b3143 100644 --- a/packages/dart/npt_flutter/pubspec.lock +++ b/packages/dart/npt_flutter/pubspec.lock @@ -939,7 +939,7 @@ packages: path: "../noports_core" relative: true source: path - version: "6.2.0" + version: "6.2.1" openssh_ed25519: dependency: transitive description: @@ -1317,10 +1317,10 @@ packages: dependency: "direct main" description: name: socket_connector - sha256: "3c641546699aa58e9ab8be9841627a30af3c1ffcf4461ca5d00d7c56392ab63a" + sha256: "091c83fb214f6ff48dbf38f6e011e148d996cce05487303c5e8a0cd72369b0e2" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.3" source_gen: dependency: transitive description: @@ -1549,10 +1549,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.4" watcher: dependency: transitive description: