Put change language option behind ff (#985)
This commit is contained in:
commit
3918e85614
|
@ -1,3 +1,4 @@
|
|||
import "package:flutter/foundation.dart";
|
||||
import "package:flutter/widgets.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import "package:shared_preferences/shared_preferences.dart";
|
||||
|
@ -9,11 +10,11 @@ extension AppLocalizationsX on BuildContext {
|
|||
// list of locales which are enabled for auth app.
|
||||
// Add more language to the list only when at least 90% of the strings are
|
||||
// translated in the corresponding language.
|
||||
const List<Locale> appSupportedLocales = <Locale>[
|
||||
Locale('en'),
|
||||
Locale('fr'),
|
||||
Locale("nl")
|
||||
];
|
||||
const List<Locale> appSupportedLocales = kDebugMode
|
||||
? <Locale>[Locale('en'), Locale('fr'), Locale("nl")]
|
||||
: <Locale>[
|
||||
Locale('en'),
|
||||
];
|
||||
|
||||
Locale localResolutionCallBack(locales, supportedLocales) {
|
||||
for (Locale locale in locales) {
|
||||
|
|
|
@ -3,6 +3,7 @@ import "package:photos/app.dart";
|
|||
import "package:photos/generated/l10n.dart";
|
||||
import "package:photos/l10n/l10n.dart";
|
||||
import 'package:photos/services/billing_service.dart';
|
||||
import "package:photos/services/feature_flag_service.dart";
|
||||
import 'package:photos/services/user_service.dart';
|
||||
import 'package:photos/theme/ente_theme.dart';
|
||||
import 'package:photos/ui/advanced_settings_screen.dart';
|
||||
|
@ -27,21 +28,10 @@ class GeneralSectionWidget extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget _getSectionOptions(BuildContext context) {
|
||||
final bool showLanguageChangeOption =
|
||||
FeatureFlagService.instance.isInternalUserOrDebugBuild();
|
||||
return Column(
|
||||
children: [
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: S.of(context).familyPlans,
|
||||
),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
showOnlyLoadingState: true,
|
||||
onTap: () async {
|
||||
await _onFamilyPlansTapped(context);
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
|
@ -59,6 +49,46 @@ class GeneralSectionWidget extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: S.of(context).familyPlans,
|
||||
),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
showOnlyLoadingState: true,
|
||||
onTap: () async {
|
||||
await _onFamilyPlansTapped(context);
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
showLanguageChangeOption
|
||||
? MenuItemWidget(
|
||||
captionedTextWidget:
|
||||
CaptionedTextWidget(title: S.of(context).language),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
onTap: () async {
|
||||
final locale = await getLocale();
|
||||
routeToPage(
|
||||
context,
|
||||
LanguageSelectorPage(
|
||||
appSupportedLocales,
|
||||
(locale) async {
|
||||
await setLocale(locale);
|
||||
EnteApp.setLocale(context, locale);
|
||||
S.load(locale);
|
||||
},
|
||||
locale,
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
showLanguageChangeOption
|
||||
? sectionOptionSpacing
|
||||
: const SizedBox.shrink(),
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: S.of(context).advanced,
|
||||
|
@ -71,29 +101,6 @@ class GeneralSectionWidget extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget:
|
||||
CaptionedTextWidget(title: S.of(context).language),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
onTap: () async {
|
||||
final locale = await getLocale();
|
||||
routeToPage(
|
||||
context,
|
||||
LanguageSelectorPage(
|
||||
appSupportedLocales,
|
||||
(locale) async {
|
||||
await setLocale(locale);
|
||||
EnteApp.setLocale(context, locale);
|
||||
S.load(locale);
|
||||
},
|
||||
locale,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue