From c1450b5f4d7cd254f7cb743c81bbddde3719808d Mon Sep 17 00:00:00 2001 From: Jigar-f Date: Wed, 8 Nov 2023 13:34:43 +0530 Subject: [PATCH] Fixed local range issue. --- lib/app.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index de628f448..44a86eef4 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -57,7 +57,8 @@ class LanternApp extends StatelessWidget { void toggleConnectivityWarningIfNecessary() { final shouldShowConnectivityWarning = !sessionModel.networkAvailable.value || - (sessionModel.proxyAvailable.value!=null && sessionModel.proxyAvailable.value==false); + (sessionModel.proxyAvailable.value != null && + sessionModel.proxyAvailable.value == false); if (shouldShowConnectivityWarning != showConnectivityWarning) { showConnectivityWarning = shouldShowConnectivityWarning; if (showConnectivityWarning) { @@ -138,7 +139,13 @@ class LanternApp extends StatelessWidget { return const Locale('en', 'US'); } final codes = lang.split('_'); - return Locale(codes[0], codes[1]); + // Check if the split code has more than one part + if (codes.length > 1) { + return Locale(codes[0], codes[1]); + } else { + // If not, return default locale + return const Locale('en', 'US'); + } } String _getLocaleBasedFont(Locale locale) {