diff --git a/analysis_options.yaml b/analysis_options.yaml index 61b6c4d..df75515 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -22,8 +22,12 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - + avoid_print: true + prefer_single_quotes: true + prefer_interpolation_to_compose_strings: true + sort_pub_dependencies: true + prefer_final_in_for_each: true + prefer_final_parameters: false + curly_braces_in_flow_control_structures: true # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/android/app/build.gradle b/android/app/build.gradle index 2a4a577..360fe61 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,7 +48,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "dev.beamlak.flixquest_v2" - minSdkVersion 21 + minSdkVersion 23 targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -66,6 +66,11 @@ android { buildTypes { release { signingConfig signingConfigs.release + packagingOptions { + jniLibs { + useLegacyPackaging true + } + } } } } diff --git a/android/build.gradle b/android/build.gradle index b42eb3a..73c3a36 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,3 +1,5 @@ +ext.kotlin_version = '2.0.20' + allprojects { repositories { google() @@ -5,10 +7,17 @@ allprojects { } } +ext { + compileSdkVersion = 34 + targetSdkVersion = 33 + appCompatVersion = "1.7.0" +} + rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(':app') + ext.kotlin_version = '2.0.20' } tasks.register("clean", Delete) { diff --git a/android/settings.gradle b/android/settings.gradle index ee4b6b8..95d9828 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -19,7 +19,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false - id "org.jetbrains.kotlin.android" version "1.9.22" apply false + id "org.jetbrains.kotlin.android" version "2.0.20" apply false id "com.google.gms.google-services" version "4.3.8" apply false } diff --git a/lib/api/endpoints.dart b/lib/api/endpoints.dart index 8c85a26..621f259 100644 --- a/lib/api/endpoints.dart +++ b/lib/api/endpoints.dart @@ -77,19 +77,19 @@ class Endpoints { } static String movieSearchUrl(String query, bool includeAdult, String l) { - return "$TMDB_API_BASE_URL/search/movie?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY"; + return '$TMDB_API_BASE_URL/search/movie?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY'; } static String personSearchUrl(String query, bool includeAdult, String l) { - return "$TMDB_API_BASE_URL/search/person?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY"; + return '$TMDB_API_BASE_URL/search/person?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY'; } static String tvSearchUrl(String query, bool includeAdult, String l) { - return "$TMDB_API_BASE_URL/search/tv?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY"; + return '$TMDB_API_BASE_URL/search/tv?query=$query&include_adult=$includeAdult&language=$l&api_key=$TMDB_API_KEY'; } static getPerson(int personId, String l) { - return "$TMDB_API_BASE_URL/person/$personId?api_key=$TMDB_API_KEY&language=$l&append_to_response=movie_credits"; + return '$TMDB_API_BASE_URL/person/$personId?api_key=$TMDB_API_KEY&language=$l&append_to_response=movie_credits'; } static watchProvidersMovies(int providerId, int page, String l) { @@ -416,5 +416,5 @@ class Endpoints { static String getIPTVEndpoint(String baseUrl) { return '$baseUrl' 'daddylive/live'; - } + } } diff --git a/lib/constants/api_constants.dart b/lib/constants/api_constants.dart index f8931f3..037aae8 100644 --- a/lib/constants/api_constants.dart +++ b/lib/constants/api_constants.dart @@ -3,7 +3,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart'; const String TMDB_API_BASE_URL = 'https://api.themoviedb.org/3'; -const String opensubtitlesBaseUrl = "https://api.opensubtitles.com/api/v1"; +const String opensubtitlesBaseUrl = 'https://api.opensubtitles.com/api/v1'; String TMDB_API_KEY = dotenv.env['TMDB_API_KEY']!; String mixpanelKey = dotenv.env['MIXPANEL_API_KEY']!; String openSubtitlesKey = dotenv.env['OPENSUBTITLES_API_KEY']!; @@ -23,6 +23,6 @@ const String FLIXQUEST_UPDATE_URL = String CONSUMET_API = dotenv.env['CONSUMET_URL']!; String CONSUMET_INFO_API = dotenv.env['CONSUMET_URL']!; String flixquestApiUrl = dotenv.env['FLIXQUEST_API_URL']!; -const String STREAMING_SERVER_FLIXHQ = "vidcloud"; -const String STREAMING_SERVER_DCVA = "asianload"; -const String STREAMING_SERVER_ZORO = "vidcloud"; +const String STREAMING_SERVER_FLIXHQ = 'vidcloud'; +const String STREAMING_SERVER_DCVA = 'asianload'; +const String STREAMING_SERVER_ZORO = 'vidcloud'; diff --git a/lib/constants/app_constants.dart b/lib/constants/app_constants.dart index 1a9e811..2672c6c 100644 --- a/lib/constants/app_constants.dart +++ b/lib/constants/app_constants.dart @@ -42,7 +42,7 @@ const kTextSmallAboutBodyStyle = TextStyle( const kTableLeftStyle = TextStyle(overflow: TextOverflow.ellipsis, fontWeight: FontWeight.bold); -const String currentAppVersion = '2.7.0'; +const String currentAppVersion = '2.7.1'; final client = HttpClient(); const retryOptions = RetryOptions( @@ -69,7 +69,9 @@ final List appNames = [ 'flixquest-v2.5.0-4.apk', 'flixquest-v2.5.0-5.apk', 'flixquest-v2.5.0-6.apk', - 'flixquest-v2.6.0.apk' + 'flixquest-v2.6.0.apk', + 'flixquest-v2.7.0.apk', + 'flixquest-v2.7.1.apk' ]; CacheManager cacheProp() { diff --git a/lib/constants/theme_data.dart b/lib/constants/theme_data.dart index 763345d..5ed483c 100644 --- a/lib/constants/theme_data.dart +++ b/lib/constants/theme_data.dart @@ -49,33 +49,33 @@ ThemeData darkThemeData( chipTheme: ChipThemeData(), snackBarTheme: SnackBarThemeData( backgroundColor: isM3Enabled - ? darkDynamicColor?.onBackground ?? Color(0xFFece0da) + ? darkDynamicColor?.onSurface ?? Color(0xFFece0da) : useUserColor - ? color.cs.onBackground + ? color.cs.onSurface : Color(0xFFece0da), contentTextStyle: TextStyle( color: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) + ? darkDynamicColor?.surface ?? Color(0xFF201a17) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFF201a17))), scaffoldBackgroundColor: Color(0xFF161716), radioTheme: RadioThemeData( - fillColor: MaterialStatePropertyAll(isM3Enabled + fillColor: WidgetStatePropertyAll(isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00))), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll( + backgroundColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.onPrimary ?? Colors.white : useUserColor @@ -86,7 +86,7 @@ ThemeData darkThemeData( ), textButtonTheme: TextButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( isM3Enabled ? darkDynamicColor?.primary.withOpacity(0.1) ?? Color(0xFFF57C00).withOpacity(0.1) @@ -94,8 +94,8 @@ ThemeData darkThemeData( ? color.cs.primary.withOpacity(0.1) : Color(0xFFF57C00).withOpacity(0.1), ), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( @@ -141,14 +141,14 @@ ThemeData darkThemeData( ? color.cs.primary : Color(0xFFF57C00), switchTheme: SwitchThemeData( - thumbColor: MaterialStatePropertyAll( + thumbColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - trackColor: MaterialStatePropertyAll( + trackColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primaryContainer ?? Color(0xFF994d02) : useUserColor @@ -182,11 +182,6 @@ ThemeData darkThemeData( : useUserColor ? color.cs.surface : Color(0xFF201a17), - background: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) - : useUserColor - ? color.cs.background - : Color(0xFF201a17), error: isM3Enabled ? darkDynamicColor?.error ?? Color(0xFFffb4ab) : useUserColor @@ -207,11 +202,6 @@ ThemeData darkThemeData( : useUserColor ? color.cs.onSurface : Color(0xFFece0da), - onBackground: isM3Enabled - ? darkDynamicColor?.onBackground ?? Color(0xFFece0da) - : useUserColor - ? color.cs.onBackground - : Color(0xFFece0da), onError: isM3Enabled ? darkDynamicColor?.onError ?? Color(0xFF690005) : useUserColor @@ -267,17 +257,17 @@ ThemeData darkThemeData( : useUserColor ? color.cs.tertiaryContainer : Color(0xFF48491f), - surfaceVariant: isM3Enabled - ? darkDynamicColor?.surfaceVariant ?? Color(0xFF52443c) + surfaceContainerHighest: isM3Enabled + ? darkDynamicColor?.surfaceContainerHighest ?? Color(0xFF52443c) : useUserColor - ? color.cs.surfaceVariant + ? color.cs.surfaceContainerHighest : Color(0xFF52443c), brightness: Brightness.dark, ).copyWith( - background: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) + surface: isM3Enabled + ? darkDynamicColor?.surface ?? Color(0xFF201a17) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFF201a17)), ); } @@ -329,33 +319,33 @@ ThemeData lightThemeData( chipTheme: ChipThemeData(), snackBarTheme: SnackBarThemeData( backgroundColor: isM3Enabled - ? lightDynamicColor?.onBackground ?? Color(0xFF201a17) + ? lightDynamicColor?.onSurface ?? Color(0xFF201a17) : useUserColor - ? color.cs.onBackground + ? color.cs.onSurface : Color(0xFF201a17), contentTextStyle: TextStyle( color: isM3Enabled - ? lightDynamicColor?.background ?? Color(0xFFfffbff) + ? lightDynamicColor?.surface ?? Color(0xFFfffbff) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFFfffbff))), scaffoldBackgroundColor: Color(0xFFf5f5f5), radioTheme: RadioThemeData( - fillColor: MaterialStatePropertyAll(isM3Enabled + fillColor: WidgetStatePropertyAll(isM3Enabled ? lightDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00))), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll( + backgroundColor: WidgetStatePropertyAll( isM3Enabled ? lightDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( isM3Enabled ? lightDynamicColor?.onPrimary ?? Colors.white : useUserColor @@ -366,7 +356,7 @@ ThemeData lightThemeData( ), textButtonTheme: TextButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( isM3Enabled ? lightDynamicColor?.primary.withOpacity(0.1) ?? Color(0xFFF57C00).withOpacity(0.1) @@ -374,8 +364,8 @@ ThemeData lightThemeData( ? color.cs.primary.withOpacity(0.1) : Color(0xFFF57C00).withOpacity(0.1), ), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( @@ -421,14 +411,14 @@ ThemeData lightThemeData( ? color.cs.primary : Color(0xFFF57C00), switchTheme: SwitchThemeData( - thumbColor: MaterialStatePropertyAll( + thumbColor: WidgetStatePropertyAll( isM3Enabled ? lightDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - trackColor: MaterialStatePropertyAll( + trackColor: WidgetStatePropertyAll( isM3Enabled ? lightDynamicColor?.primaryContainer ?? Color(0xFF994d02) : useUserColor @@ -462,11 +452,6 @@ ThemeData lightThemeData( : useUserColor ? color.cs.surface : Color(0xFFfffbff), - background: isM3Enabled - ? lightDynamicColor?.background ?? Color(0xFFfffbff) - : useUserColor - ? color.cs.background - : Color(0xFFfffbff), error: isM3Enabled ? lightDynamicColor?.error ?? Color(0xFFba1a1a) : useUserColor @@ -487,11 +472,6 @@ ThemeData lightThemeData( : useUserColor ? color.cs.onSurface : Color(0xFF201a17), - onBackground: isM3Enabled - ? lightDynamicColor?.onBackground ?? Color(0xFF201a17) - : useUserColor - ? color.cs.onBackground - : Color(0xFF201a17), onError: isM3Enabled ? lightDynamicColor?.onError ?? Color(0xFFffffff) : useUserColor @@ -547,17 +527,17 @@ ThemeData lightThemeData( : useUserColor ? color.cs.tertiaryContainer : Color(0xFFe5e6ae), - surfaceVariant: isM3Enabled - ? lightDynamicColor?.surfaceVariant ?? Color(0xFFf4ded3) + surfaceContainerHighest: isM3Enabled + ? lightDynamicColor?.surfaceContainerHighest ?? Color(0xFFf4ded3) : useUserColor - ? color.cs.surfaceVariant + ? color.cs.surfaceContainerHighest : Color(0xFFf4ded3), brightness: Brightness.light, ).copyWith( - background: isM3Enabled - ? lightDynamicColor?.background ?? Color(0xFFfffbff) + surface: isM3Enabled + ? lightDynamicColor?.surface ?? Color(0xFFfffbff) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFFfffbff)), ); } @@ -615,34 +595,34 @@ ThemeData lightsOutThemeData( chipTheme: ChipThemeData(), snackBarTheme: SnackBarThemeData( backgroundColor: isM3Enabled - ? darkDynamicColor?.onBackground ?? Color(0xFFece0da) + ? darkDynamicColor?.onSurface ?? Color(0xFFece0da) : useUserColor - ? color.cs.onBackground + ? color.cs.onSurface : Color(0xFFece0da), contentTextStyle: TextStyle( color: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) + ? darkDynamicColor?.surface ?? Color(0xFF201a17) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFF201a17), )), scaffoldBackgroundColor: Colors.black, radioTheme: RadioThemeData( - fillColor: MaterialStatePropertyAll(isM3Enabled + fillColor: WidgetStatePropertyAll(isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00))), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll( + backgroundColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - foregroundColor: MaterialStatePropertyAll( + foregroundColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.onPrimary ?? Colors.white : useUserColor @@ -653,7 +633,7 @@ ThemeData lightsOutThemeData( ), textButtonTheme: TextButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( isM3Enabled ? darkDynamicColor?.primary.withOpacity(0.1) ?? Color(0xFFF57C00).withOpacity(0.1) @@ -661,8 +641,8 @@ ThemeData lightsOutThemeData( ? color.cs.primary.withOpacity(0.1) : Color(0xFFF57C00).withOpacity(0.1), ), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( @@ -706,14 +686,14 @@ ThemeData lightsOutThemeData( ? color.cs.primary : Color(0xFFF57C00), switchTheme: SwitchThemeData( - thumbColor: MaterialStatePropertyAll( + thumbColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primary ?? Color(0xFFF57C00) : useUserColor ? color.cs.primary : Color(0xFFF57C00), ), - trackColor: MaterialStatePropertyAll( + trackColor: WidgetStatePropertyAll( isM3Enabled ? darkDynamicColor?.primaryContainer ?? Color(0xFF994d02) : useUserColor @@ -747,11 +727,6 @@ ThemeData lightsOutThemeData( : useUserColor ? color.cs.surface : Colors.black, - background: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) - : useUserColor - ? color.cs.background - : Colors.black, error: isM3Enabled ? darkDynamicColor?.error ?? Color(0xFFffb4ab) : useUserColor @@ -772,11 +747,6 @@ ThemeData lightsOutThemeData( : useUserColor ? color.cs.onSurface : Color(0xFFece0da), - onBackground: isM3Enabled - ? darkDynamicColor?.onBackground ?? Color(0xFFece0da) - : useUserColor - ? color.cs.onBackground - : Color(0xFFece0da), onError: isM3Enabled ? darkDynamicColor?.onError ?? Color(0xFF690005) : useUserColor @@ -832,17 +802,17 @@ ThemeData lightsOutThemeData( : useUserColor ? color.cs.tertiaryContainer : Color(0xFF48491f), - surfaceVariant: isM3Enabled - ? darkDynamicColor?.surfaceVariant ?? Color(0xFF52443c) + surfaceContainerHighest: isM3Enabled + ? darkDynamicColor?.surfaceContainerHighest ?? Color(0xFF52443c) : useUserColor - ? color.cs.surfaceVariant + ? color.cs.surfaceContainerHighest : Color(0xFF52443c), brightness: Brightness.dark, ).copyWith( - background: isM3Enabled - ? darkDynamicColor?.background ?? Color(0xFF201a17) + surface: isM3Enabled + ? darkDynamicColor?.surface ?? Color(0xFF201a17) : useUserColor - ? color.cs.background + ? color.cs.surface : Color(0xFF201a17)), ); } @@ -855,11 +825,11 @@ class Styles { required ColorScheme? darkDynamicColor, required BuildContext context, required AppColor appColor}) { - return appThemeMode == "dark" + return appThemeMode == 'dark' ? darkThemeData(isM3Enabled, darkDynamicColor, appColor) - : appThemeMode == "light" + : appThemeMode == 'light' ? lightThemeData(isM3Enabled, lightDynamicColor, appColor) - : appThemeMode == "amoled" + : appThemeMode == 'amoled' ? lightsOutThemeData(isM3Enabled, darkDynamicColor, appColor) : darkThemeData(isM3Enabled, darkDynamicColor, appColor); } diff --git a/lib/flixquest_main.dart b/lib/flixquest_main.dart index a057674..98d8489 100644 --- a/lib/flixquest_main.dart +++ b/lib/flixquest_main.dart @@ -86,14 +86,16 @@ class _FlixQuestState extends State appDependencyProvider.isForcedUpdate = _remoteConfig.getBool('forced_update'); appDependencyProvider.flixhqZoeServer = - _remoteConfig.getString("flixhq_zoe_server"); + _remoteConfig.getString('flixhq_zoe_server'); appDependencyProvider.goMoviesServer = - _remoteConfig.getString("gomovies_server"); + _remoteConfig.getString('gomovies_server'); appDependencyProvider.vidSrcServer = - _remoteConfig.getString("vidsrc_server"); + _remoteConfig.getString('vidsrc_server'); appDependencyProvider.vidSrcToServer = - _remoteConfig.getString("vidsrcto_server"); - appDependencyProvider.tmdbProxy = _remoteConfig.getString("tmdb_proxy"); + _remoteConfig.getString('vidsrcto_server'); + appDependencyProvider.tmdbProxy = _remoteConfig.getString('tmdb_proxy'); + appDependencyProvider.fetchSubtitles = + _remoteConfig.getBool('fetch_subtitles'); } await requestNotificationPermissions(); } @@ -134,7 +136,7 @@ class _FlixQuestState extends State debugShowCheckedModeBanner: true, home: Scaffold( body: Center( - child: Text(tr("error_occured")), + child: Text(tr('error_occured')), ), ), ); @@ -238,11 +240,11 @@ class _FlixQuestHomePageState extends State appDep.streamingServerZoro = remoteConfig.getString('streaming_server_zoro'); appDep.isForcedUpdate = remoteConfig.getBool('forced_update'); - appDep.flixhqZoeServer = remoteConfig.getString("flixhq_zoe_server"); - appDep.goMoviesServer = remoteConfig.getString("gomovies_server"); - appDep.vidSrcServer = remoteConfig.getString("vidsrc_server"); - appDep.vidSrcToServer = remoteConfig.getString("vidsrcto_server"); - appDep.tmdbProxy = remoteConfig.getString("tmdb_proxy"); + appDep.flixhqZoeServer = remoteConfig.getString('flixhq_zoe_server'); + appDep.goMoviesServer = remoteConfig.getString('gomovies_server'); + appDep.vidSrcServer = remoteConfig.getString('vidsrc_server'); + appDep.vidSrcToServer = remoteConfig.getString('vidsrcto_server'); + appDep.tmdbProxy = remoteConfig.getString('tmdb_proxy'); } } @@ -257,9 +259,9 @@ class _FlixQuestHomePageState extends State void checkForcedUpdate() async { await FirebaseRemoteConfig.instance.ensureInitialized(); String appVersion = - FirebaseRemoteConfig.instance.getString("latest_version"); + FirebaseRemoteConfig.instance.getString('latest_version'); bool isForcedUpdate = - FirebaseRemoteConfig.instance.getBool("forced_update"); + FirebaseRemoteConfig.instance.getBool('forced_update'); if (isForcedUpdate && (currentAppVersion != appVersion)) { if (mounted) { Navigator.push(context, MaterialPageRoute(builder: (context) { @@ -298,7 +300,7 @@ class _FlixQuestHomePageState extends State color: Theme.of(context).colorScheme.primary, ), Text( - tr("flixquest_appbar"), + tr('flixquest_appbar'), style: TextStyle( fontFamily: 'PoppinsSB', color: Theme.of(context).primaryColor, diff --git a/lib/functions/function.dart b/lib/functions/function.dart index 9e3eb98..b7e6edc 100644 --- a/lib/functions/function.dart +++ b/lib/functions/function.dart @@ -13,7 +13,7 @@ String episodeSeasonFormatter(int episodeNumber, int seasonNumber) { seasonNumber <= 9 ? 'S0$seasonNumber' : 'S$seasonNumber'; String formattedEpisode = episodeNumber <= 9 ? 'E0$episodeNumber' : 'E$episodeNumber'; - return "$formattedSeason : $formattedEpisode"; + return '$formattedSeason : $formattedEpisode'; } Future requestNotificationPermissions() async { @@ -55,7 +55,7 @@ Future clearTempCache() async { return false; } } catch (e) { - throw Exception("Failed to clear temp files"); + throw Exception('Failed to clear temp files'); } } @@ -69,13 +69,14 @@ Future clearCache() async { return false; } } catch (e) { - throw Exception("Failed to clear cache"); + throw Exception('Failed to clear cache'); } } void fileDelete() async { for (int i = 0; i < appNames.length; i++) { File file = + // ignore: prefer_single_quotes File("${(await getApplicationCacheDirectory()).path}${appNames[i]}"); if (file.existsSync()) { file.delete(); @@ -93,7 +94,7 @@ void updateAndLogTotalStreamingDuration(int durationInSeconds) { // Log the new total duration as a custom event for tracking purposes analytics.logEvent( name: 'total_streaming_duration', - parameters: { + parameters: { 'duration_seconds': totalStreamingDuration, }, ); @@ -103,7 +104,7 @@ String generateCacheKey() { Random random = Random(); List characters = []; - String generatedChars = ""; + String generatedChars = ''; for (var i = 0; i < 26; i++) { characters.add(String.fromCharCode(97 + i)); // Lowercase letters a-z @@ -172,10 +173,11 @@ int createUniqueId() { return DateTime.now().millisecondsSinceEpoch.remainder(100000); } -String buildImageUrl(String baseImage, String proxyUrl, bool isProxyEnabled, BuildContext context) { +String buildImageUrl(String baseImage, String proxyUrl, bool isProxyEnabled, + BuildContext context) { String concatenated = baseImage; if (isProxyEnabled && proxyUrl.isNotEmpty) { - concatenated = "$proxyUrl?destination=$baseImage"; + concatenated = '$proxyUrl?destination=$baseImage'; } return concatenated; diff --git a/lib/functions/network.dart b/lib/functions/network.dart index fad0f9f..b6a49a5 100644 --- a/lib/functions/network.dart +++ b/lib/functions/network.dart @@ -22,11 +22,12 @@ import '/models/genres.dart'; import '/models/movie.dart'; import '../models/live_tv.dart'; -Future> fetchMovies(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchMovies( + String api, bool isProxyEnabled, String proxyUrl) async { MovieList movieList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -41,11 +42,12 @@ Future> fetchMovies(String api, bool isProxyEnabled, String proxyUrl return movieList.movies ?? []; } -Future> fetchCollectionMovies(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchCollectionMovies( + String api, bool isProxyEnabled, String proxyUrl) async { CollectionMovieList collectionMovieList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( () => http.get(Uri.parse(api)).timeout(timeOut), @@ -59,11 +61,12 @@ Future> fetchCollectionMovies(String api, bool isProxyEnabled, Strin return collectionMovieList.movies ?? []; } -Future fetchCollectionDetails(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchCollectionDetails( + String api, bool isProxyEnabled, String proxyUrl) async { CollectionDetails collectionDetails; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( () => http.get(Uri.parse(api)).timeout(timeOut), @@ -77,11 +80,12 @@ Future fetchCollectionDetails(String api, bool isProxyEnabled, String proxyUrl) return collectionDetails; } -Future> fetchPersonMovies(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchPersonMovies( + String api, bool isProxyEnabled, String proxyUrl) async { PersonMoviesList personMoviesList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( () => http.get(Uri.parse(api)).timeout(timeOut), @@ -95,11 +99,12 @@ Future> fetchPersonMovies(String api, bool isProxyEnabled, String pr return personMoviesList.movies ?? []; } -Future fetchImages(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchImages( + String api, bool isProxyEnabled, String proxyUrl) async { Images images; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -113,11 +118,12 @@ Future fetchImages(String api, bool isProxyEnabled, String proxyUrl) asy return images; } -Future fetchPersonImages(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchPersonImages( + String api, bool isProxyEnabled, String proxyUrl) async { PersonImages personImages; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -131,11 +137,12 @@ Future fetchPersonImages(String api, bool isProxyEnabled, String p return personImages; } -Future fetchVideos(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchVideos( + String api, bool isProxyEnabled, String proxyUrl) async { Videos videos; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -149,11 +156,12 @@ Future fetchVideos(String api, bool isProxyEnabled, String proxyUrl) asy return videos; } -Future fetchCredits(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchCredits( + String api, bool isProxyEnabled, String proxyUrl) async { Credits credits; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -167,11 +175,12 @@ Future fetchCredits(String api, bool isProxyEnabled, String proxyUrl) a return credits; } -Future> fetchPerson(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchPerson( + String api, bool isProxyEnabled, String proxyUrl) async { PersonList credits; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -185,11 +194,12 @@ Future> fetchPerson(String api, bool isProxyEnabled, String proxyUr return credits.person ?? []; } -Future> fetchGenre(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchGenre( + String api, bool isProxyEnabled, String proxyUrl) async { GenreList newGenreList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -203,11 +213,12 @@ Future> fetchGenre(String api, bool isProxyEnabled, String proxyUrl return newGenreList.genre ?? []; } -Future fetchSocialLinks(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchSocialLinks( + String api, bool isProxyEnabled, String proxyUrl) async { ExternalLinks externalLinks; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -221,11 +232,12 @@ Future fetchSocialLinks(String api, bool isProxyEnabled, String p return externalLinks; } -Future fetchBelongsToCollection(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchBelongsToCollection( + String api, bool isProxyEnabled, String proxyUrl) async { BelongsToCollection belongsToCollection; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -239,11 +251,12 @@ Future fetchBelongsToCollection(String api, bool isProxyEnabled, String proxyUrl return belongsToCollection; } -Future fetchMovieDetails(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchMovieDetails( + String api, bool isProxyEnabled, String proxyUrl) async { MovieDetails movieDetails; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -265,11 +278,12 @@ Future fetchMovieDetails(String api, bool isProxyEnabled, String p // return credits; // } -Future fetchPersonDetails(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchPersonDetails( + String api, bool isProxyEnabled, String proxyUrl) async { PersonDetails personDetails; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -283,11 +297,12 @@ Future fetchPersonDetails(String api, bool isProxyEnabled, String return personDetails; } -Future fetchWatchProviders(String api, String country, bool isProxyEnabled, String proxyUrl) async { +Future fetchWatchProviders( + String api, String country, bool isProxyEnabled, String proxyUrl) async { WatchProviders watchProviders; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -301,11 +316,12 @@ Future fetchWatchProviders(String api, String country, bool isPr return watchProviders; } -Future> fetchTV(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchTV( + String api, bool isProxyEnabled, String proxyUrl) async { TVList tvList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -319,11 +335,12 @@ Future> fetchTV(String api, bool isProxyEnabled, String proxyUrl) async return tvList.tvSeries ?? []; } -Future fetchTVDetails(String api, bool isProxyEnabled, String proxyUrl) async { +Future fetchTVDetails( + String api, bool isProxyEnabled, String proxyUrl) async { TVDetails tvDetails; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -337,11 +354,12 @@ Future fetchTVDetails(String api, bool isProxyEnabled, String proxyUr return tvDetails; } -Future> fetchPersonTV(String api, bool isProxyEnabled, String proxyUrl) async { +Future> fetchPersonTV( + String api, bool isProxyEnabled, String proxyUrl) async { PersonTVList personTVList; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( (() => http.get(Uri.parse(api)).timeout(timeOut)), @@ -379,7 +397,7 @@ Future getMovie(String api, bool isProxyEnabled, String proxyUrl) async { Movie movie; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( () => http.get(Uri.parse(api)).timeout(timeOut), @@ -397,7 +415,7 @@ Future getTV(String api, bool isProxyEnabled, String proxyUrl) async { TV tv; try { if (isProxyEnabled && proxyUrl.isNotEmpty) { - api = "$proxyUrl?destination=$api"; + api = '$proxyUrl?destination=$api'; } var res = await retryOptions.retry( () => http.get(Uri.parse(api)).timeout(timeOut), @@ -573,8 +591,8 @@ Future getTVStreamLinksAndSubsFlixHQ(String api) async { Future getVttFileAsString(String url) async { try { var response = await retryOptions.retry( - () => http.get(Uri.parse(url)), - retryIf: (e) => e is SocketException || e is TimeoutException, + () => http.get(Uri.parse(url)).timeout(const Duration(seconds: 15)), + retryIf: (e) => e is SocketException, ); if (response.statusCode == 200) { final bytes = response.bodyBytes; @@ -585,7 +603,7 @@ Future getVttFileAsString(String url) async { return decoded; } } else { - return ""; + return ''; } } catch (e) { rethrow; @@ -605,7 +623,7 @@ Future fetchChannels(String api) async { } else { throw ChannelsNotFoundException(); } - + channelsList = Channels.fromJson(decodeRes); } catch (e) { rethrow; @@ -689,7 +707,7 @@ Future> getExternalSubtitle(String api, String key) async { try { var res = await retryOptions.retry( () => - http.get(Uri.parse(api), headers: {"Api-Key": key}).timeout(timeOut), + http.get(Uri.parse(api), headers: {'Api-Key': key}).timeout(timeOut), retryIf: (e) => e is SocketException || e is TimeoutException, ); diff --git a/lib/main.dart b/lib/main.dart index 61499e1..3c9ca79 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,7 +32,7 @@ Future appInitialize() async { // await PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem'); // SecurityContext.defaultContext // .setTrustedCertificatesBytes(data.buffer.asUint8List()); - await dotenv.load(fileName: ".env"); + await dotenv.load(fileName: '.env'); await EasyLocalization.ensureInitialized(); sharedPrefsSingleton = await SharedPreferencesSingleton.getInstance(); FirebaseMessaging.onBackgroundMessage(_messageHandler); diff --git a/lib/models/sub_languages.dart b/lib/models/sub_languages.dart index 66e5f1e..9532c63 100644 --- a/lib/models/sub_languages.dart +++ b/lib/models/sub_languages.dart @@ -13,97 +13,97 @@ class SubLanguages { List supportedLanguages = [ SubLanguages(languageName: '', languageCode: '', englishName: ''), SubLanguages( - languageName: tr("arabic"), languageCode: 'ar', englishName: 'Arabic'), + languageName: tr('arabic'), languageCode: 'ar', englishName: 'Arabic'), SubLanguages( - languageName: tr("bulgarian"), + languageName: tr('bulgarian'), languageCode: 'bg', englishName: 'Bulgarian'), SubLanguages( - languageName: tr("chinese"), languageCode: 'zh', englishName: 'Chinese'), + languageName: tr('chinese'), languageCode: 'zh', englishName: 'Chinese'), SubLanguages( - languageName: tr("croaitian"), + languageName: tr('croaitian'), languageCode: 'hr', englishName: 'Croaitian'), SubLanguages( - languageName: tr("czech"), languageCode: 'cs', englishName: 'Czech'), + languageName: tr('czech'), languageCode: 'cs', englishName: 'Czech'), SubLanguages( - languageName: tr("danish"), languageCode: 'da', englishName: 'Danish'), + languageName: tr('danish'), languageCode: 'da', englishName: 'Danish'), SubLanguages( - languageName: tr("dutch"), languageCode: 'nl', englishName: 'Dutch'), + languageName: tr('dutch'), languageCode: 'nl', englishName: 'Dutch'), SubLanguages( - languageName: tr("english"), languageCode: 'en', englishName: 'English'), + languageName: tr('english'), languageCode: 'en', englishName: 'English'), SubLanguages( - languageName: tr("estonian"), + languageName: tr('estonian'), languageCode: 'et', englishName: 'Estonian'), SubLanguages( - languageName: tr("finnish"), languageCode: 'fi', englishName: 'Finnish'), + languageName: tr('finnish'), languageCode: 'fi', englishName: 'Finnish'), SubLanguages( - languageName: tr("french"), languageCode: 'fr', englishName: 'French'), + languageName: tr('french'), languageCode: 'fr', englishName: 'French'), SubLanguages( - languageName: tr("german"), languageCode: 'de', englishName: 'German'), + languageName: tr('german'), languageCode: 'de', englishName: 'German'), SubLanguages( - languageName: tr("greek"), languageCode: 'el', englishName: 'Greek'), + languageName: tr('greek'), languageCode: 'el', englishName: 'Greek'), SubLanguages( - languageName: tr("hebrew"), languageCode: 'he', englishName: 'Hebrew'), + languageName: tr('hebrew'), languageCode: 'he', englishName: 'Hebrew'), SubLanguages( - languageName: tr("hindi"), languageCode: 'hi', englishName: 'Hindi'), + languageName: tr('hindi'), languageCode: 'hi', englishName: 'Hindi'), SubLanguages( - languageName: tr("hungarian"), + languageName: tr('hungarian'), languageCode: 'hu', englishName: 'Hungarian'), SubLanguages( - languageName: tr("indonesian"), + languageName: tr('indonesian'), languageCode: 'id', englishName: 'Indonesian'), SubLanguages( - languageName: tr("italian"), languageCode: 'it', englishName: 'Italian'), + languageName: tr('italian'), languageCode: 'it', englishName: 'Italian'), SubLanguages( - languageName: tr("japanese"), + languageName: tr('japanese'), languageCode: 'ja', englishName: 'Japanese'), SubLanguages( - languageName: tr("korean"), languageCode: 'ko', englishName: 'Korean'), + languageName: tr('korean'), languageCode: 'ko', englishName: 'Korean'), SubLanguages( - languageName: tr("latvian"), languageCode: 'lv', englishName: 'Latvian'), + languageName: tr('latvian'), languageCode: 'lv', englishName: 'Latvian'), SubLanguages( - languageName: tr("lithuanian"), + languageName: tr('lithuanian'), languageCode: 'lt', englishName: 'Lithuanian'), SubLanguages( - languageName: tr("malay"), languageCode: 'ms', englishName: 'Malay'), + languageName: tr('malay'), languageCode: 'ms', englishName: 'Malay'), SubLanguages( - languageName: tr("norwegian"), + languageName: tr('norwegian'), languageCode: 'no', englishName: 'Norwegian'), SubLanguages( - languageName: tr("polish"), languageCode: 'pl', englishName: 'Polish'), + languageName: tr('polish'), languageCode: 'pl', englishName: 'Polish'), SubLanguages( - languageName: tr("portuguese"), + languageName: tr('portuguese'), languageCode: 'pt', englishName: 'Portuguese'), SubLanguages( - languageName: tr("romanian"), + languageName: tr('romanian'), languageCode: 'ro', englishName: 'Romanian'), SubLanguages( - languageName: tr("russian"), languageCode: 'ru', englishName: 'Russian'), + languageName: tr('russian'), languageCode: 'ru', englishName: 'Russian'), SubLanguages( - languageName: tr("serbian"), languageCode: 'sr', englishName: 'Serbian'), + languageName: tr('serbian'), languageCode: 'sr', englishName: 'Serbian'), SubLanguages( - languageName: tr("slovak"), languageCode: 'sk', englishName: 'Slovak'), + languageName: tr('slovak'), languageCode: 'sk', englishName: 'Slovak'), SubLanguages( - languageName: tr("slovene"), languageCode: 'sl', englishName: 'Slovene'), + languageName: tr('slovene'), languageCode: 'sl', englishName: 'Slovene'), SubLanguages( - languageName: tr("spanish"), languageCode: 'es', englishName: 'Spanish'), + languageName: tr('spanish'), languageCode: 'es', englishName: 'Spanish'), SubLanguages( - languageName: tr("swedish"), languageCode: 'sv', englishName: 'Swedish'), + languageName: tr('swedish'), languageCode: 'sv', englishName: 'Swedish'), SubLanguages( - languageName: tr("thai"), languageCode: 'th', englishName: 'Thai'), + languageName: tr('thai'), languageCode: 'th', englishName: 'Thai'), SubLanguages( - languageName: tr("turkish"), languageCode: 'tr', englishName: 'Turkish'), + languageName: tr('turkish'), languageCode: 'tr', englishName: 'Turkish'), SubLanguages( - languageName: tr("ukrainian"), + languageName: tr('ukrainian'), languageCode: 'uk', englishName: 'Ukrainian'), ]; diff --git a/lib/preferences/app_dependency_preferences.dart b/lib/preferences/app_dependency_preferences.dart index cef2a2e..6098624 100644 --- a/lib/preferences/app_dependency_preferences.dart +++ b/lib/preferences/app_dependency_preferences.dart @@ -4,16 +4,16 @@ import '../constants/api_constants.dart'; import '../constants/app_constants.dart'; class AppDependencies { - static const CONSUMET_URL_KEY = "consumetUrlKey"; - static const FLIXQUEST_LOGO_URL = "flixquestLogoUrl"; - static const OPENSUBTITLES_KEY = "opensubtitlesKey"; - static const STREAM_SERVER_FLIXHQ = "vidcloud"; - static const STREAM_SERVER_DCVA = "asianload"; - static const STREAM_SERVER_ZORO = "vidcloud"; - static const SHOWBOX_URL = "showbox_url"; - static const STREAM_ROUTE = "streamRoute"; - static const FLIXQUEST_API_URL = "flixquestAPIURL"; - static const TMDB_PROXY = "tmdb_proxy"; + static const CONSUMET_URL_KEY = 'consumetUrlKey'; + static const FLIXQUEST_LOGO_URL = 'flixquestLogoUrl'; + static const OPENSUBTITLES_KEY = 'opensubtitlesKey'; + static const STREAM_SERVER_FLIXHQ = 'vidcloud'; + static const STREAM_SERVER_DCVA = 'asianload'; + static const STREAM_SERVER_ZORO = 'vidcloud'; + static const SHOWBOX_URL = 'showbox_url'; + static const STREAM_ROUTE = 'streamRoute'; + static const FLIXQUEST_API_URL = 'flixquestAPIURL'; + static const TMDB_PROXY = 'tmdb_proxy'; setConsumetUrl(String value) async { sharedPrefsSingleton.setString(CONSUMET_URL_KEY, value); @@ -73,7 +73,7 @@ class AppDependencies { } Future getShowboxUrl() async { - return sharedPrefsSingleton.getString(SHOWBOX_URL) ?? ""; + return sharedPrefsSingleton.getString(SHOWBOX_URL) ?? ''; } setShowboxUrl(String value) async { @@ -102,6 +102,6 @@ class AppDependencies { } Future getTmdbProxy() async { - return sharedPrefsSingleton.getString(TMDB_PROXY) ?? ""; + return sharedPrefsSingleton.getString(TMDB_PROXY) ?? ''; } } diff --git a/lib/preferences/setting_preferences.dart b/lib/preferences/setting_preferences.dart index d11695f..0975c9d 100644 --- a/lib/preferences/setting_preferences.dart +++ b/lib/preferences/setting_preferences.dart @@ -2,7 +2,7 @@ import 'package:flixquest/constants/app_constants.dart'; class SettingsPreferences { - static const ADULT_MODE_STATUS = "adultStatus-v2"; + static const ADULT_MODE_STATUS = 'adultStatus-v2'; setAdultMode(bool value) async { sharedPrefsSingleton.setBool(ADULT_MODE_STATUS, value); @@ -31,16 +31,16 @@ class SettingsPreferences { return sharedPrefsSingleton.getInt(DEFAULT_SCREEN_STATUS) ?? 0; } - static const IMAGE_QUALITY_STATUS = "w500/"; + static const IMAGE_QUALITY_STATUS = 'w500/'; setImageQuality(String imageQuality) async { sharedPrefsSingleton.setString(IMAGE_QUALITY_STATUS, imageQuality); } Future getImageQuality() async { - return sharedPrefsSingleton.getString(IMAGE_QUALITY_STATUS) ?? "w500/"; + return sharedPrefsSingleton.getString(IMAGE_QUALITY_STATUS) ?? 'w500/'; } - static const MATERIAL3_MODE_STATUS = "materialStatus"; + static const MATERIAL3_MODE_STATUS = 'materialStatus'; setMaterial3Mode(bool value) async { sharedPrefsSingleton.setBool(MATERIAL3_MODE_STATUS, value); @@ -50,23 +50,23 @@ class SettingsPreferences { return sharedPrefsSingleton.getBool(MATERIAL3_MODE_STATUS) ?? false; } - static const THEME_MODE_STATUS = "themeStatusV2"; + static const THEME_MODE_STATUS = 'themeStatusV2'; setThemeMode(String value) async { sharedPrefsSingleton.setString(THEME_MODE_STATUS, value); } Future getThemeMode() async { - return sharedPrefsSingleton.getString(THEME_MODE_STATUS) ?? "dark"; + return sharedPrefsSingleton.getString(THEME_MODE_STATUS) ?? 'dark'; } - static const VIEW_PREFERENCE_STATUS = "list"; + static const VIEW_PREFERENCE_STATUS = 'list'; setViewType(String viewType) async { sharedPrefsSingleton.setString(VIEW_PREFERENCE_STATUS, viewType); } Future getViewType() async { - return sharedPrefsSingleton.getString(VIEW_PREFERENCE_STATUS) ?? "grid"; + return sharedPrefsSingleton.getString(VIEW_PREFERENCE_STATUS) ?? 'grid'; } static const SEEK_PREFERENCE = 'seek'; @@ -173,7 +173,7 @@ class SettingsPreferences { return sharedPrefsSingleton.getString(APP_LANGUAGE_CODE) ?? 'en'; } - static const APP_COLOR_INDEX = "appColorIndex"; + static const APP_COLOR_INDEX = 'appColorIndex'; setAppColorIndex(int index) async { sharedPrefsSingleton.setInt(APP_COLOR_INDEX, index); @@ -183,7 +183,7 @@ class SettingsPreferences { return sharedPrefsSingleton.getInt(APP_COLOR_INDEX) ?? -1; } - static const PROVIDER_PRECEDENCE = "providerPrecedence-v8"; + static const PROVIDER_PRECEDENCE = 'providerPrecedence-v8'; setProviderPrecedence(String pre) async { sharedPrefsSingleton.setString(PROVIDER_PRECEDENCE, pre); @@ -194,7 +194,7 @@ class SettingsPreferences { providerPreference; } - static const PLAYER_STYLE_INDEX = "playerStyleIndex"; + static const PLAYER_STYLE_INDEX = 'playerStyleIndex'; setPlayerStyleIndex(int index) async { sharedPrefsSingleton.setInt(PLAYER_STYLE_INDEX, index); @@ -204,7 +204,7 @@ class SettingsPreferences { return sharedPrefsSingleton.getInt(PLAYER_STYLE_INDEX) ?? 1; } - static const USE_PROXY = "use_proxy"; + static const USE_PROXY = 'use_proxy'; setUseProxy(bool useProxy) { sharedPrefsSingleton.setBool(USE_PROXY, useProxy); @@ -214,13 +214,13 @@ class SettingsPreferences { return sharedPrefsSingleton.getBool(USE_PROXY) ?? false; } - static const SUBTITLE_TEXT_STYLE = "subtitle_text_style"; + static const SUBTITLE_TEXT_STYLE = 'subtitle_text_style'; setSubtitleStyle(String value) { sharedPrefsSingleton.setString(SUBTITLE_TEXT_STYLE, value); } Future getSubtitleStyle() async { - return sharedPrefsSingleton.getString(SUBTITLE_TEXT_STYLE) ?? "regular"; + return sharedPrefsSingleton.getString(SUBTITLE_TEXT_STYLE) ?? 'regular'; } } diff --git a/lib/provider/app_dependency_provider.dart b/lib/provider/app_dependency_provider.dart index 0fca2ba..4eb4bb4 100644 --- a/lib/provider/app_dependency_provider.dart +++ b/lib/provider/app_dependency_provider.dart @@ -29,7 +29,7 @@ class AppDependencyProvider extends ChangeNotifier { bool _enableADS = true; bool get enableADS => _enableADS; - String _fetchRoute = "flixHQ"; + String _fetchRoute = 'flixHQ'; String get fetchRoute => _fetchRoute; bool _useExternalSubtitles = false; @@ -47,21 +47,24 @@ class AppDependencyProvider extends ChangeNotifier { bool _isForcedUpdate = false; bool get isForcedUpdate => _isForcedUpdate; - String _flixhqZoeServer = "vidcloud"; + String _flixhqZoeServer = 'vidcloud'; String get flixhqZoeServer => _flixhqZoeServer; - String _goMoviesServer = "upcloud"; + String _goMoviesServer = 'upcloud'; String get goMoviesServer => _goMoviesServer; - String _vidSrcToServer = "vidplay"; + String _vidSrcToServer = 'vidplay'; String get vidSrcToServer => _vidSrcToServer; - String _vidSrcServer = "vidsrcembed"; + String _vidSrcServer = 'vidsrcembed'; String get vidSrcServer => _vidSrcServer; - String _tmdbProxy = ""; + String _tmdbProxy = ''; String get tmdbProxy => _tmdbProxy; + bool _fetchSubtitles = true; + bool get fetchSubtitles => _fetchSubtitles; + Future getConsumetUrl() async { consumetUrl = await __appDependencies.getConsumetUrl(); } @@ -192,6 +195,11 @@ class AppDependencyProvider extends ChangeNotifier { notifyListeners(); } + set fetchSubtitles(bool value) { + _fetchSubtitles = value; + notifyListeners(); + } + Future getTmdbProxy() async { tmdbProxy = await __appDependencies.getTmdbProxy(); } diff --git a/lib/provider/settings_provider.dart b/lib/provider/settings_provider.dart index d0724cc..e9eafba 100644 --- a/lib/provider/settings_provider.dart +++ b/lib/provider/settings_provider.dart @@ -13,13 +13,13 @@ class SettingsProvider with ChangeNotifier { bool _isMaterial3Enabled = false; bool get isMaterial3Enabled => _isMaterial3Enabled; - String _appTheme = "dark"; + String _appTheme = 'dark'; String get appTheme => _appTheme; int _defaultValue = 0; int get defaultValue => _defaultValue; - String _imageQuality = "w500/"; + String _imageQuality = 'w500/'; String get imageQuality => _imageQuality; String _defaultCountry = 'US'; @@ -75,7 +75,7 @@ class SettingsProvider with ChangeNotifier { bool _enableProxy = false; bool get enableProxy => _enableProxy; - String _subtitleTextStyle = "regular"; + String _subtitleTextStyle = 'regular'; String get subtitleTextStyle => _subtitleTextStyle; // theme change diff --git a/lib/screens/common/about.dart b/lib/screens/common/about.dart index c469900..d3ff945 100644 --- a/lib/screens/common/about.dart +++ b/lib/screens/common/about.dart @@ -12,7 +12,7 @@ class AboutPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("about")), // Translate "About" + title: Text(tr('about')), ), body: Center( child: Padding( @@ -41,13 +41,13 @@ class AboutPage extends StatelessWidget { ], ), Text( - tr("app_version", namedArgs: {"version": currentAppVersion}), + tr('app_version', namedArgs: {'version': currentAppVersion}), style: const TextStyle( fontSize: 27.0, ), ), Text( - tr("endorsment"), + tr('endorsment'), maxLines: 5, textAlign: TextAlign.center, style: const TextStyle( @@ -71,7 +71,7 @@ class AboutPage extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: GestureDetector( child: Text( - tr("bug_notice"), // Translate "Noticed any bugs? Inform me on Telegram, click here" + tr('bug_notice'), // Translate "Noticed any bugs? Inform me on Telegram, click here" maxLines: 5, textAlign: TextAlign.center, style: const TextStyle( @@ -88,7 +88,7 @@ class AboutPage extends StatelessWidget { Column( children: [ Text( - tr("follow_cinemax"), + tr('follow_cinemax'), maxLines: 5, textAlign: TextAlign.center, style: kTextSmallHeaderStyle, @@ -130,7 +130,7 @@ class AboutPage extends StatelessWidget { right: 7.0, ), child: Text( - tr("made_with"), // Translate "Made with ❤️ by Beamlak Aschalew" + tr('made_with'), // Translate "Made with ❤️ by Beamlak Aschalew" maxLines: 5, textAlign: TextAlign.center, style: const TextStyle(fontSize: 20.0), @@ -138,9 +138,9 @@ class AboutPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Text(tr("year_range", namedArgs: { - "startYear": "2016", - "endYear": "2024" + child: Text(tr('year_range', namedArgs: { + 'startYear': '2016', + 'endYear': '2024' })), // Translate "2015 EC, 2023 GC" ) ], diff --git a/lib/screens/common/bookmark_screen.dart b/lib/screens/common/bookmark_screen.dart index cf2516c..1d07321 100644 --- a/lib/screens/common/bookmark_screen.dart +++ b/lib/screens/common/bookmark_screen.dart @@ -80,19 +80,21 @@ class _BookmarkScreenState extends State Navigator.pop(context); }, icon: const Icon(Icons.arrow_back_rounded)), - title: Text(tr("bookmarks")), + title: Text(tr('bookmarks')), actions: [ IconButton( onPressed: () { if (user!.isAnonymous) { - GlobalMethods.showCustomScaffoldMessage(SnackBar( - content: Text( - tr("bookmark_feature_notice"), - style: kTextVerySmallBodyStyle, - maxLines: 6, - ), - duration: const Duration(seconds: 10), - ), context); + GlobalMethods.showCustomScaffoldMessage( + SnackBar( + content: Text( + tr('bookmark_feature_notice'), + style: kTextVerySmallBodyStyle, + maxLines: 6, + ), + duration: const Duration(seconds: 10), + ), + context); } else { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -120,7 +122,7 @@ class _BookmarkScreenState extends State child: Icon(FontAwesomeIcons.clapperboard), ), Text( - tr("movies"), + tr('movies'), ), ], )), @@ -132,12 +134,12 @@ class _BookmarkScreenState extends State padding: EdgeInsets.only(right: 8.0), child: Icon(Icons.live_tv_rounded)), Text( - tr("tv_series"), + tr('tv_series'), ), ], )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/common/country_choose.dart b/lib/screens/common/country_choose.dart index 23dd120..8d06690 100644 --- a/lib/screens/common/country_choose.dart +++ b/lib/screens/common/country_choose.dart @@ -29,217 +29,217 @@ class _CountryChooseState extends State { List countries = [ WatchProviderCountries( - countryName: tr("uae"), + countryName: tr('uae'), flagPath: 'assets/images/country_flags/united-arab-emirates.png', isoCode: 'AE', ), WatchProviderCountries( - countryName: tr("argentina"), + countryName: tr('argentina'), flagPath: 'assets/images/country_flags/argentina.png', isoCode: 'AR', ), WatchProviderCountries( - countryName: tr("austria"), + countryName: tr('austria'), flagPath: 'assets/images/country_flags/austria.png', isoCode: 'AT', ), WatchProviderCountries( - countryName: tr("australia"), + countryName: tr('australia'), flagPath: 'assets/images/country_flags/australia.png', isoCode: 'AU', ), WatchProviderCountries( - countryName: tr("belgium"), + countryName: tr('belgium'), flagPath: 'assets/images/country_flags/belgium.png', isoCode: 'BE', ), WatchProviderCountries( - countryName: tr("bulgaria"), + countryName: tr('bulgaria'), flagPath: 'assets/images/country_flags/bulgaria.png', isoCode: 'BG', ), WatchProviderCountries( - countryName: tr("brazil"), + countryName: tr('brazil'), flagPath: 'assets/images/country_flags/brazil.png', isoCode: 'BR', ), WatchProviderCountries( - countryName: tr("canada"), + countryName: tr('canada'), flagPath: 'assets/images/country_flags/canada.png', isoCode: 'CA', ), WatchProviderCountries( - countryName: tr("switzerland"), + countryName: tr('switzerland'), flagPath: 'assets/images/country_flags/switzerland.png', isoCode: 'CH', ), WatchProviderCountries( - countryName: tr("cote_divoire"), + countryName: tr('cote_divoire'), flagPath: 'assets/images/country_flags/ivory-coast.png', isoCode: 'CI', ), WatchProviderCountries( - countryName: tr("czech_republic"), + countryName: tr('czech_republic'), flagPath: 'assets/images/country_flags/czech-republic.png', isoCode: 'CZ', ), WatchProviderCountries( - countryName: tr("germany"), + countryName: tr('germany'), flagPath: 'assets/images/country_flags/germany.png', isoCode: 'DE', ), WatchProviderCountries( - countryName: tr("denmark"), + countryName: tr('denmark'), flagPath: 'assets/images/country_flags/denmark.png', isoCode: 'DK', ), WatchProviderCountries( - countryName: tr("estonia"), + countryName: tr('estonia'), flagPath: 'assets/images/country_flags/estonia.png', isoCode: 'EE', ), WatchProviderCountries( - countryName: tr("spain"), + countryName: tr('spain'), flagPath: 'assets/images/country_flags/spain.png', isoCode: 'ES', ), WatchProviderCountries( - countryName: tr("finland"), + countryName: tr('finland'), flagPath: 'assets/images/country_flags/finland.png', isoCode: 'FI', ), WatchProviderCountries( - countryName: tr("france"), + countryName: tr('france'), flagPath: 'assets/images/country_flags/france.png', isoCode: 'FR', ), WatchProviderCountries( - countryName: tr("uk"), + countryName: tr('uk'), flagPath: 'assets/images/country_flags/united-kingdom.png', isoCode: 'GB', ), WatchProviderCountries( - countryName: tr("hong_kong"), + countryName: tr('hong_kong'), flagPath: 'assets/images/country_flags/hong-kong.png', isoCode: 'HK', ), WatchProviderCountries( - countryName: tr("croatia"), + countryName: tr('croatia'), flagPath: 'assets/images/country_flags/croatia.png', isoCode: 'HR', ), WatchProviderCountries( - countryName: tr("hungary"), + countryName: tr('hungary'), flagPath: 'assets/images/country_flags/hungary.png', isoCode: 'HU', ), WatchProviderCountries( - countryName: tr("indonesia"), + countryName: tr('indonesia'), flagPath: 'assets/images/country_flags/indonesia.png', isoCode: 'ID', ), WatchProviderCountries( - countryName: tr("ireland"), + countryName: tr('ireland'), flagPath: 'assets/images/country_flags/ireland.png', isoCode: 'IE', ), WatchProviderCountries( - countryName: tr("india"), + countryName: tr('india'), flagPath: 'assets/images/country_flags/india.png', isoCode: 'IN', ), WatchProviderCountries( - countryName: tr("italy"), + countryName: tr('italy'), flagPath: 'assets/images/country_flags/italy.png', isoCode: 'IT', ), WatchProviderCountries( - countryName: tr("japan"), + countryName: tr('japan'), flagPath: 'assets/images/country_flags/japan.png', isoCode: 'JP', ), WatchProviderCountries( - countryName: tr("kenya"), + countryName: tr('kenya'), flagPath: 'assets/images/country_flags/kenya.png', isoCode: 'KE', ), WatchProviderCountries( - countryName: tr("south_korea"), + countryName: tr('south_korea'), flagPath: 'assets/images/country_flags/south-korea.png', isoCode: 'KR', ), WatchProviderCountries( - countryName: tr("lithuania"), + countryName: tr('lithuania'), flagPath: 'assets/images/country_flags/lithuania.png', isoCode: 'LT', ), WatchProviderCountries( - countryName: tr("mexico"), + countryName: tr('mexico'), flagPath: 'assets/images/country_flags/mexico.png', isoCode: 'MX', ), WatchProviderCountries( - countryName: tr("netherlands"), + countryName: tr('netherlands'), flagPath: 'assets/images/country_flags/netherlands.png', isoCode: 'NL', ), WatchProviderCountries( - countryName: tr("norway"), + countryName: tr('norway'), flagPath: 'assets/images/country_flags/norway.png', isoCode: 'NO', ), WatchProviderCountries( - countryName: tr("new_zealand"), + countryName: tr('new_zealand'), flagPath: 'assets/images/country_flags/new-zealand.png', isoCode: 'NZ', ), WatchProviderCountries( - countryName: tr("philippines"), + countryName: tr('philippines'), flagPath: 'assets/images/country_flags/philippines.png', isoCode: 'PH', ), WatchProviderCountries( - countryName: tr("poland"), + countryName: tr('poland'), flagPath: 'assets/images/country_flags/poland.png', isoCode: 'PL', ), WatchProviderCountries( - countryName: tr("portugal"), + countryName: tr('portugal'), flagPath: 'assets/images/country_flags/portugal.png', isoCode: 'PT', ), WatchProviderCountries( - countryName: tr("serbia"), + countryName: tr('serbia'), flagPath: 'assets/images/country_flags/serbia.png', isoCode: 'RS', ), WatchProviderCountries( - countryName: tr("russia"), + countryName: tr('russia'), flagPath: 'assets/images/country_flags/russia.png', isoCode: 'RU', ), WatchProviderCountries( - countryName: tr("sweden"), + countryName: tr('sweden'), flagPath: 'assets/images/country_flags/sweden.png', isoCode: 'SE', ), WatchProviderCountries( - countryName: tr("slovakia"), + countryName: tr('slovakia'), flagPath: 'assets/images/country_flags/slovakia.png', isoCode: 'SK', ), WatchProviderCountries( - countryName: tr("turkey"), + countryName: tr('turkey'), flagPath: 'assets/images/country_flags/turkey.png', isoCode: 'TR', ), WatchProviderCountries( - countryName: tr("usa"), + countryName: tr('usa'), flagPath: 'assets/images/country_flags/united-states.png', isoCode: 'US', ), WatchProviderCountries( - countryName: tr("south_africa"), + countryName: tr('south_africa'), flagPath: 'assets/images/country_flags/south-africa.png', isoCode: 'ZA', ), @@ -254,7 +254,7 @@ class _CountryChooseState extends State { ); return Scaffold( - appBar: AppBar(title: Text(tr("choose_country"))), + appBar: AppBar(title: Text(tr('choose_country'))), body: SingleChildScrollView( child: Center( child: Column( diff --git a/lib/screens/common/discover.dart b/lib/screens/common/discover.dart index e40e77c..d5e0f24 100644 --- a/lib/screens/common/discover.dart +++ b/lib/screens/common/discover.dart @@ -46,7 +46,7 @@ class _DiscoverPageState extends State ), Expanded( child: Text( - tr("movies"), + tr('movies'), overflow: TextOverflow.ellipsis, ), ), @@ -61,14 +61,14 @@ class _DiscoverPageState extends State child: Icon(Icons.live_tv_rounded)), Expanded( child: Text( - tr("tv_series"), + tr('tv_series'), overflow: TextOverflow.ellipsis, ), ), ], )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/common/hero_photoview.dart b/lib/screens/common/hero_photoview.dart index a692bc1..06adfe2 100644 --- a/lib/screens/common/hero_photoview.dart +++ b/lib/screens/common/hero_photoview.dart @@ -44,15 +44,15 @@ class _HeroPhotoViewState extends State { final posterFolderName = posterFolder; final stillFolderName = stillFolder; final personImageFolderName = personImageFolder; - final flixquestPath = Directory("storage/emulated/0/$cinefolderName"); + final flixquestPath = Directory('storage/emulated/0/$cinefolderName'); final imageTypePath = - Directory("storage/emulated/0/FlixQuest/$imagefolderName"); + Directory('storage/emulated/0/FlixQuest/$imagefolderName'); final posterPath = - Directory("storage/emulated/0/FlixQuest/$posterFolderName"); + Directory('storage/emulated/0/FlixQuest/$posterFolderName'); final stillPath = - Directory("storage/emulated/0/FlixQuest/$stillFolderName"); + Directory('storage/emulated/0/FlixQuest/$stillFolderName'); final personImagePath = - Directory("storage/emulated/0/FlixQuest/$personImageFolderName"); + Directory('storage/emulated/0/FlixQuest/$personImageFolderName'); if ((await flixquestPath.exists())) { imageTypePath.create(); @@ -102,13 +102,13 @@ class _HeroPhotoViewState extends State { void _download(String url, String currentIndex, String themeMode) async { var externalStatus = await Permission.manageExternalStorage.status; if (externalStatus.isPermanentlyDenied) { - GlobalMethods.showScaffoldMessage(tr("give_file_permission"), context); + GlobalMethods.showScaffoldMessage(tr('give_file_permission'), context); return; } else if (!externalStatus.isGranted) { await Permission.manageExternalStorage.request().then((value) { if (value.isDenied) { GlobalMethods.showScaffoldMessage( - tr("give_file_permission_short"), context); + tr('give_file_permission_short'), context); return; } }); @@ -137,9 +137,9 @@ class _HeroPhotoViewState extends State { child: Scaffold( appBar: AppBar( title: Text(widget.name.endsWith('s') - ? tr("plular_person_image", namedArgs: {"name": widget.name}) - : tr("singular_person_image", - namedArgs: {"name": widget.name})), + ? tr('plular_person_image', namedArgs: {'name': widget.name}) + : tr('singular_person_image', + namedArgs: {'name': widget.name})), ), body: Column( children: [ @@ -158,7 +158,7 @@ class _HeroPhotoViewState extends State { widget.heroId, '${widget.currentIndex + 1}', themeMode); }, style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(double.infinity, 50)), ), child: Row( @@ -168,7 +168,7 @@ class _HeroPhotoViewState extends State { padding: EdgeInsets.only(right: 8.0), child: Icon(FontAwesomeIcons.solidFloppyDisk), ), - Text(tr("download")), + Text(tr('download')), ], ), ), diff --git a/lib/screens/common/landing_screen.dart b/lib/screens/common/landing_screen.dart index 55fa976..b5a840b 100644 --- a/lib/screens/common/landing_screen.dart +++ b/lib/screens/common/landing_screen.dart @@ -105,37 +105,36 @@ class _LandingScreenState extends State { ), ), ), - Text(tr("thousands_of"), + Text(tr('thousands_of'), style: const TextStyle(color: Colors.black)), SizedBox( - height: 75, child: Padding( padding: const EdgeInsets.only(top: 5.0), child: AnimatedTextKit( repeatForever: true, animatedTexts: [ animatedTextWIdget( - textTitle: tr("top_rated_movies"), + textTitle: tr('top_rated_movies'), animationDuration: 90, fontSize: 25), animatedTextWIdget( - textTitle: tr("top_rated_tv_shows"), + textTitle: tr('top_rated_tv_shows'), animationDuration: 90, fontSize: 25), animatedTextWIdget( - textTitle: tr("trending_movies"), + textTitle: tr('trending_movies'), animationDuration: 90, fontSize: 25), animatedTextWIdget( - textTitle: tr("trending_tv_shows"), + textTitle: tr('trending_tv_shows'), animationDuration: 90, fontSize: 25), animatedTextWIdget( - textTitle: tr("popular_movies"), + textTitle: tr('popular_movies'), animationDuration: 90, fontSize: 25), animatedTextWIdget( - textTitle: tr("popular_tv_shows"), + textTitle: tr('popular_tv_shows'), animationDuration: 90, fontSize: 25), ], @@ -145,7 +144,7 @@ class _LandingScreenState extends State { Padding( padding: const EdgeInsets.only(top: 10.0), child: Text( - tr("unlimited_on_cinemax"), + tr('unlimited_on_cinemax'), style: const TextStyle( color: Colors.black, fontSize: 20, @@ -168,15 +167,15 @@ class _LandingScreenState extends State { children: [ ElevatedButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(150, 50)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ), ), - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( const Color(0xFFf57c00))), onPressed: () async { // updateFirstRunData(); @@ -186,7 +185,7 @@ class _LandingScreenState extends State { })); }, child: Text( - tr("log_in"), + tr('log_in'), style: const TextStyle(color: Colors.white), )), const SizedBox( @@ -194,16 +193,16 @@ class _LandingScreenState extends State { ), ElevatedButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(150, 50)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ), ), backgroundColor: - MaterialStateProperty.all(Colors.white)), + WidgetStateProperty.all(Colors.white)), onPressed: () async { // updateFirstRunData(); Navigator.push(context, @@ -212,7 +211,7 @@ class _LandingScreenState extends State { })); }, child: Text( - tr("sign_up"), + tr('sign_up'), style: const TextStyle(color: Colors.black), )), const SizedBox( @@ -221,16 +220,16 @@ class _LandingScreenState extends State { anonButtonVisible ? ElevatedButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(150, 50)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ), ), - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( const Color(0xFFfad2aa))), onPressed: () async { setState(() { @@ -247,6 +246,9 @@ class _LandingScreenState extends State { setState(() { anonButtonVisible = true; }); + if (!context.mounted) { + return; + } Navigator.push(context, MaterialPageRoute( builder: (context) { @@ -254,10 +256,13 @@ class _LandingScreenState extends State { })); }); } else { + if (!context.mounted) { + return; + } GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -269,7 +274,7 @@ class _LandingScreenState extends State { }); }, child: Text( - tr("continue_anonymously"), + tr('continue_anonymously'), style: const TextStyle(color: Colors.black), )) : const CircularProgressIndicator() diff --git a/lib/screens/common/language_choose.dart b/lib/screens/common/language_choose.dart index 45b030e..2537a86 100644 --- a/lib/screens/common/language_choose.dart +++ b/lib/screens/common/language_choose.dart @@ -19,24 +19,24 @@ class _AppLanguageChooseState extends State { List langs = [ AppLanguages( languageFlag: 'assets/images/country_flags/united-kingdom.png', - languageName: tr("english"), + languageName: tr('english'), languageCode: 'en'), AppLanguages( languageFlag: 'assets/images/country_flags/united-arab-emirates.png', - languageName: tr("arabic"), + languageName: tr('arabic'), languageCode: 'ar'), AppLanguages( languageFlag: 'assets/images/country_flags/spain.png', - languageName: tr("spanish"), + languageName: tr('spanish'), languageCode: 'es'), AppLanguages( languageFlag: 'assets/images/country_flags/india.png', - languageName: tr("hindi"), + languageName: tr('hindi'), languageCode: 'hi') ]; return Scaffold( - appBar: AppBar(title: Text(tr("choose_language"))), + appBar: AppBar(title: Text(tr('choose_language'))), body: SingleChildScrollView( child: Center( child: Column( diff --git a/lib/screens/common/live_player.dart b/lib/screens/common/live_player.dart index 83803f0..bba0d4b 100644 --- a/lib/screens/common/live_player.dart +++ b/lib/screens/common/live_player.dart @@ -64,6 +64,9 @@ class _LivePlayerState extends State { overflowMenuIcon: Icons.menu_rounded, subtitlesIcon: Icons.closed_caption_rounded, qualitiesIcon: Icons.hd_rounded, + overflowMenuIconsColor: widget.colors.first, + overflowModalTextColor: widget.colors.first, + overflowModalColor: widget.colors.last, enableAudioTracks: false, ); @@ -88,10 +91,11 @@ class _LivePlayerState extends State { BetterPlayerDataSource dataSource = BetterPlayerDataSource( BetterPlayerDataSourceType.network, widget.videoUrl, liveStream: true, - bufferingConfiguration: betterPlayerBufferingConfiguration, headers: { - 'User-Agent': widget.userAgent, - 'Referer': widget.referrer, -}); + bufferingConfiguration: betterPlayerBufferingConfiguration, + headers: { + 'User-Agent': widget.userAgent, + 'Referer': widget.referrer, + }); _betterPlayerController = BetterPlayerController(betterPlayerConfiguration); _betterPlayerController.setupDataSource(dataSource).then((value) { if (_betterPlayerController.videoPlayerController!.value.aspectRatio > diff --git a/lib/screens/common/live_tv_screen.dart b/lib/screens/common/live_tv_screen.dart index dd1b078..dc33489 100644 --- a/lib/screens/common/live_tv_screen.dart +++ b/lib/screens/common/live_tv_screen.dart @@ -19,37 +19,38 @@ class ChannelList extends StatefulWidget { } class _ChannelListState extends State { - Channels? channels; + Channels? channels; Channels? original; bool enableRetry = false; @override void initState() { - loadChannels(); + loadChannels(); super.initState(); } void loadChannels() async { - try { - setState(() { - enableRetry = false; - }); - Channels value = await fetchChannels(Endpoints.getIPTVEndpoint(Provider.of(context, listen: false).flixquestAPIURL)); - List channelsCopy = List.from(value.channels!); - Channels originalCopy = Channels(channels: channelsCopy); - setState(() { - channels = value; - original = originalCopy; - }); - -} on Exception catch (e) { - setState(() { - enableRetry = true; - }); - if (mounted) { - GlobalMethods.showErrorScaffoldMessengerMediaLoad(e, context, ''); - } -} + try { + setState(() { + enableRetry = false; + }); + Channels value = await fetchChannels(Endpoints.getIPTVEndpoint( + Provider.of(context, listen: false) + .flixquestAPIURL)); + List channelsCopy = List.from(value.channels!); + Channels originalCopy = Channels(channels: channelsCopy); + setState(() { + channels = value; + original = originalCopy; + }); + } on Exception catch (e) { + setState(() { + enableRetry = true; + }); + if (mounted) { + GlobalMethods.showErrorScaffoldMessengerMediaLoad(e, context, ''); + } + } } @override @@ -57,79 +58,111 @@ class _ChannelListState extends State { return Scaffold( appBar: AppBar( title: Text( - tr("channels"), + tr('channels'), ), ), body: Padding( - padding: const EdgeInsets.all(8.0), - child: enableRetry ? Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [Row(mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.link_off_rounded, size: 35,), const SizedBox(width: 25,), Text(tr("channels_fetch_failed"), style: const TextStyle(fontSize: 20),), - ], - ), - const SizedBox(height: 15,), ElevatedButton(onPressed: () {loadChannels();}, child: Text(tr("retry")))], ) : channels == null - ? const Center(child: CircularProgressIndicator()) - : Column( + padding: const EdgeInsets.all(8.0), + child: enableRetry + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).cardColor, - borderRadius: BorderRadius.circular(10.0), - - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - children: [ - const SizedBox(width: 8.0), - Expanded( - child: TextField( - onChanged: (v) { - setState(() { - channels!.channels = original!.channels; - }); - if (v.isNotEmpty) { - setState(() { - channels!.channels = channels!.channels!.where((element) => (element.channelName!.toLowerCase().contains(v.toLowerCase()))).toList(); - }); - } - }, - decoration: const InputDecoration( - hintText: 'Search', - border: InputBorder.none,), - ), - ), - const Icon(Icons.search), - ], - ), - ), - ), - channels!.channels!.isEmpty - ? Expanded( - child: Center( - child: Text( - tr("no_channels"), - style: kTextHeaderStyle, - maxLines: 2, - textAlign: TextAlign.center, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.link_off_rounded, + size: 35, + ), + const SizedBox( + width: 25, + ), + Text( + tr('channels_fetch_failed'), + style: const TextStyle(fontSize: 20), + ), + ], ), - ), - ) - : Expanded( - child: ListView.builder( - itemCount: channels!.channels!.length, - shrinkWrap: true, - itemBuilder: (context, index) { - return ChannelWidget( - channel: channels!, - index: index, - ); - }, - ), + const SizedBox( + height: 15, ), + ElevatedButton( + onPressed: () { + loadChannels(); + }, + child: Text(tr('retry'))) ], ) - ), + : channels == null + ? const Center(child: CircularProgressIndicator()) + : Column( + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(10.0), + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + const SizedBox(width: 8.0), + Expanded( + child: TextField( + onChanged: (v) { + setState(() { + channels!.channels = original!.channels; + }); + if (v.isNotEmpty) { + setState(() { + channels!.channels = channels! + .channels! + .where((element) => (element + .channelName! + .toLowerCase() + .contains(v.toLowerCase()))) + .toList(); + }); + } + }, + decoration: const InputDecoration( + hintText: 'Search', + border: InputBorder.none, + ), + ), + ), + const Icon(Icons.search), + ], + ), + ), + ), + channels!.channels!.isEmpty + ? Expanded( + child: Center( + child: Text( + tr('no_channels'), + style: kTextHeaderStyle, + maxLines: 2, + textAlign: TextAlign.center, + ), + ), + ) + : Expanded( + child: ListView.builder( + itemCount: channels!.channels!.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return ChannelWidget( + channel: channels!, + index: index, + ); + }, + ), + ), + ], + )), ); } } @@ -146,7 +179,6 @@ class ChannelWidget extends StatefulWidget { } class _ChannelWidgetState extends State { - late AppDependencyProvider appDep = Provider.of(context, listen: false); @@ -164,24 +196,27 @@ class _ChannelWidgetState extends State { GestureDetector( onTap: () { final mixpanel = - Provider.of(context, listen: false) - .mixpanel; - final autoFS = - Provider.of(context, listen: false) - .defaultViewMode; + Provider.of(context, listen: false).mixpanel; + final autoFS = Provider.of(context, listen: false) + .defaultViewMode; mixpanel.track('Most viewed TV channels', properties: { - 'TV Channel name': widget.channel.channels![widget.index].channelName ?? "N/A", + 'TV Channel name': + widget.channel.channels![widget.index].channelName ?? 'N/A', }); Navigator.push(context, MaterialPageRoute(builder: ((context) { return LivePlayer( - channelName: widget.channel.channels![widget.index].channelName!, - videoUrl: Channels.baseUrl! + widget.channel.channels![widget.index].channelId!.toString() + Channels.trailingUrl!, + channelName: + widget.channel.channels![widget.index].channelName!, + videoUrl: Channels.baseUrl! + + widget.channel.channels![widget.index].channelId! + .toString() + + Channels.trailingUrl!, referrer: Channels.referrer!, autoFullScreen: autoFS, userAgent: Channels.userAgent!, colors: [ Theme.of(context).primaryColor, - Theme.of(context).colorScheme.background + Theme.of(context).colorScheme.surface ], ); }))); diff --git a/lib/screens/common/photoview.dart b/lib/screens/common/photoview.dart index 2597294..86b1e34 100644 --- a/lib/screens/common/photoview.dart +++ b/lib/screens/common/photoview.dart @@ -56,13 +56,13 @@ class _HeroPhotoViewState extends State { final imagefolderName = imageTypeFolderName; final posterFolderName = posterFolder; final stillFolderName = stillFolder; - final flixquestPath = Directory("storage/emulated/0/$cinefolderName"); + final flixquestPath = Directory('storage/emulated/0/$cinefolderName'); final imageTypePath = - Directory("storage/emulated/0/FlixQuest/$imagefolderName"); + Directory('storage/emulated/0/FlixQuest/$imagefolderName'); final posterPath = - Directory("storage/emulated/0/FlixQuest/$posterFolderName"); + Directory('storage/emulated/0/FlixQuest/$posterFolderName'); final stillPath = - Directory("storage/emulated/0/FlixQuest/$stillFolderName"); + Directory('storage/emulated/0/FlixQuest/$stillFolderName'); if ((await flixquestPath.exists())) { imageTypePath.create(); @@ -79,13 +79,13 @@ class _HeroPhotoViewState extends State { void _download(String url, String currentIndex, String themeMode) async { var externalStatus = await Permission.manageExternalStorage.status; if (externalStatus.isPermanentlyDenied) { - GlobalMethods.showScaffoldMessage(tr("give_file_permission"), context); + GlobalMethods.showScaffoldMessage(tr('give_file_permission'), context); return; } else if (!externalStatus.isGranted) { await Permission.manageExternalStorage.request().then((value) { if (value.isDenied) { GlobalMethods.showScaffoldMessage( - tr("give_file_permission_short"), context); + tr('give_file_permission_short'), context); return; } }); @@ -148,14 +148,17 @@ class _HeroPhotoViewState extends State { onPressed: () async { _download( widget.imageType == 'backdrop' - ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.backdrops![currentIndex].filePath! : widget.imageType == 'poster' - ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.posters![currentIndex].posterPath! - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.stills![currentIndex].stillPath!, '${currentIndex + 1}', @@ -176,14 +179,17 @@ class _HeroPhotoViewState extends State { return PhotoViewGalleryPageOptions( imageProvider: CachedNetworkImageProvider( widget.imageType == 'backdrop' - ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.backdrops![currentIndex].filePath! : widget.imageType == 'poster' - ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + ? buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.posters![currentIndex].posterPath! - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, + isProxyEnabled, context) + imageQuality + widget.stills![currentIndex].stillPath!, ), @@ -213,10 +219,10 @@ class _HeroPhotoViewState extends State { Container( padding: const EdgeInsets.all(20.0), child: Text( - tr("image_index", - namedArgs: {"index": (currentIndex + 1).toString()}), + tr('image_index', + namedArgs: {'index': (currentIndex + 1).toString()}), style: TextStyle( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, fontSize: 17.0, diff --git a/lib/screens/common/player.dart b/lib/screens/common/player.dart index a66bd80..96ad48b 100644 --- a/lib/screens/common/player.dart +++ b/lib/screens/common/player.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flixquest/models/tv_stream_metadata.dart'; @@ -69,12 +71,12 @@ class _PlayerOneState extends State with WidgetsBindingObserver { String backgroundColorString = widget.settings.subtitleBackgroundColor; String foregroundColorString = widget.settings.subtitleForegroundColor; String hexColorBackground = - backgroundColorString.replaceAll("Color(0x", "").replaceAll(")", ""); + backgroundColorString.replaceAll('Color(0x', '').replaceAll(')', ''); String hexColorForeground = - foregroundColorString.replaceAll("Color(0x", "").replaceAll(")", ""); + foregroundColorString.replaceAll('Color(0x', '').replaceAll(')', ''); - Color backgroundColor = Color(int.parse("0x$hexColorBackground")); - Color foregroundColor = Color(int.parse("0x$hexColorForeground")); + Color backgroundColor = Color(int.parse('0x$hexColorBackground')); + Color foregroundColor = Color(int.parse('0x$hexColorForeground')); WidgetsBinding.instance.addObserver(this); betterPlayerBufferingConfiguration = BetterPlayerBufferingConfiguration( @@ -89,8 +91,8 @@ class _PlayerOneState extends State with WidgetsBindingObserver { }, enableFullscreen: true, name: widget.mediaType == MediaType.movie - ? "${widget.movieMetadata!.movieName!} (${widget.movieMetadata!.releaseYear!})" - : "${widget.tvMetadata!.seriesName!} - ${widget.tvMetadata!.episodeName!} | ${episodeSeasonFormatter(widget.tvMetadata!.episodeNumber!, widget.tvMetadata!.seasonNumber!)}", + ? '${widget.movieMetadata!.movieName!} (${widget.movieMetadata!.releaseYear!})' + : '${widget.tvMetadata!.seriesName!} - ${widget.tvMetadata!.episodeName!} | ${episodeSeasonFormatter(widget.tvMetadata!.episodeNumber!, widget.tvMetadata!.seasonNumber!)}', backgroundColor: Colors.black, progressBarBackgroundColor: Colors.white, controlBarColor: Colors.black.withOpacity(0.3), @@ -122,7 +124,7 @@ class _PlayerOneState extends State with WidgetsBindingObserver { qualitiesIcon: Icons.hd_rounded, enableAudioTracks: false, controlBarHeight: 50, - watchingText: tr("watching_text"), + watchingText: tr('watching_text'), playerTimeMode: settings.playerTimeDisplay); BetterPlayerConfiguration betterPlayerConfiguration = BetterPlayerConfiguration( diff --git a/lib/screens/common/player_settings.dart b/lib/screens/common/player_settings.dart index b89e038..ae02be0 100644 --- a/lib/screens/common/player_settings.dart +++ b/lib/screens/common/player_settings.dart @@ -25,12 +25,12 @@ class _PlayerSettingsState extends State { String backgroundColorString = settingValues.subtitleBackgroundColor; String foregroundColorString = settingValues.subtitleForegroundColor; String hexColorBackground = - backgroundColorString.replaceAll("Color(0x", "").replaceAll(")", ""); + backgroundColorString.replaceAll('Color(0x', '').replaceAll(')', ''); String hexColorForeground = - foregroundColorString.replaceAll("Color(0x", "").replaceAll(")", ""); + foregroundColorString.replaceAll('Color(0x', '').replaceAll(')', ''); - Color backgroundColor = Color(int.parse("0x$hexColorBackground")); - Color foregroundColor = Color(int.parse("0x$hexColorForeground")); + Color backgroundColor = Color(int.parse('0x$hexColorBackground')); + Color foregroundColor = Color(int.parse('0x$hexColorForeground')); Color pickerColor = const Color(0xff443a49); Color currentColor = const Color(0xff443a49); @@ -60,7 +60,7 @@ class _PlayerSettingsState extends State { actions: [ ElevatedButton( child: Text( - tr("save"), + tr('save'), ), onPressed: () { setState(() => currentColor = pickerColor); @@ -81,7 +81,7 @@ class _PlayerSettingsState extends State { return Scaffold( appBar: AppBar( title: Text( - tr("player_settings"), + tr('player_settings'), ), ), body: Padding( @@ -95,7 +95,7 @@ class _PlayerSettingsState extends State { const LeadingDot(), Expanded( child: Text( - tr("subtitle"), + tr('subtitle'), style: kTextHeaderStyle, ), ), @@ -110,12 +110,16 @@ class _PlayerSettingsState extends State { Image.asset('assets/images/sample_frame.jpg'), Padding( padding: const EdgeInsets.only(bottom: 15.0), - child: Text(tr("sample_player_text"), + child: Text(tr('sample_player_text'), textAlign: TextAlign.center, style: TextStyle( backgroundColor: backgroundColor, color: foregroundColor, - fontFamily: st == 'regular' ? 'Poppins' : st == 'bold' ? 'PoppinsSB' : 'PoppinsLight', + fontFamily: st == 'regular' + ? 'Poppins' + : st == 'bold' + ? 'PoppinsSB' + : 'PoppinsLight', fontSize: settingValues.subtitleFontSize.toDouble())), ), @@ -126,7 +130,7 @@ class _PlayerSettingsState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - tr("text_size"), + tr('text_size'), style: kTextSmallBodyStyle, ), Text( @@ -148,7 +152,7 @@ class _PlayerSettingsState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - tr("text_color"), + tr('text_color'), style: kTextSmallBodyStyle, ), GestureDetector( @@ -168,7 +172,7 @@ class _PlayerSettingsState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - tr("background_color"), + tr('background_color'), style: kTextSmallBodyStyle, ), GestureDetector( @@ -181,32 +185,32 @@ class _PlayerSettingsState extends State { ) ], ), - const SizedBox(height: 10,), + const SizedBox( + height: 10, + ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text( - tr("text_weight"), - style: kTextSmallBodyStyle, - ), - DropdownButton( - value: settingValues.subtitleTextStyle, - items: [ - DropdownMenuItem( - value: 'light', - child: Text(tr("light"))), - DropdownMenuItem( - value: 'regular', - child: Text(tr("regular"))), - DropdownMenuItem( - value: 'bold', - child: Text(tr("bold"))), - - ], - onChanged: (String? value) { - setState(() { - settingValues.subtitleTextStyle = value!; - }); - }),], + children: [ + Text( + tr('text_weight'), + style: kTextSmallBodyStyle, + ), + DropdownButton( + value: settingValues.subtitleTextStyle, + items: [ + DropdownMenuItem( + value: 'light', child: Text(tr('light'))), + DropdownMenuItem( + value: 'regular', child: Text(tr('regular'))), + DropdownMenuItem( + value: 'bold', child: Text(tr('bold'))), + ], + onChanged: (String? value) { + setState(() { + settingValues.subtitleTextStyle = value!; + }); + }), + ], ), const SizedBox( height: 25, @@ -216,7 +220,7 @@ class _PlayerSettingsState extends State { const LeadingDot(), Expanded( child: Text( - tr("general"), + tr('general'), style: kTextHeaderStyle, ), ), @@ -231,7 +235,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("auto_full_screen"), + tr('auto_full_screen'), ), onChanged: ((value) { setState(() { @@ -245,7 +249,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("seek_second"), + tr('seek_second'), ), trailing: DropdownButton( value: settingValues.defaultSeekDuration, @@ -268,7 +272,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("buffer_amount"), + tr('buffer_amount'), ), trailing: DropdownButton( value: settingValues.defaultMaxBufferDuration, @@ -328,7 +332,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("video_resolution"), + tr('video_resolution'), ), trailing: DropdownButton( value: settingValues.defaultVideoResolution, @@ -336,7 +340,7 @@ class _PlayerSettingsState extends State { DropdownMenuItem( value: 0, child: Text( - tr("auto"), + tr('auto'), )), const DropdownMenuItem(value: 360, child: Text('360p')), const DropdownMenuItem(value: 720, child: Text('720p')), @@ -352,15 +356,15 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("player_time_display"), + tr('player_time_display'), ), trailing: DropdownButton( value: settingValues.playerTimeDisplay, items: [ DropdownMenuItem( - value: 1, child: Text(tr("elapsed_total"))), + value: 1, child: Text(tr('elapsed_total'))), DropdownMenuItem( - value: 2, child: Text(tr("elapsed_remaining"))), + value: 2, child: Text(tr('elapsed_remaining'))), ], onChanged: (int? value) { setState(() { @@ -376,7 +380,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), value: settingValues.fetchSpecificLangSubs, - title: Text(tr("fetch_all_subs")), + title: Text(tr('fetch_all_subs')), onChanged: ((value) { setState(() { settingValues.fetchSpecificLangSubs = value; @@ -395,7 +399,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("subtitle_language"), + tr('subtitle_language'), ), ), ListTile( @@ -410,7 +414,7 @@ class _PlayerSettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("provider_precedence"), + tr('provider_precedence'), ), ), ], diff --git a/lib/screens/common/provider_choose.dart b/lib/screens/common/provider_choose.dart index ed8be46..ae4a3b5 100644 --- a/lib/screens/common/provider_choose.dart +++ b/lib/screens/common/provider_choose.dart @@ -13,7 +13,7 @@ class ProviderChooseScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("choose_provider_order")), + title: Text(tr('choose_provider_order')), ), body: Padding( padding: const EdgeInsets.all(8.0), @@ -39,7 +39,7 @@ class ProviderChooseScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - tr("provider_precedence_help"), + tr('provider_precedence_help'), style: const TextStyle(fontSize: 15), textAlign: TextAlign.center, ), @@ -90,10 +90,10 @@ class RearrangeableListViewState extends State { videoProviders.insert(newIndex, item); }); - String prov = ""; + String prov = ''; for (int i = 0; i < videoProviders.length; i++) { prov += - "${videoProviders[i].codeName}-${videoProviders[i].fullName} "; + '${videoProviders[i].codeName}-${videoProviders[i].fullName} '; } prefString.proPreference = prov; }, diff --git a/lib/screens/common/search_view.dart b/lib/screens/common/search_view.dart index 26a9f23..2770615 100644 --- a/lib/screens/common/search_view.dart +++ b/lib/screens/common/search_view.dart @@ -25,7 +25,7 @@ class Search extends SearchDelegate { Search( {required this.mixpanel, required this.includeAdult, required this.lang}) : super( - searchFieldLabel: tr("search_text"), + searchFieldLabel: tr('search_text'), ); @override @@ -71,34 +71,34 @@ class Search extends SearchDelegate { body: Column( children: [ Container( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, child: TabBar( tabs: [ Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "light" + color: themeMode == 'light' ? const Color(0xFF202124) : const Color(0xFFDFDEDE), )), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "light" + color: themeMode == 'light' ? const Color(0xFF202124) : const Color(0xFFDFDEDE), )), ), Tab( - child: Text(tr("celebrities"), + child: Text(tr('celebrities'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "light" + color: themeMode == 'light' ? const Color(0xFF202124) : const Color(0xFFDFDEDE), )), @@ -113,10 +113,12 @@ class Search extends SearchDelegate { .then((value) async { if (query.isNotEmpty) { mixpanel - .track("Searched query", properties: {"query": query}); + .track('Searched query', properties: {'query': query}); } return await fetchMovies( - Endpoints.movieSearchUrl(query, includeAdult, lang), isProxyEnabled, proxyUrl); + Endpoints.movieSearchUrl(query, includeAdult, lang), + isProxyEnabled, + proxyUrl); }), builder: (context, snapshot) { if (query.isEmpty) return searchATermWidget(themeMode); @@ -137,7 +139,9 @@ class Search extends SearchDelegate { FutureBuilder>( future: Future.delayed(const Duration(seconds: 3)).then( (value) async => await fetchTV( - Endpoints.tvSearchUrl(query, includeAdult, lang), isProxyEnabled, proxyUrl)), + Endpoints.tvSearchUrl(query, includeAdult, lang), + isProxyEnabled, + proxyUrl)), builder: (context, snapshot) { if (query.isEmpty) return searchATermWidget(themeMode); @@ -157,7 +161,9 @@ class Search extends SearchDelegate { FutureBuilder>( future: Future.delayed(const Duration(seconds: 3)).then( (value) async => await fetchPerson( - Endpoints.personSearchUrl(query, includeAdult, lang), isProxyEnabled, proxyUrl)), + Endpoints.personSearchUrl(query, includeAdult, lang), + isProxyEnabled, + proxyUrl)), builder: (context, snapshot) { if (query.isEmpty) return searchATermWidget(themeMode); switch (snapshot.connectionState) { @@ -251,7 +257,7 @@ class Search extends SearchDelegate { ), ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -311,7 +317,7 @@ class Search extends SearchDelegate { ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -328,10 +334,10 @@ class Search extends SearchDelegate { children: [ Image.asset('assets/images/404.png'), Text( - tr("no_result"), + tr('no_result'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black), ) @@ -347,9 +353,9 @@ class Search extends SearchDelegate { children: [ Image.asset('assets/images/search.png'), const Padding(padding: EdgeInsets.only(top: 10, bottom: 5)), - Text(tr("enter_word"), + Text(tr('enter_word'), style: TextStyle( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, fontFamily: 'Poppins')) @@ -418,7 +424,11 @@ class Search extends SearchDelegate { fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + moviesList[index] .posterPath!, @@ -457,8 +467,8 @@ class Search extends SearchDelegate { fontFamily: 'PoppinsSB', fontSize: 15, overflow: TextOverflow.ellipsis, - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white : Colors.black), ), @@ -476,8 +486,8 @@ class Search extends SearchDelegate { .toStringAsFixed(1), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white : Colors.black), ), @@ -489,7 +499,7 @@ class Search extends SearchDelegate { ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -566,7 +576,11 @@ class Search extends SearchDelegate { fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList[index].posterPath!, imageBuilder: @@ -604,8 +618,8 @@ class Search extends SearchDelegate { fontFamily: 'PoppinsSB', fontSize: 15, overflow: TextOverflow.ellipsis, - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white : Colors.black), ), @@ -622,8 +636,8 @@ class Search extends SearchDelegate { .toStringAsFixed(1), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white : Colors.black), ), @@ -635,7 +649,7 @@ class Search extends SearchDelegate { ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -705,7 +719,11 @@ class Search extends SearchDelegate { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + personList[index].profilePath!, imageBuilder: @@ -739,8 +757,8 @@ class Search extends SearchDelegate { style: TextStyle( fontFamily: 'PoppinsSB', fontSize: 17, - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white : Colors.black), overflow: TextOverflow.ellipsis, @@ -751,7 +769,7 @@ class Search extends SearchDelegate { ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -776,13 +794,13 @@ class Search extends SearchDelegate { TabBar( tabs: [ Tab( - text: tr("movies"), + text: tr('movies'), ), Tab( - text: tr("tv"), + text: tr('tv'), ), Tab( - text: tr("celebrities"), + text: tr('celebrities'), ) ], ), diff --git a/lib/screens/common/server_status_screen.dart b/lib/screens/common/server_status_screen.dart index 11fb74c..9753cd2 100644 --- a/lib/screens/common/server_status_screen.dart +++ b/lib/screens/common/server_status_screen.dart @@ -23,7 +23,7 @@ class ServerStatusScreen extends StatefulWidget { class _ServerStatusScreenState extends State { List? videoLinks; List videoProvidersCheck = []; - String ping = ""; + String ping = ''; DateTime? start; DateTime? end; bool checking = false; @@ -52,15 +52,15 @@ class _ServerStatusScreenState extends State { ping: '', resultMessage: '', start: null, - waitingMessage: tr("waiting_queue", - namedArgs: {"server": videoProviders[i].fullName}))); + waitingMessage: tr('waiting_queue', + namedArgs: {'server': videoProviders[i].fullName}))); } for (int i = 0; i < videoProviders.length; i++) { setState(() { videoProvidersCheck[i].waitingMessage = '${tr("checking_server")} ${videoProviders[i].fullName}'; - videoProvidersCheck[i].resultMessage = ""; - videoProvidersCheck[i].ping = ""; + videoProvidersCheck[i].resultMessage = ''; + videoProvidersCheck[i].ping = ''; videoLinks = null; videoProvidersCheck[i].isWaiting = true; start = null; @@ -69,7 +69,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getMovieStreamLinksAndSubsFlixHQ( - "${appDependency.consumetUrl}movies/flixhq/watch?episodeId=97708&mediaId=movie/watch-no-hard-feelings-97708&server=${appDependency.streamingServerFlixHQ}") + '${appDependency.consumetUrl}movies/flixhq/watch?episodeId=97708&mediaId=movie/watch-no-hard-feelings-97708&server=${appDependency.streamingServerFlixHQ}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -84,7 +84,7 @@ class _ServerStatusScreenState extends State { try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}showbox/watch-movie?tmdbId=455980") + '${appDependency.flixquestAPIURL}showbox/watch-movie?tmdbId=455980') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -98,7 +98,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getMovieTVStreamLinksAndSubsDCVA( - "${appDependency.consumetUrl}movies/dramacool/watch?id=drama-detail/a-different-girl&episodeId=a-different-girl-2021-episode-1&server=${appDependency.streamingServerDCVA}") + '${appDependency.consumetUrl}movies/dramacool/watch?id=drama-detail/a-different-girl&episodeId=a-different-girl-2021-episode-1&server=${appDependency.streamingServerDCVA}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -112,7 +112,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getMovieTVStreamLinksAndSubsDCVA( - "${appDependencyProvider.consumetUrl}movies/viewasian/watch?id=drama/tell-me-you-love-me&episodeId=/watch/tell-me-you-love-me/watching.html\$episode\$1&server=${appDependencyProvider.streamingServerDCVA}") + '${appDependencyProvider.consumetUrl}movies/viewasian/watch?id=drama/tell-me-you-love-me&episodeId=/watch/tell-me-you-love-me/watching.html\$episode\$1&server=${appDependencyProvider.streamingServerDCVA}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -126,7 +126,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getMovieTVStreamLinksAndSubsZoro( - "${appDependencyProvider.consumetUrl}anime/zoro/watch?episodeId=one-piece-movie-1-3096\$episode\$58122\$sub&server=${appDependencyProvider.streamingServerZoro}") + '${appDependencyProvider.consumetUrl}anime/zoro/watch?episodeId=one-piece-movie-1-3096\$episode\$58122\$sub&server=${appDependencyProvider.streamingServerZoro}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -139,7 +139,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}flixhq/watch-movie?tmdbId=455980&server=${appDependency.flixhqZoeServer}") + '${appDependency.flixquestAPIURL}flixhq/watch-movie?tmdbId=455980&server=${appDependency.flixhqZoeServer}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -153,7 +153,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}zoe/watch-movie?tmdbId=455980&server=${appDependency.flixhqZoeServer}") + '${appDependency.flixquestAPIURL}zoe/watch-movie?tmdbId=455980&server=${appDependency.flixhqZoeServer}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -167,7 +167,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}gomovies/watch-movie?tmdbId=455980&server=${appDependency.goMoviesServer}") + '${appDependency.flixquestAPIURL}gomovies/watch-movie?tmdbId=455980&server=${appDependency.goMoviesServer}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -181,7 +181,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}vidsrc/watch-movie?tmdbId=455980&server=${appDependency.vidSrcServer}") + '${appDependency.flixquestAPIURL}vidsrc/watch-movie?tmdbId=455980&server=${appDependency.vidSrcServer}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -195,7 +195,7 @@ class _ServerStatusScreenState extends State { start = DateTime.now(); try { await getFlixQuestAPILinks( - "${appDependency.flixquestAPIURL}vidsrcto/watch-movie?tmdbId=455980&server=${appDependency.vidSrcToServer}") + '${appDependency.flixquestAPIURL}vidsrcto/watch-movie?tmdbId=455980&server=${appDependency.vidSrcToServer}') .then((value) { if (mounted) { videoLinks = value.videoLinks; @@ -251,7 +251,7 @@ class _ServerStatusScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("check_server")), + title: Text(tr('check_server')), ), body: Center( child: SingleChildScrollView( @@ -295,8 +295,8 @@ class _ServerStatusScreenState extends State { Visibility( visible: !videoProvidersCheck[index].isWaiting!, child: Text( - tr("latency", namedArgs: { - "l": videoProvidersCheck[index].ping! + tr('latency', namedArgs: { + 'l': videoProvidersCheck[index].ping! }), style: const TextStyle( color: Colors.yellow, @@ -326,7 +326,7 @@ class _ServerStatusScreenState extends State { onPressed: () { checkServer(); }, - child: Text(tr("check"))), + child: Text(tr('check'))), ], ), ) diff --git a/lib/screens/common/settings.dart b/lib/screens/common/settings.dart index de611f8..6f27d18 100644 --- a/lib/screens/common/settings.dart +++ b/lib/screens/common/settings.dart @@ -60,235 +60,235 @@ class _SettingsState extends State { List langs = [ AppLanguages( languageFlag: 'assets/images/country_flags/united-kingdom.png', - languageName: tr("english"), + languageName: tr('english'), languageCode: 'en'), AppLanguages( languageFlag: 'assets/images/country_flags/united-arab-emirates.png', - languageName: tr("arabic"), + languageName: tr('arabic'), languageCode: 'ar'), AppLanguages( languageFlag: 'assets/images/country_flags/spain.png', - languageName: tr("spanish"), + languageName: tr('spanish'), languageCode: 'es'), AppLanguages( languageFlag: 'assets/images/country_flags/india.png', - languageName: tr("hindi"), + languageName: tr('hindi'), languageCode: 'hi') ]; List countries = [ WatchProviderCountries( - countryName: tr("uae"), + countryName: tr('uae'), flagPath: 'assets/images/country_flags/united-arab-emirates.png', isoCode: 'AE', ), WatchProviderCountries( - countryName: tr("argentina"), + countryName: tr('argentina'), flagPath: 'assets/images/country_flags/argentina.png', isoCode: 'AR', ), WatchProviderCountries( - countryName: tr("austria"), + countryName: tr('austria'), flagPath: 'assets/images/country_flags/austria.png', isoCode: 'AT', ), WatchProviderCountries( - countryName: tr("australia"), + countryName: tr('australia'), flagPath: 'assets/images/country_flags/australia.png', isoCode: 'AU', ), WatchProviderCountries( - countryName: tr("belgium"), + countryName: tr('belgium'), flagPath: 'assets/images/country_flags/belgium.png', isoCode: 'BE', ), WatchProviderCountries( - countryName: tr("bulgaria"), + countryName: tr('bulgaria'), flagPath: 'assets/images/country_flags/bulgaria.png', isoCode: 'BG', ), WatchProviderCountries( - countryName: tr("brazil"), + countryName: tr('brazil'), flagPath: 'assets/images/country_flags/brazil.png', isoCode: 'BR', ), WatchProviderCountries( - countryName: tr("canada"), + countryName: tr('canada'), flagPath: 'assets/images/country_flags/canada.png', isoCode: 'CA', ), WatchProviderCountries( - countryName: tr("switzerland"), + countryName: tr('switzerland'), flagPath: 'assets/images/country_flags/switzerland.png', isoCode: 'CH', ), WatchProviderCountries( - countryName: tr("cote_divoire"), + countryName: tr('cote_divoire'), flagPath: 'assets/images/country_flags/ivory-coast.png', isoCode: 'CI', ), WatchProviderCountries( - countryName: tr("czech_republic"), + countryName: tr('czech_republic'), flagPath: 'assets/images/country_flags/czech-republic.png', isoCode: 'CZ', ), WatchProviderCountries( - countryName: tr("germany"), + countryName: tr('germany'), flagPath: 'assets/images/country_flags/germany.png', isoCode: 'DE', ), WatchProviderCountries( - countryName: tr("denmark"), + countryName: tr('denmark'), flagPath: 'assets/images/country_flags/denmark.png', isoCode: 'DK', ), WatchProviderCountries( - countryName: tr("estonia"), + countryName: tr('estonia'), flagPath: 'assets/images/country_flags/estonia.png', isoCode: 'EE', ), WatchProviderCountries( - countryName: tr("spain"), + countryName: tr('spain'), flagPath: 'assets/images/country_flags/spain.png', isoCode: 'ES', ), WatchProviderCountries( - countryName: tr("finland"), + countryName: tr('finland'), flagPath: 'assets/images/country_flags/finland.png', isoCode: 'FI', ), WatchProviderCountries( - countryName: tr("france"), + countryName: tr('france'), flagPath: 'assets/images/country_flags/france.png', isoCode: 'FR', ), WatchProviderCountries( - countryName: tr("uk"), + countryName: tr('uk'), flagPath: 'assets/images/country_flags/united-kingdom.png', isoCode: 'GB', ), WatchProviderCountries( - countryName: tr("hong_kong"), + countryName: tr('hong_kong'), flagPath: 'assets/images/country_flags/hong-kong.png', isoCode: 'HK', ), WatchProviderCountries( - countryName: tr("croatia"), + countryName: tr('croatia'), flagPath: 'assets/images/country_flags/croatia.png', isoCode: 'HR', ), WatchProviderCountries( - countryName: tr("hungary"), + countryName: tr('hungary'), flagPath: 'assets/images/country_flags/hungary.png', isoCode: 'HU', ), WatchProviderCountries( - countryName: tr("indonesia"), + countryName: tr('indonesia'), flagPath: 'assets/images/country_flags/indonesia.png', isoCode: 'ID', ), WatchProviderCountries( - countryName: tr("ireland"), + countryName: tr('ireland'), flagPath: 'assets/images/country_flags/ireland.png', isoCode: 'IE', ), WatchProviderCountries( - countryName: tr("india"), + countryName: tr('india'), flagPath: 'assets/images/country_flags/india.png', isoCode: 'IN', ), WatchProviderCountries( - countryName: tr("italy"), + countryName: tr('italy'), flagPath: 'assets/images/country_flags/italy.png', isoCode: 'IT', ), WatchProviderCountries( - countryName: tr("japan"), + countryName: tr('japan'), flagPath: 'assets/images/country_flags/japan.png', isoCode: 'JP', ), WatchProviderCountries( - countryName: tr("kenya"), + countryName: tr('kenya'), flagPath: 'assets/images/country_flags/kenya.png', isoCode: 'KE', ), WatchProviderCountries( - countryName: tr("south_korea"), + countryName: tr('south_korea'), flagPath: 'assets/images/country_flags/south-korea.png', isoCode: 'KR', ), WatchProviderCountries( - countryName: tr("lithuania"), + countryName: tr('lithuania'), flagPath: 'assets/images/country_flags/lithuania.png', isoCode: 'LT', ), WatchProviderCountries( - countryName: tr("mexico"), + countryName: tr('mexico'), flagPath: 'assets/images/country_flags/mexico.png', isoCode: 'MX', ), WatchProviderCountries( - countryName: tr("netherlands"), + countryName: tr('netherlands'), flagPath: 'assets/images/country_flags/netherlands.png', isoCode: 'NL', ), WatchProviderCountries( - countryName: tr("norway"), + countryName: tr('norway'), flagPath: 'assets/images/country_flags/norway.png', isoCode: 'NO', ), WatchProviderCountries( - countryName: tr("new_zealand"), + countryName: tr('new_zealand'), flagPath: 'assets/images/country_flags/new-zealand.png', isoCode: 'NZ', ), WatchProviderCountries( - countryName: tr("philippines"), + countryName: tr('philippines'), flagPath: 'assets/images/country_flags/philippines.png', isoCode: 'PH', ), WatchProviderCountries( - countryName: tr("poland"), + countryName: tr('poland'), flagPath: 'assets/images/country_flags/poland.png', isoCode: 'PL', ), WatchProviderCountries( - countryName: tr("portugal"), + countryName: tr('portugal'), flagPath: 'assets/images/country_flags/portugal.png', isoCode: 'PT', ), WatchProviderCountries( - countryName: tr("serbia"), + countryName: tr('serbia'), flagPath: 'assets/images/country_flags/serbia.png', isoCode: 'RS', ), WatchProviderCountries( - countryName: tr("russia"), + countryName: tr('russia'), flagPath: 'assets/images/country_flags/russia.png', isoCode: 'RU', ), WatchProviderCountries( - countryName: tr("sweden"), + countryName: tr('sweden'), flagPath: 'assets/images/country_flags/sweden.png', isoCode: 'SE', ), WatchProviderCountries( - countryName: tr("slovakia"), + countryName: tr('slovakia'), flagPath: 'assets/images/country_flags/slovakia.png', isoCode: 'SK', ), WatchProviderCountries( - countryName: tr("turkey"), + countryName: tr('turkey'), flagPath: 'assets/images/country_flags/turkey.png', isoCode: 'TR', ), WatchProviderCountries( - countryName: tr("usa"), + countryName: tr('usa'), flagPath: 'assets/images/country_flags/united-states.png', isoCode: 'US', ), WatchProviderCountries( - countryName: tr("south_africa"), + countryName: tr('south_africa'), flagPath: 'assets/images/country_flags/south-africa.png', isoCode: 'ZA', ), @@ -316,7 +316,7 @@ class _SettingsState extends State { return Scaffold( appBar: AppBar( title: Text( - tr("settings"), + tr('settings'), ), ), body: Column( @@ -327,7 +327,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("theme_mode"), + tr('theme_mode'), ), trailing: DropdownButton( value: settingsValues.appTheme, @@ -335,17 +335,17 @@ class _SettingsState extends State { DropdownMenuItem( value: 'dark', child: Text( - tr("dark"), + tr('dark'), )), DropdownMenuItem( value: 'light', child: Text( - tr("light"), + tr('light'), )), DropdownMenuItem( value: 'amoled', child: Text( - tr("amoled"), + tr('amoled'), )) ], onChanged: (String? value) { @@ -360,7 +360,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("player_settings"), + tr('player_settings'), ), onTap: () { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -374,7 +374,7 @@ class _SettingsState extends State { inactiveThumbColor: Colors.white, inactiveTrackColor: const Color(0xFF9B9B9B), subtitle: Text( - tr("android_12"), + tr('android_12'), ), value: settingsValues.isMaterial3Enabled, secondary: Icon( @@ -382,7 +382,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("material_theming"), + tr('material_theming'), ), onChanged: (bool value) { setState(() { @@ -392,65 +392,63 @@ class _SettingsState extends State { ), ), SwitchListTile( - inactiveThumbColor: Colors.white, - inactiveTrackColor: const Color(0xFF9B9B9B), - subtitle: Text( - tr("enable_warning"), - ), - value: settingsValues.enableProxy, - secondary: Icon( - FontAwesomeIcons.networkWired, - color: Theme.of(context).colorScheme.primary, - ), - title: Text( - tr("use_proxy"), - ), - onChanged: (bool value) { - if (value) { - showDialog( - context: context, - builder: (BuildContext ctx) { - return AlertDialog( - title: Padding( - padding: const EdgeInsets.all(8.0), - child: Text(tr("use_proxy_title")), - ), - content: Text(tr("use_proxy_detail")), - actions: [ - ElevatedButton( - onPressed: () async { - Navigator.pop(context); - }, - child: Text(tr("cancel"))), - TextButton( - onPressed: () async { - setState(() { - settingsValues.enableProxy = value; - }); - Navigator.pop(context); - }, - child: Text( - tr("enable"), - - )) - ], - ); - }); - } else { - setState(() { - settingsValues.enableProxy = value; - }); - } - - }, + inactiveThumbColor: Colors.white, + inactiveTrackColor: const Color(0xFF9B9B9B), + subtitle: Text( + tr('enable_warning'), + ), + value: settingsValues.enableProxy, + secondary: Icon( + FontAwesomeIcons.networkWired, + color: Theme.of(context).colorScheme.primary, ), + title: Text( + tr('use_proxy'), + ), + onChanged: (bool value) { + if (value) { + showDialog( + context: context, + builder: (BuildContext ctx) { + return AlertDialog( + title: Padding( + padding: const EdgeInsets.all(8.0), + child: Text(tr('use_proxy_title')), + ), + content: Text(tr('use_proxy_detail')), + actions: [ + ElevatedButton( + onPressed: () async { + Navigator.pop(context); + }, + child: Text(tr('cancel'))), + TextButton( + onPressed: () async { + setState(() { + settingsValues.enableProxy = value; + }); + Navigator.pop(context); + }, + child: Text( + tr('enable'), + )) + ], + ); + }); + } else { + setState(() { + settingsValues.enableProxy = value; + }); + } + }, + ), ListTile( leading: Icon( Icons.image_rounded, color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("image_quality"), + tr('image_quality'), ), trailing: DropdownButton( value: settingsValues.imageQuality, @@ -458,17 +456,17 @@ class _SettingsState extends State { DropdownMenuItem( value: 'original/', child: Text( - tr("high"), + tr('high'), )), DropdownMenuItem( value: 'w600_and_h900_bestv2/', child: Text( - tr("medium"), + tr('medium'), )), DropdownMenuItem( value: 'w500/', child: Text( - tr("low"), + tr('low'), )) ], onChanged: (String? value) { @@ -483,7 +481,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("list_view_type"), + tr('list_view_type'), ), trailing: DropdownButton( value: settingsValues.defaultView, @@ -496,7 +494,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), Text( - tr("list"), + tr('list'), ) ])), DropdownMenuItem( @@ -507,7 +505,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), Text( - tr("grid"), + tr('grid'), ) ]), ), @@ -524,7 +522,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("default_home_screen"), + tr('default_home_screen'), ), trailing: DropdownButton( value: settingsValues.defaultValue, @@ -532,22 +530,22 @@ class _SettingsState extends State { DropdownMenuItem( value: 0, child: Text( - tr("movies"), + tr('movies'), )), DropdownMenuItem( value: 1, child: Text( - tr("tv_shows"), + tr('tv_shows'), )), DropdownMenuItem( value: 2, child: Text( - tr("discover"), + tr('discover'), )), DropdownMenuItem( value: 3, child: Text( - tr("profile"), + tr('profile'), )) ], onChanged: (int? value) { @@ -567,7 +565,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("app_language"), + tr('app_language'), ), trailing: Wrap( spacing: 10, @@ -592,7 +590,7 @@ class _SettingsState extends State { color: Theme.of(context).colorScheme.primary, ), title: Text( - tr("watch_country"), + tr('watch_country'), ), trailing: Wrap( spacing: 10, @@ -611,36 +609,44 @@ class _SettingsState extends State { FontAwesomeIcons.eraser, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("clear_cache")), + title: Text(tr('clear_cache')), trailing: ElevatedButton( onPressed: () async { - await clearCache().then((value) => - GlobalMethods.showCustomScaffoldMessage( - SnackBar( - duration: - const Duration(seconds: 1, milliseconds: 500), - content: Text(value - ? tr("cleared_cache") - : tr("cache_doesnt_exist"))), - context)); - await clearTempCache().then((value) => - GlobalMethods.showCustomScaffoldMessage( - SnackBar( - duration: - const Duration(seconds: 1, milliseconds: 500), - content: Text(value - ? tr("cleared_cache") - : tr("cache_doesnt_exist"))), - context)); + await clearCache().then((value) { + if (!context.mounted) { + return; + } + GlobalMethods.showCustomScaffoldMessage( + SnackBar( + duration: + const Duration(seconds: 1, milliseconds: 500), + content: Text(value + ? tr('cleared_cache') + : tr('cache_doesnt_exist'))), + context); + }); + await clearTempCache().then((value) { + if (!context.mounted) { + return; + } + GlobalMethods.showCustomScaffoldMessage( + SnackBar( + duration: + const Duration(seconds: 1, milliseconds: 500), + content: Text(value + ? tr('cleared_cache') + : tr('cache_doesnt_exist'))), + context); + }); }, - child: Text(tr("clear"))), + child: Text(tr('clear'))), ), ListTile( leading: Icon( Icons.format_color_fill_rounded, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("custom_color")), + title: Text(tr('custom_color')), ), SizedBox( width: double.infinity, diff --git a/lib/screens/common/sublanguage_choose.dart b/lib/screens/common/sublanguage_choose.dart index 94ed1d8..545bb7a 100644 --- a/lib/screens/common/sublanguage_choose.dart +++ b/lib/screens/common/sublanguage_choose.dart @@ -15,115 +15,115 @@ class _SubLangChooseState extends State { List supportedLanguages = [ SubLanguages(languageName: '', languageCode: '', englishName: 'any'), SubLanguages( - languageName: tr("arabic"), languageCode: 'ar', englishName: 'Arabic'), + languageName: tr('arabic'), languageCode: 'ar', englishName: 'Arabic'), SubLanguages( - languageName: tr("bulgarian"), + languageName: tr('bulgarian'), languageCode: 'bg', englishName: 'Bulgarian'), SubLanguages( - languageName: tr("chinese"), + languageName: tr('chinese'), languageCode: 'zh', englishName: 'Chinese'), SubLanguages( - languageName: tr("croaitian"), + languageName: tr('croaitian'), languageCode: 'hr', englishName: 'Croaitian'), SubLanguages( - languageName: tr("czech"), languageCode: 'cs', englishName: 'Czech'), + languageName: tr('czech'), languageCode: 'cs', englishName: 'Czech'), SubLanguages( - languageName: tr("danish"), languageCode: 'da', englishName: 'Danish'), + languageName: tr('danish'), languageCode: 'da', englishName: 'Danish'), SubLanguages( - languageName: tr("dutch"), languageCode: 'nl', englishName: 'Dutch'), + languageName: tr('dutch'), languageCode: 'nl', englishName: 'Dutch'), SubLanguages( - languageName: tr("english"), + languageName: tr('english'), languageCode: 'en', englishName: 'English'), SubLanguages( - languageName: tr("estonian"), + languageName: tr('estonian'), languageCode: 'et', englishName: 'Estonian'), SubLanguages( - languageName: tr("finnish"), + languageName: tr('finnish'), languageCode: 'fi', englishName: 'Finnish'), SubLanguages( - languageName: tr("french"), languageCode: 'fr', englishName: 'French'), + languageName: tr('french'), languageCode: 'fr', englishName: 'French'), SubLanguages( - languageName: tr("german"), languageCode: 'de', englishName: 'German'), + languageName: tr('german'), languageCode: 'de', englishName: 'German'), SubLanguages( - languageName: tr("greek"), languageCode: 'el', englishName: 'Greek'), + languageName: tr('greek'), languageCode: 'el', englishName: 'Greek'), SubLanguages( - languageName: tr("hebrew"), languageCode: 'he', englishName: 'Hebrew'), + languageName: tr('hebrew'), languageCode: 'he', englishName: 'Hebrew'), SubLanguages( - languageName: tr("hindi"), languageCode: 'hi', englishName: 'Hindi'), + languageName: tr('hindi'), languageCode: 'hi', englishName: 'Hindi'), SubLanguages( - languageName: tr("hungarian"), + languageName: tr('hungarian'), languageCode: 'hu', englishName: 'Hungarian'), SubLanguages( - languageName: tr("indonesian"), + languageName: tr('indonesian'), languageCode: 'id', englishName: 'Indonesian'), SubLanguages( - languageName: tr("italian"), + languageName: tr('italian'), languageCode: 'it', englishName: 'Italian'), SubLanguages( - languageName: tr("japanese"), + languageName: tr('japanese'), languageCode: 'ja', englishName: 'Japanese'), SubLanguages( - languageName: tr("korean"), languageCode: 'ko', englishName: 'Korean'), + languageName: tr('korean'), languageCode: 'ko', englishName: 'Korean'), SubLanguages( - languageName: tr("latvian"), + languageName: tr('latvian'), languageCode: 'lv', englishName: 'Latvian'), SubLanguages( - languageName: tr("lithuanian"), + languageName: tr('lithuanian'), languageCode: 'lt', englishName: 'Lithuanian'), SubLanguages( - languageName: tr("malay"), languageCode: 'ms', englishName: 'Malay'), + languageName: tr('malay'), languageCode: 'ms', englishName: 'Malay'), SubLanguages( - languageName: tr("norwegian"), + languageName: tr('norwegian'), languageCode: 'no', englishName: 'Norwegian'), SubLanguages( - languageName: tr("polish"), languageCode: 'pl', englishName: 'Polish'), + languageName: tr('polish'), languageCode: 'pl', englishName: 'Polish'), SubLanguages( - languageName: tr("portuguese"), + languageName: tr('portuguese'), languageCode: 'pt', englishName: 'Portuguese'), SubLanguages( - languageName: tr("romanian"), + languageName: tr('romanian'), languageCode: 'ro', englishName: 'Romanian'), SubLanguages( - languageName: tr("russian"), + languageName: tr('russian'), languageCode: 'ru', englishName: 'Russian'), SubLanguages( - languageName: tr("slovak"), languageCode: 'sk', englishName: 'Slovak'), + languageName: tr('slovak'), languageCode: 'sk', englishName: 'Slovak'), SubLanguages( - languageName: tr("slovene"), + languageName: tr('slovene'), languageCode: 'sl', englishName: 'Slovene'), SubLanguages( - languageName: tr("spanish"), + languageName: tr('spanish'), languageCode: 'es', englishName: 'Spanish'), SubLanguages( - languageName: tr("swedish"), + languageName: tr('swedish'), languageCode: 'sv', englishName: 'Swedish'), SubLanguages( - languageName: tr("thai"), languageCode: 'th', englishName: 'Thai'), + languageName: tr('thai'), languageCode: 'th', englishName: 'Thai'), SubLanguages( - languageName: tr("turkish"), + languageName: tr('turkish'), languageCode: 'tr', englishName: 'Turkish'), SubLanguages( - languageName: tr("ukrainian"), + languageName: tr('ukrainian'), languageCode: 'uk', englishName: 'Ukrainian'), ]; @@ -132,7 +132,7 @@ class _SubLangChooseState extends State { Widget build(BuildContext context) { final languageChange = Provider.of(context); return Scaffold( - appBar: AppBar(title: Text(tr("choose_subtitle_language"))), + appBar: AppBar(title: Text(tr('choose_subtitle_language'))), body: SingleChildScrollView( child: Center( child: Column( @@ -140,7 +140,7 @@ class _SubLangChooseState extends State { .map( (SubLanguages languages) => ListTile( title: Text(languages.languageName == '' - ? tr("any") + ? tr('any') : languages.languageName), leading: Wrap( crossAxisAlignment: WrapCrossAlignment.center, diff --git a/lib/screens/common/sync_screen.dart b/lib/screens/common/sync_screen.dart index 5eff262..945b5a8 100644 --- a/lib/screens/common/sync_screen.dart +++ b/lib/screens/common/sync_screen.dart @@ -100,7 +100,7 @@ class _SyncScreenState extends State .then((value) { if (mounted) { setState(() { - for (Map? element + for (final Map? element in List.from(value.get('movies'))) { firebaseMovies.add(Movie.fromJson(element!)); } @@ -115,7 +115,7 @@ class _SyncScreenState extends State .then((value) { if (mounted) { setState(() { - for (Map? element + for (final Map? element in List.from(value.get('tvShows'))) { firebaseTvShows.add(TV.fromJson(element!)); } @@ -159,7 +159,7 @@ class _SyncScreenState extends State GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("finished_sync_local"), + tr('finished_sync_local'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -200,7 +200,7 @@ class _SyncScreenState extends State GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("finished_sync_local"), + tr('finished_sync_local'), style: kTextSmallBodyStyle, maxLines: 3, ), @@ -230,7 +230,7 @@ class _SyncScreenState extends State .then((value) { if (mounted) { setState(() { - for (Map? element + for (final Map? element in List.from(value.get('movies'))) { firebaseMovieForOnlineSync.add(Movie.fromJson(element!)); } @@ -254,7 +254,7 @@ class _SyncScreenState extends State return list.any((item) => item.id == id); } - for (var movie in sqliteMovieForOnlineSync) { + for (final movie in sqliteMovieForOnlineSync) { if (!containsById(difference, movie.id!)) { difference.add(movie); } @@ -282,7 +282,7 @@ class _SyncScreenState extends State GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("finished_sync_online"), + tr('finished_sync_online'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -310,7 +310,7 @@ class _SyncScreenState extends State .then((value) { if (mounted) { setState(() { - for (Map? element + for (final Map? element in List.from(value.get('tvShows'))) { firebaseTVForOnlineSync.add(TV.fromJson(element!)); } @@ -332,7 +332,7 @@ class _SyncScreenState extends State return list.any((item) => item.id == id); } - for (var tv in sqliteTVForOnlineSync) { + for (final tv in sqliteTVForOnlineSync) { if (!containsById(difference, tv.id!)) { difference.add(tv); } @@ -358,7 +358,7 @@ class _SyncScreenState extends State GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("finished_sync_online"), + tr('finished_sync_online'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -408,7 +408,7 @@ class _SyncScreenState extends State return Scaffold( appBar: AppBar( - title: Text(tr("sync")), + title: Text(tr('sync')), ), body: isLoading! ? const Padding( @@ -430,7 +430,7 @@ class _SyncScreenState extends State child: Icon(Icons.movie_creation_rounded), ), Text( - tr("movies"), + tr('movies'), ), ], )), @@ -442,12 +442,12 @@ class _SyncScreenState extends State padding: EdgeInsets.only(right: 8.0), child: Icon(Icons.live_tv_rounded)), Text( - tr("tv_series"), + tr('tv_series'), ), ], )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, @@ -477,7 +477,7 @@ class _SyncScreenState extends State children: [ Center( child: Text( - tr("no_movies_online"), + tr('no_movies_online'), textAlign: TextAlign.center, maxLines: 3, style: kTextSmallBodyStyle, @@ -497,7 +497,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("online_movie_sync"), + tr('online_movie_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -527,7 +527,7 @@ class _SyncScreenState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("movies_online"), + tr('movies_online'), style: kTextSmallHeaderStyle, ), SizedBox( @@ -549,7 +549,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("offline_movie_sync"), + tr('offline_movie_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -587,7 +587,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("online_movie_sync"), + tr('online_movie_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -625,7 +625,7 @@ class _SyncScreenState extends State children: [ Center( child: Text( - tr("no_tv_online"), + tr('no_tv_online'), textAlign: TextAlign.center, maxLines: 3, style: kTextSmallBodyStyle, @@ -645,7 +645,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("online_tv_sync"), + tr('online_tv_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -675,7 +675,7 @@ class _SyncScreenState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("tv_online"), + tr('tv_online'), style: kTextSmallHeaderStyle, ), SizedBox( @@ -697,7 +697,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("offline_tv_sync"), + tr('offline_tv_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -735,7 +735,7 @@ class _SyncScreenState extends State children: [ Expanded( child: Text( - tr("online_tv_sync"), + tr('online_tv_sync'), textAlign: TextAlign.center, maxLines: 3, ), @@ -818,7 +818,11 @@ class _SyncScreenState extends State .posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + firebaseTvShows[index].posterPath!, imageBuilder: (context, imageProvider) => @@ -924,7 +928,11 @@ class _SyncScreenState extends State imageUrl: firebaseMovies[index].posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + firebaseMovies[index] .posterPath!, diff --git a/lib/screens/common/update_screen.dart b/lib/screens/common/update_screen.dart index b187f18..4fb5e35 100644 --- a/lib/screens/common/update_screen.dart +++ b/lib/screens/common/update_screen.dart @@ -1,4 +1,4 @@ -// ignore_for_file: must_be_immutable +// ignore_for_file: must_be_immutable, deprecated_member_use import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; @@ -28,7 +28,7 @@ class UpdateScreen extends StatefulWidget { class _UpdateScreenState extends State { UpdateChecker? updateChecker; var downloadManager = DownloadManager(); - var savedDir = ""; + var savedDir = ''; bool retry = false; @override @@ -75,20 +75,20 @@ class _UpdateScreenState extends State { context: context, builder: (BuildContext ctx) { return AlertDialog( - content: Text(tr("must_update")), + content: Text(tr('must_update')), actions: [ ElevatedButton( onPressed: () async { Navigator.pop(context); }, - child: Text(tr("update")), + child: Text(tr('update')), ), TextButton( onPressed: () async { SystemNavigator.pop(); }, child: Text( - tr("exit"), + tr('exit'), style: const TextStyle(color: Colors.red), )) ], @@ -102,7 +102,7 @@ class _UpdateScreenState extends State { }, child: Scaffold( appBar: AppBar( - title: Text(tr("check_for_update")), + title: Text(tr('check_for_update')), ), body: Center( child: Padding( @@ -117,7 +117,7 @@ class _UpdateScreenState extends State { .signal_cellular_connected_no_internet_0_bar_rounded, size: 70), Text( - tr("internet_problem"), + tr('internet_problem'), style: const TextStyle(fontSize: 20), textAlign: TextAlign.center, ), @@ -128,7 +128,7 @@ class _UpdateScreenState extends State { onPressed: () { checkUpdate(); }, - child: Text(tr("retry"))), + child: Text(tr('retry'))), ], ) : updateChecker == null @@ -139,12 +139,12 @@ class _UpdateScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - tr("update_available"), + tr('update_available'), style: kTextHeaderStyle, ), Text( - tr("new_version", namedArgs: { - "v": updateChecker!.versionNumber! + tr('new_version', namedArgs: { + 'v': updateChecker!.versionNumber! }), style: kTextSmallBodyStyle, ), @@ -154,7 +154,7 @@ class _UpdateScreenState extends State { context: context, builder: (_) { return SimpleDialog( - title: Text(tr("changelogs")), + title: Text(tr('changelogs')), children: [ Padding( padding: @@ -166,7 +166,7 @@ class _UpdateScreenState extends State { ]); }); }, - child: Text(tr("see_changelogs"))), + child: Text(tr('see_changelogs'))), ListItem( appVersion: updateChecker!.versionNumber!, onDownloadPlayPausedPressed: (url) async { @@ -196,7 +196,7 @@ class _UpdateScreenState extends State { } } else { downloadManager.addDownload(url, - "$savedDir/${downloadManager.getFileNameFromUrl(url)}"); + '$savedDir/${downloadManager.getFileNameFromUrl(url)}'); } }); }, @@ -204,7 +204,7 @@ class _UpdateScreenState extends State { // OpenFile.open( // "$savedDir/${downloadManager.getFileNameFromUrl(url)}"); var fileName = - "$savedDir/${downloadManager.getFileNameFromUrl(url)}"; + '$savedDir/${downloadManager.getFileNameFromUrl(url)}'; var file = File(fileName); if (file.existsSync()) { OpenFile.open(file.path); @@ -212,7 +212,7 @@ class _UpdateScreenState extends State { }, onDelete: (url) async { var fileName = - "$savedDir/${downloadManager.getFileNameFromUrl(url)}"; + '$savedDir/${downloadManager.getFileNameFromUrl(url)}'; var file = File(fileName); if (file.existsSync()) { file.delete(); @@ -225,7 +225,7 @@ class _UpdateScreenState extends State { ) : Center( child: Text( - tr("no_update"), + tr('no_update'), textAlign: TextAlign.center, style: kTextHeaderStyle, ), @@ -242,7 +242,7 @@ class ListItem extends StatefulWidget { final Function(String) onOpen; final Function(String) onDelete; DownloadTask? downloadTask; - String url = ""; + String url = ''; String appVersion; ListItem( @@ -295,17 +295,17 @@ class _ListItemState extends State { padding: const EdgeInsets.symmetric(vertical: 8), child: Text( value == DownloadStatus.downloading - ? tr("downloading_file") + ? tr('downloading_file') : value == DownloadStatus.completed - ? tr("file_downloaded") + ? tr('file_downloaded') : value == DownloadStatus.failed - ? tr("downloading_failed") + ? tr('downloading_failed') : value == DownloadStatus.paused - ? tr("downloading_paused") + ? tr('downloading_paused') : value == DownloadStatus .canceled - ? tr("download_cancelled") + ? tr('download_cancelled') : value.toString(), style: const TextStyle(fontSize: 16)), ); @@ -340,14 +340,14 @@ class _ListItemState extends State { onPressed: () { widget.onDownloadPlayPausedPressed(widget.url); }, - child: Text(tr("pause"))); + child: Text(tr('pause'))); case DownloadStatus.paused: return ElevatedButton( onPressed: () { widget.onDownloadPlayPausedPressed(widget.url); }, - child: Text(tr("resume"))); + child: Text(tr('resume'))); case DownloadStatus.completed: return Row( @@ -360,13 +360,13 @@ class _ListItemState extends State { onPressed: () { widget.onOpen(widget.url); }, - child: Text(tr("install"))), + child: Text(tr('install'))), ), ElevatedButton( onPressed: () { widget.onDelete(widget.url); }, - child: Text(tr("delete"))), + child: Text(tr('delete'))), ], ); case DownloadStatus.failed: @@ -378,11 +378,11 @@ class _ListItemState extends State { }); widget.onDownloadPlayPausedPressed(widget.url); }, - child: Text(tr("download"))); + child: Text(tr('download'))); case DownloadStatus.queued: break; } - return Text("$value", + return Text('$value', style: const TextStyle(fontSize: 16)); }) : ElevatedButton( @@ -391,7 +391,7 @@ class _ListItemState extends State { properties: {'App version': widget.appVersion}); widget.onDownloadPlayPausedPressed(widget.url); }, - child: Text(tr("download"))) + child: Text(tr('download'))) ], ), ), @@ -410,7 +410,7 @@ class UpdateBottom extends StatefulWidget { class _UpdateBottomState extends State { String? appVersion = - FirebaseRemoteConfig.instance.getString("latest_version"); + FirebaseRemoteConfig.instance.getString('latest_version'); bool visible = false; bool disableCheck = false; @@ -418,7 +418,7 @@ class _UpdateBottomState extends State { Future getData() async { setState(() { - ignoreVersion = sharedPrefsSingleton.getString("ignore_version") ?? ""; + ignoreVersion = sharedPrefsSingleton.getString('ignore_version') ?? ''; visible = ignoreVersion != appVersion! && appVersion != null && appVersion != currentAppVersion; @@ -427,9 +427,9 @@ class _UpdateBottomState extends State { Future checkAction(bool value) async { if (value && appVersion != null) { - sharedPrefsSingleton.setString("ignore_version", appVersion!); + sharedPrefsSingleton.setString('ignore_version', appVersion!); } else { - sharedPrefsSingleton.setString("ignore_version", ""); + sharedPrefsSingleton.setString('ignore_version', ''); } } @@ -453,7 +453,7 @@ class _UpdateBottomState extends State { padding: const EdgeInsets.symmetric(vertical: 10), child: Column(children: [ Text( - tr("update_available"), + tr('update_available'), style: kTextHeaderStyle, maxLines: 3, textAlign: TextAlign.center, @@ -462,7 +462,7 @@ class _UpdateBottomState extends State { height: 10, ), Text( - tr("new_version", namedArgs: {"v": appVersion ?? ""}), + tr('new_version', namedArgs: {'v': appVersion ?? ''}), style: kTextSmallBodyStyle, textAlign: TextAlign.center, maxLines: 2, @@ -479,7 +479,7 @@ class _UpdateBottomState extends State { ); }))); }, - child: Text(tr("goto_update"))), + child: Text(tr('goto_update'))), const SizedBox( height: 10, ), diff --git a/lib/screens/movie/bookmark_movies_tab.dart b/lib/screens/movie/bookmark_movies_tab.dart index 83a9189..245c30e 100644 --- a/lib/screens/movie/bookmark_movies_tab.dart +++ b/lib/screens/movie/bookmark_movies_tab.dart @@ -47,7 +47,7 @@ class _MovieBookmarkState extends State { : widget.movieList!.isEmpty ? Center( child: Text( - tr("no_movies_bookmarked"), + tr('no_movies_bookmarked'), textAlign: TextAlign.center, style: kTextSmallHeaderStyle, maxLines: 4, @@ -130,7 +130,11 @@ class _MovieBookmarkState extends State { const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.movieList![index].posterPath!, imageBuilder: @@ -162,7 +166,8 @@ class _MovieBookmarkState extends State { Container( margin: const EdgeInsets - .all(3), + .all( + 3), alignment: Alignment .topLeft, @@ -172,9 +177,9 @@ class _MovieBookmarkState extends State { borderRadius: BorderRadius.circular( 8), - color: themeMode == "dark" || + color: themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors .black45 : Colors @@ -283,7 +288,7 @@ class _MovieBookmarkState extends State { Padding( padding: const EdgeInsets - .only( + .only( right: 10.0), child: SizedBox( @@ -395,7 +400,7 @@ class _MovieBookmarkState extends State { ), Divider( color: themeMode == - "light" + 'light' ? Colors.black54 : Colors.white54, thickness: 1, diff --git a/lib/screens/movie/collection_detail.dart b/lib/screens/movie/collection_detail.dart index 3e5aad9..e8eab78 100644 --- a/lib/screens/movie/collection_detail.dart +++ b/lib/screens/movie/collection_detail.dart @@ -44,11 +44,11 @@ class CollectionDetailsWidgetState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -183,7 +183,11 @@ class CollectionDetailsWidgetState extends State 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.belongsToCollection! .posterPath!, @@ -246,7 +250,7 @@ class CollectionDetailsWidgetState extends State children: [ const LeadingDot(), Text( - tr("overview"), + tr('overview'), style: kTextHeaderStyle, ), ], @@ -263,7 +267,7 @@ class CollectionDetailsWidgetState extends State // child: CollectionOverviewWidget(), ), PartsList( - title: tr("movies"), + title: tr('movies'), api: Endpoints.getCollectionDetails( widget.belongsToCollection!.id!, lang), ) diff --git a/lib/screens/movie/discover_movie_result.dart b/lib/screens/movie/discover_movie_result.dart index 6f4a550..0837a6a 100644 --- a/lib/screens/movie/discover_movie_result.dart +++ b/lib/screens/movie/discover_movie_result.dart @@ -29,11 +29,12 @@ class _DiscoverMovieResultState extends State { final _scrollController = ScrollController(); int pageNum = 2; bool isLoading = false; - void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -43,7 +44,9 @@ class _DiscoverMovieResultState extends State { if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -61,10 +64,14 @@ class _DiscoverMovieResultState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchMovies( - '${widget.api}&page=${widget.page}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + '${widget.api}&page=${widget.page}&include_adult=${widget.includeAdult}', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -83,7 +90,7 @@ class _DiscoverMovieResultState extends State { return Scaffold( appBar: AppBar( title: Text( - tr("discover_movies"), + tr('discover_movies'), ), leading: IconButton( icon: const Icon( @@ -108,7 +115,7 @@ class _DiscoverMovieResultState extends State { padding: const EdgeInsets.all(8), child: Center( child: Text( - tr("parameter_movie_404"), + tr('parameter_movie_404'), style: kTextHeaderStyle, textAlign: TextAlign.center, ), diff --git a/lib/screens/movie/discover_movies_tab.dart b/lib/screens/movie/discover_movies_tab.dart index e14e1c5..aae128b 100644 --- a/lib/screens/movie/discover_movies_tab.dart +++ b/lib/screens/movie/discover_movies_tab.dart @@ -145,7 +145,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("sort_by"), + tr('sort_by'), style: kTextHeaderStyle, ), ), @@ -173,7 +173,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("include_adult"), + tr('include_adult'), style: kTextHeaderStyle, ), ), @@ -203,7 +203,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("release_year"), + tr('release_year'), style: kTextHeaderStyle, ), ), @@ -230,7 +230,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("total_ratings"), + tr('total_ratings'), style: kTextHeaderStyle, ), ), @@ -263,8 +263,8 @@ class _DiscoverMoviesTabState extends State { Padding( padding: const EdgeInsets.fromLTRB(30.0, 0.0, 30, 15), child: Text( - tr("ratings_count", namedArgs: { - "r": movieTotalRatingSlider.toInt().toString() + tr('ratings_count', namedArgs: { + 'r': movieTotalRatingSlider.toInt().toString() }), textAlign: TextAlign.center, style: const TextStyle(fontSize: 20), @@ -277,7 +277,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("with_genres"), + tr('with_genres'), style: kTextHeaderStyle, ), ), @@ -321,7 +321,7 @@ class _DiscoverMoviesTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("with_streaming_services"), + tr('with_streaming_services'), style: kTextHeaderStyle, ), ), @@ -362,9 +362,9 @@ class _DiscoverMoviesTabState extends State { Padding( padding: const EdgeInsets.all(8.0), child: ElevatedButton( - style: ButtonStyle( - minimumSize: MaterialStateProperty.all( - const Size(double.infinity, 50)), + style: const ButtonStyle( + minimumSize: + WidgetStatePropertyAll(Size(double.infinity, 50)), ), onPressed: () { joinGenreStrings(); @@ -385,7 +385,7 @@ class _DiscoverMoviesTabState extends State { children: [ Padding( padding: const EdgeInsets.only(right: 8.0), - child: Text(tr("discover")), + child: Text(tr('discover')), ), const Icon(FontAwesomeIcons.wandMagicSparkles) ], diff --git a/lib/screens/movie/genremovies.dart b/lib/screens/movie/genremovies.dart index 5cb8606..1619fc0 100644 --- a/lib/screens/movie/genremovies.dart +++ b/lib/screens/movie/genremovies.dart @@ -19,7 +19,7 @@ class GenreMovies extends StatelessWidget { return Scaffold( appBar: AppBar( title: Text( - tr("genre_movie_title", namedArgs: {"g": genres.genreName ?? "Null"}), + tr('genre_movie_title', namedArgs: {'g': genres.genreName ?? 'Null'}), ), leading: IconButton( icon: const Icon( diff --git a/lib/screens/movie/main_movies_list.dart b/lib/screens/movie/main_movies_list.dart index 9a3aad4..252402b 100644 --- a/lib/screens/movie/main_movies_list.dart +++ b/lib/screens/movie/main_movies_list.dart @@ -33,8 +33,10 @@ class MainMoviesListState extends State { bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -43,7 +45,9 @@ class MainMoviesListState extends State { }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -61,9 +65,12 @@ class MainMoviesListState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -81,7 +88,7 @@ class MainMoviesListState extends State { final viewType = Provider.of(context).defaultView; return Scaffold( appBar: AppBar( - title: Text(tr("movie_type", namedArgs: {"t": widget.title})), + title: Text(tr('movie_type', namedArgs: {'t': widget.title})), ), body: moviesList == null && viewType == 'grid' ? moviesAndTVShowGridShimmer(themeMode) @@ -92,7 +99,7 @@ class MainMoviesListState extends State { scrollController: _scrollController) : moviesList!.isEmpty ? Center( - child: Text(tr("movie_404")), + child: Text(tr('movie_404')), ) : Column( children: [ diff --git a/lib/screens/movie/movie_castandcrew.dart b/lib/screens/movie/movie_castandcrew.dart index 7792e11..7466cca 100644 --- a/lib/screens/movie/movie_castandcrew.dart +++ b/lib/screens/movie/movie_castandcrew.dart @@ -34,7 +34,7 @@ class _MovieCastAndCrewState extends State appBar: AppBar( elevation: 3, title: Text( - tr("cast_and_crew"), + tr('cast_and_crew'), ), leading: IconButton( icon: const Icon( @@ -53,14 +53,14 @@ class _MovieCastAndCrewState extends State tabs: [ Tab( child: Text( - tr("cast"), + tr('cast'), )), Tab( child: Text( - tr("crew"), + tr('crew'), )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/movie/movie_detail.dart b/lib/screens/movie/movie_detail.dart index e7eb9a4..fd79398 100644 --- a/lib/screens/movie/movie_detail.dart +++ b/lib/screens/movie/movie_detail.dart @@ -64,11 +64,11 @@ class MovieDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -80,11 +80,11 @@ class MovieDetailPageState extends State child: Text( widget.movie.releaseDate == null ? widget.movie.title! - : widget.movie.releaseDate == "" + : widget.movie.releaseDate == '' ? widget.movie.title! : '${widget.movie.title!} (${DateTime.parse(widget.movie.releaseDate!).year})', style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 390, @@ -114,11 +114,11 @@ class MovieDetailPageState extends State floatingActionButton: FloatingActionButton( onPressed: () async { await Share.share(tr( - "share_movie", + 'share_movie', namedArgs: { - "title": widget.movie.title!, - "rating": widget.movie.voteAverage!.toStringAsFixed(1), - "id": widget.movie.id.toString() + 'title': widget.movie.title!, + 'rating': widget.movie.voteAverage!.toStringAsFixed(1), + 'id': widget.movie.id.toString() }, )); }, diff --git a/lib/screens/movie/movie_stream_select.dart b/lib/screens/movie/movie_stream_select.dart index 8e5ea58..b3c47ee 100644 --- a/lib/screens/movie/movie_stream_select.dart +++ b/lib/screens/movie/movie_stream_select.dart @@ -29,7 +29,7 @@ class _MovieStreamSelectState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("watch_movie", namedArgs: {"movie": widget.movieName})), + title: Text(tr('watch_movie', namedArgs: {'movie': widget.movieName})), leading: IconButton( icon: const Icon( Icons.arrow_back, @@ -191,7 +191,7 @@ class StreamListWidget extends StatelessWidget { ], ), Divider( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white54 : Colors.black54, ) diff --git a/lib/screens/movie/movie_video_loader.dart b/lib/screens/movie/movie_video_loader.dart index d707f9e..7466848 100644 --- a/lib/screens/movie/movie_video_loader.dart +++ b/lib/screens/movie/movie_video_loader.dart @@ -77,7 +77,7 @@ class _MovieVideoLoaderState extends State { List subs = []; late int foundIndex; - late String currentProvider = ""; + late String currentProvider = ''; @override void initState() { @@ -109,7 +109,7 @@ class _MovieVideoLoaderState extends State { if (widget.metadata.releaseDate != null && !isReleased(widget.metadata.releaseDate!)) { GlobalMethods.showScaffoldMessage( - tr("movie_may_not_be_available"), context); + tr('movie_may_not_be_available'), context); } for (int i = 0; i < videoProviders.length; i++) { if (mounted) { @@ -172,7 +172,7 @@ class _MovieVideoLoaderState extends State { showModalBottomSheet( builder: (context) { return ReportErrorWidget( - error: tr("movie_vid_404"), + error: tr('movie_vid_404'), hideButton: false, ); }, @@ -199,7 +199,7 @@ class _MovieVideoLoaderState extends State { subs: subs, colors: [ Theme.of(context).primaryColor, - Theme.of(context).colorScheme.background + Theme.of(context).colorScheme.surface ], settings: settings, movieMetadata: widget.metadata, @@ -219,7 +219,7 @@ class _MovieVideoLoaderState extends State { showModalBottomSheet( builder: (context) { return ReportErrorWidget( - error: tr("movie_vid_404"), + error: tr('movie_vid_404'), hideButton: false, ); }, @@ -262,7 +262,7 @@ class _MovieVideoLoaderState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), height: 150, width: 190, @@ -287,14 +287,14 @@ class _MovieVideoLoaderState extends State { style: const TextStyle(fontSize: 15), children: [ TextSpan( - text: tr("fetching"), + text: tr('fetching'), style: TextStyle( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, fontFamily: 'Poppins')), TextSpan( text: currentProvider, style: TextStyle( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, fontFamily: 'PoppinsBold', )) ])), @@ -303,8 +303,8 @@ class _MovieVideoLoaderState extends State { settings.defaultSubtitleLanguage != '' ? false : true, child: Text( 'Subtitle load progress: ${loadProgress.toStringAsFixed(0).toString()}%', - style: TextStyle( - color: Theme.of(context).colorScheme.background), + style: + TextStyle(color: Theme.of(context).colorScheme.surface), ), ), ], @@ -319,7 +319,7 @@ class _MovieVideoLoaderState extends State { for (int k = 0; k < vids.length; k++) { if (vids[k].quality! == 'unknown quality') { videos.addAll({ - "${vids[k].quality!} $k": vids[k].url!, + '${vids[k].quality!} $k': vids[k].url!, }); } else { videos.addAll({ @@ -334,10 +334,9 @@ class _MovieVideoLoaderState extends State { getAppLanguage(); final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = - Provider.of(context, listen: false).tmdbProxy; + final appDep = Provider.of(context, listen: false); try { - if (subtitles.isNotEmpty) { + if (subtitles.isNotEmpty && appDep.fetchSubtitles) { if (supportedLanguages[foundIndex].englishName == '') { for (int i = 0; i < subtitles.length - 1; i++) { if (mounted) { @@ -412,9 +411,9 @@ class _MovieVideoLoaderState extends State { if (appDep.useExternalSubtitles) { await fetchSocialLinks( Endpoints.getExternalLinksForMovie( - widget.metadata.movieId!, "en"), + widget.metadata.movieId!, 'en'), isProxyEnabled, - proxyUrl, + appDep.tmdbProxy, ).then((value) async { if (value.imdbId != null) { await getExternalSubtitle( @@ -458,7 +457,7 @@ class _MovieVideoLoaderState extends State { if (mounted) { await getMovieStreamEpisodesTMDB(Endpoints.getMovieTVStreamInfoTMDB( widget.metadata.movieId!.toString(), - "movie", + 'movie', appDep.consumetUrl)) .then((value) async { if (mounted) { diff --git a/lib/screens/movie/streaming_services_movies.dart b/lib/screens/movie/streaming_services_movies.dart index 956615b..1c14530 100644 --- a/lib/screens/movie/streaming_services_movies.dart +++ b/lib/screens/movie/streaming_services_movies.dart @@ -21,7 +21,7 @@ class StreamingServicesMovies extends StatelessWidget { return Scaffold( appBar: AppBar( title: Text( - tr("streaming_service_movie", namedArgs: {"provider": providerName}), + tr('streaming_service_movie', namedArgs: {'provider': providerName}), ), leading: IconButton( icon: const Icon( diff --git a/lib/screens/person/cast_detail.dart b/lib/screens/person/cast_detail.dart index b703021..0a4a45b 100644 --- a/lib/screens/person/cast_detail.dart +++ b/lib/screens/person/cast_detail.dart @@ -58,11 +58,11 @@ class CastDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -74,7 +74,7 @@ class CastDetailPageState extends State child: Text( widget.cast!.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 210, diff --git a/lib/screens/person/createdby_detail.dart b/lib/screens/person/createdby_detail.dart index 57d77ad..62ba538 100644 --- a/lib/screens/person/createdby_detail.dart +++ b/lib/screens/person/createdby_detail.dart @@ -58,11 +58,11 @@ class CreatedByPersonDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -74,7 +74,7 @@ class CreatedByPersonDetailPageState extends State child: Text( widget.createdBy!.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 210, diff --git a/lib/screens/person/crew_detail.dart b/lib/screens/person/crew_detail.dart index f05e277..51402e3 100644 --- a/lib/screens/person/crew_detail.dart +++ b/lib/screens/person/crew_detail.dart @@ -59,11 +59,11 @@ class CrewDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -75,7 +75,7 @@ class CrewDetailPageState extends State child: Text( widget.crew!.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 210, diff --git a/lib/screens/person/guest_star_detail.dart b/lib/screens/person/guest_star_detail.dart index cc22631..937a559 100644 --- a/lib/screens/person/guest_star_detail.dart +++ b/lib/screens/person/guest_star_detail.dart @@ -56,11 +56,11 @@ class GuestStarDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -72,7 +72,7 @@ class GuestStarDetailPageState extends State child: Text( widget.cast!.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 210, diff --git a/lib/screens/person/searchedperson.dart b/lib/screens/person/searchedperson.dart index 5f58a2e..e24c16d 100644 --- a/lib/screens/person/searchedperson.dart +++ b/lib/screens/person/searchedperson.dart @@ -59,11 +59,11 @@ class SearchedPersonDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -75,7 +75,7 @@ class SearchedPersonDetailPageState extends State child: Text( widget.person!.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 210, diff --git a/lib/screens/tv/bookmark_tv_tab.dart b/lib/screens/tv/bookmark_tv_tab.dart index d21f0dd..c33f058 100644 --- a/lib/screens/tv/bookmark_tv_tab.dart +++ b/lib/screens/tv/bookmark_tv_tab.dart @@ -43,7 +43,7 @@ class _TVBookmarkState extends State { : widget.tvList!.isEmpty ? Center( child: Text( - tr("no_tv_bookmarked"), + tr('no_tv_bookmarked'), textAlign: TextAlign.center, style: kTextSmallHeaderStyle, maxLines: 4, @@ -126,7 +126,11 @@ class _TVBookmarkState extends State { const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.tvList![index].posterPath!, imageBuilder: @@ -158,7 +162,8 @@ class _TVBookmarkState extends State { Container( margin: const EdgeInsets - .all(3), + .all( + 3), alignment: Alignment .topLeft, @@ -168,9 +173,9 @@ class _TVBookmarkState extends State { borderRadius: BorderRadius.circular( 8), - color: themeMode == "dark" || + color: themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors .black45 : Colors @@ -278,7 +283,7 @@ class _TVBookmarkState extends State { Padding( padding: const EdgeInsets - .only( + .only( right: 10.0), child: SizedBox( @@ -387,7 +392,7 @@ class _TVBookmarkState extends State { ), Divider( color: themeMode == - "light" + 'light' ? Colors.black54 : Colors.white54, thickness: 1, diff --git a/lib/screens/tv/discover_tv_result.dart b/lib/screens/tv/discover_tv_result.dart index f19f167..01528d3 100644 --- a/lib/screens/tv/discover_tv_result.dart +++ b/lib/screens/tv/discover_tv_result.dart @@ -26,8 +26,10 @@ class _DiscoverTVResultState extends State { bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -35,7 +37,8 @@ class _DiscoverTVResultState extends State { isLoading = true; }); - fetchTV('${widget.api}&page=$pageNum', isProxyEnabled, proxyUrl).then((value) { + fetchTV('${widget.api}&page=$pageNum', isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList!.addAll(value); @@ -51,9 +54,12 @@ class _DiscoverTVResultState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&page=${widget.page}}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&page=${widget.page}}', isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -71,7 +77,7 @@ class _DiscoverTVResultState extends State { return Scaffold( appBar: AppBar( title: Text( - tr("discover_tv_series"), + tr('discover_tv_series'), ), leading: IconButton( icon: const Icon( @@ -96,7 +102,7 @@ class _DiscoverTVResultState extends State { padding: const EdgeInsets.all(8), child: Center( child: Text( - tr("parameter_tv_404"), + tr('parameter_tv_404'), style: kTextHeaderStyle, textAlign: TextAlign.center, ), diff --git a/lib/screens/tv/discover_tv_tab.dart b/lib/screens/tv/discover_tv_tab.dart index b12a37c..8c59f96 100644 --- a/lib/screens/tv/discover_tv_tab.dart +++ b/lib/screens/tv/discover_tv_tab.dart @@ -149,7 +149,7 @@ class _DiscoverTVTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("sort_by"), + tr('sort_by'), style: kTextHeaderStyle, ), ), @@ -177,7 +177,7 @@ class _DiscoverTVTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("tv_series_status"), + tr('tv_series_status'), style: kTextHeaderStyle, ), ), @@ -232,7 +232,7 @@ class _DiscoverTVTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("total_ratings"), + tr('total_ratings'), style: kTextHeaderStyle, ), ), @@ -265,8 +265,8 @@ class _DiscoverTVTabState extends State { Padding( padding: const EdgeInsets.fromLTRB(30.0, 0.0, 30, 15), child: Text( - tr("ratings_count", namedArgs: { - "r": tvTotalRatingSlider.toInt().toString() + tr('ratings_count', namedArgs: { + 'r': tvTotalRatingSlider.toInt().toString() }), textAlign: TextAlign.center, style: const TextStyle(fontSize: 20), @@ -279,7 +279,7 @@ class _DiscoverTVTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("with_genres"), + tr('with_genres'), style: kTextHeaderStyle, ), ), @@ -320,7 +320,7 @@ class _DiscoverTVTabState extends State { const LeadingDot(), Expanded( child: Text( - tr("with_streaming_services"), + tr('with_streaming_services'), style: kTextHeaderStyle, ), ), @@ -362,7 +362,7 @@ class _DiscoverTVTabState extends State { padding: const EdgeInsets.all(8.0), child: ElevatedButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(double.infinity, 50)), ), onPressed: () { @@ -383,7 +383,7 @@ class _DiscoverTVTabState extends State { children: [ Padding( padding: const EdgeInsets.only(right: 8.0), - child: Text(tr("discover")), + child: Text(tr('discover')), ), const Icon(FontAwesomeIcons.wandMagicSparkles) ], diff --git a/lib/screens/tv/episode_detail.dart b/lib/screens/tv/episode_detail.dart index 36072c1..768a224 100644 --- a/lib/screens/tv/episode_detail.dart +++ b/lib/screens/tv/episode_detail.dart @@ -67,10 +67,10 @@ class EpisodeDetailPageState extends State pinned: true, elevation: 1, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, leading: SABTN( @@ -82,7 +82,7 @@ class EpisodeDetailPageState extends State child: Text( widget.episodeList.name!, style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 375, @@ -113,13 +113,13 @@ class EpisodeDetailPageState extends State ), floatingActionButton: FloatingActionButton( onPressed: () async { - await Share.share(tr("share_episode", namedArgs: { - "title": widget.seriesName!, - "rating": widget.episodeList.voteAverage!.toStringAsFixed(1), - "id": widget.tvId!.toString(), - "et": widget.episodeList.name ?? "N/A", - "season": widget.episodeList.seasonNumber.toString(), - "episode": widget.episodeList.episodeNumber.toString() + await Share.share(tr('share_episode', namedArgs: { + 'title': widget.seriesName!, + 'rating': widget.episodeList.voteAverage!.toStringAsFixed(1), + 'id': widget.tvId!.toString(), + 'et': widget.episodeList.name ?? 'N/A', + 'season': widget.episodeList.seasonNumber.toString(), + 'episode': widget.episodeList.episodeNumber.toString() })); }, child: const Icon(FontAwesomeIcons.shareNodes)), diff --git a/lib/screens/tv/genre_tv.dart b/lib/screens/tv/genre_tv.dart index 257f031..84bb80e 100644 --- a/lib/screens/tv/genre_tv.dart +++ b/lib/screens/tv/genre_tv.dart @@ -20,8 +20,8 @@ class TVGenre extends StatelessWidget { return Scaffold( appBar: AppBar( title: Text(tr( - "genre_tv_title", - namedArgs: {"g": genres.genreName ?? "Null"}, + 'genre_tv_title', + namedArgs: {'g': genres.genreName ?? 'Null'}, )), leading: IconButton( icon: const Icon( diff --git a/lib/screens/tv/main_tv_list.dart b/lib/screens/tv/main_tv_list.dart index 6048a35..4d4cada 100644 --- a/lib/screens/tv/main_tv_list.dart +++ b/lib/screens/tv/main_tv_list.dart @@ -34,8 +34,10 @@ class MainTVListState extends State { bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -43,7 +45,8 @@ class MainTVListState extends State { isLoading = true; }); - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -60,9 +63,13 @@ class MainTVListState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -79,7 +86,7 @@ class MainTVListState extends State { final viewType = Provider.of(context).defaultView; return Scaffold( appBar: AppBar( - title: Text(tr("genre_tv_title", namedArgs: {"g": widget.title})), + title: Text(tr('genre_tv_title', namedArgs: {'g': widget.title})), ), body: tvList == null && viewType == 'grid' ? moviesAndTVShowGridShimmer(themeMode) @@ -90,7 +97,7 @@ class MainTVListState extends State { scrollController: _scrollController) : tvList!.isEmpty ? Center( - child: Text(tr("tv_404")), + child: Text(tr('tv_404')), ) : Column( children: [ diff --git a/lib/screens/tv/seasons_detail.dart b/lib/screens/tv/seasons_detail.dart index b52cc42..b0fd897 100644 --- a/lib/screens/tv/seasons_detail.dart +++ b/lib/screens/tv/seasons_detail.dart @@ -68,11 +68,11 @@ class SeasonsDetailState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -82,11 +82,11 @@ class SeasonsDetailState extends State ), title: SABT( child: Text( - widget.seasons.airDate == null || widget.seasons.airDate == "" + widget.seasons.airDate == null || widget.seasons.airDate == '' ? widget.seasons.name! : '${widget.seasons.name!} (${DateTime.parse(widget.seasons.airDate!).year})', style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 315, @@ -215,7 +215,7 @@ class TVSeasonDetailQuickInfo extends StatelessWidget { ? Alignment.topLeft : Alignment.topRight, child: TopButton( - buttonText: tr("open_show"), + buttonText: tr('open_show'), ), ), ), @@ -264,7 +264,11 @@ class TVSeasonDetailQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + season.posterPath!, ), @@ -289,7 +293,7 @@ class TVSeasonDetailQuickInfo extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - season.airDate == null || season.airDate == "" + season.airDate == null || season.airDate == '' ? season.name! : '${season.name!} (${DateTime.parse(season.airDate!).year})', style: kTextSmallHeaderStyle, @@ -304,8 +308,8 @@ class TVSeasonDetailQuickInfo extends StatelessWidget { tvSeries.originalTitle!, style: TextStyle( fontSize: 15, - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white54 : Colors.black54), ), @@ -367,7 +371,7 @@ class _TVSeasonAboutState extends State { const LeadingDot(), Expanded( child: Text( - tr("overview"), + tr('overview'), style: kTextHeaderStyle, ), ), @@ -381,14 +385,14 @@ class _TVSeasonAboutState extends State { padding: const EdgeInsets.all(8.0), child: ReadMoreText( widget.season.overview!.isEmpty - ? tr("no_season_overview") + ? tr('no_season_overview') : widget.season.overview!, trimLines: 4, style: const TextStyle(fontFamily: 'Poppins'), colorClickableText: Theme.of(context).colorScheme.primary, trimMode: TrimMode.Line, - trimCollapsedText: tr("read_more"), - trimExpandedText: tr("read_less"), + trimCollapsedText: tr('read_more'), + trimExpandedText: tr('read_less'), lessStyle: TextStyle( fontSize: 14, color: Theme.of(context).colorScheme.primary, @@ -406,14 +410,14 @@ class _TVSeasonAboutState extends State { const EdgeInsets.only(left: 8.0, bottom: 4.0, right: 8.0), child: Text( widget.season.airDate == null - ? tr("no_first_episode_air_date") - : tr("first_episode_air_date", namedArgs: { - "day": DateTime.parse(widget.season.airDate!) + ? tr('no_first_episode_air_date') + : tr('first_episode_air_date', namedArgs: { + 'day': DateTime.parse(widget.season.airDate!) .day .toString(), - "date": DateFormat("MMMM") + 'date': DateFormat('MMMM') .format(DateTime.parse(widget.season.airDate!)), - "year": DateTime.parse(widget.season.airDate!) + 'year': DateTime.parse(widget.season.airDate!) .year .toString() }), @@ -440,7 +444,7 @@ class _TVSeasonAboutState extends State { posterPath: widget.season.posterPath, ), TVSeasonImagesDisplay( - title: tr("images"), + title: tr('images'), name: '${widget.seriesName}_season_${widget.season.seasonNumber}', api: Endpoints.getTVSeasonImagesUrl( widget.tvDetails.id!, widget.season.seasonNumber!), diff --git a/lib/screens/tv/streaming_services_tvshows.dart b/lib/screens/tv/streaming_services_tvshows.dart index d0f77f6..d1e7cda 100644 --- a/lib/screens/tv/streaming_services_tvshows.dart +++ b/lib/screens/tv/streaming_services_tvshows.dart @@ -21,7 +21,7 @@ class StreamingServicesTVShows extends StatelessWidget { return Scaffold( appBar: AppBar( title: Text( - tr("streaming_service_tv", namedArgs: {"provider": providerName})), + tr('streaming_service_tv', namedArgs: {'provider': providerName})), leading: IconButton( icon: const Icon( Icons.arrow_back, diff --git a/lib/screens/tv/tv_detail.dart b/lib/screens/tv/tv_detail.dart index 8f8a223..ea0575f 100644 --- a/lib/screens/tv/tv_detail.dart +++ b/lib/screens/tv/tv_detail.dart @@ -60,11 +60,11 @@ class TVDetailPageState extends State SliverAppBar( pinned: true, elevation: 1, - shadowColor: themeMode == "dark" || themeMode == "amoled" + shadowColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, forceElevated: true, - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, leading: SABTN( @@ -74,11 +74,11 @@ class TVDetailPageState extends State ), title: SABT( child: Text( - widget.tvSeries.firstAirDate == "" + widget.tvSeries.firstAirDate == '' ? widget.tvSeries.name! : '${widget.tvSeries.name!} (${DateTime.parse(widget.tvSeries.firstAirDate!).year})', style: TextStyle( - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), )), expandedHeight: 390, @@ -103,10 +103,10 @@ class TVDetailPageState extends State ), floatingActionButton: FloatingActionButton( onPressed: () async { - await Share.share(tr("share_tv", namedArgs: { - "title": widget.tvSeries.name!, - "rating": widget.tvSeries.voteAverage!.toStringAsFixed(1), - "id": widget.tvSeries.id.toString() + await Share.share(tr('share_tv', namedArgs: { + 'title': widget.tvSeries.name!, + 'rating': widget.tvSeries.voteAverage!.toStringAsFixed(1), + 'id': widget.tvSeries.id.toString() })); }, child: const Icon(FontAwesomeIcons.shareNodes)), diff --git a/lib/screens/tv/tv_stream_select.dart b/lib/screens/tv/tv_stream_select.dart index 1d3a51e..1ecf492 100644 --- a/lib/screens/tv/tv_stream_select.dart +++ b/lib/screens/tv/tv_stream_select.dart @@ -192,7 +192,7 @@ class StreamListWidget extends StatelessWidget { ], ), Divider( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white54 : Colors.black54, ) diff --git a/lib/screens/tv/tv_video_loader.dart b/lib/screens/tv/tv_video_loader.dart index d049ec9..a28e069 100644 --- a/lib/screens/tv/tv_video_loader.dart +++ b/lib/screens/tv/tv_video_loader.dart @@ -78,7 +78,7 @@ class _TVVideoLoaderState extends State { Map videos = {}; List subs = []; - late String currentProvider = ""; + late String currentProvider = ''; @override void initState() { @@ -113,7 +113,7 @@ class _TVVideoLoaderState extends State { if (widget.metadata.airDate != null && !isReleased(widget.metadata.airDate!)) { GlobalMethods.showScaffoldMessage( - tr("episode_may_not_be_available"), context); + tr('episode_may_not_be_available'), context); } for (int i = 0; i < videoProviders.length; i++) { setState(() { @@ -175,7 +175,7 @@ class _TVVideoLoaderState extends State { showModalBottomSheet( builder: (context) { return ReportErrorWidget( - error: tr("tv_vid_404"), + error: tr('tv_vid_404'), hideButton: false, ); }, @@ -204,7 +204,7 @@ class _TVVideoLoaderState extends State { subs: subs, colors: [ Theme.of(context).primaryColor, - Theme.of(context).colorScheme.background + Theme.of(context).colorScheme.surface ], settings: settings, tvMetadata: widget.metadata, @@ -224,7 +224,7 @@ class _TVVideoLoaderState extends State { showModalBottomSheet( builder: (context) { return ReportErrorWidget( - error: tr("tv_vid_404"), + error: tr('tv_vid_404'), hideButton: false, ); }, @@ -257,7 +257,7 @@ class _TVVideoLoaderState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), height: 150, width: 190, @@ -282,14 +282,14 @@ class _TVVideoLoaderState extends State { style: const TextStyle(fontSize: 15), children: [ TextSpan( - text: tr("fetching"), + text: tr('fetching'), style: TextStyle( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, fontFamily: 'Poppins')), TextSpan( text: currentProvider, style: TextStyle( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, fontFamily: 'PoppinsBold', )) ])), @@ -298,8 +298,8 @@ class _TVVideoLoaderState extends State { settings.defaultSubtitleLanguage != '' ? false : true, child: Text( 'Subtitle load progress: ${loadProgress.toStringAsFixed(0).toString()}%', - style: TextStyle( - color: Theme.of(context).colorScheme.background), + style: + TextStyle(color: Theme.of(context).colorScheme.surface), ), ), ], @@ -409,7 +409,7 @@ class _TVVideoLoaderState extends State { Provider.of(context, listen: false) .tmdbProxy; await fetchTVDetails( - Endpoints.tvDetailsUrl(widget.metadata.tvId!, "en"), + Endpoints.tvDetailsUrl(widget.metadata.tvId!, 'en'), isProxyEnabled, proxyUrl) .then( @@ -549,7 +549,7 @@ class _TVVideoLoaderState extends State { try { if (mounted) { await getTVStreamEpisodesTMDB(Endpoints.getMovieTVStreamInfoTMDB( - widget.metadata.tvId!.toString(), "tv", appDep.consumetUrl)) + widget.metadata.tvId!.toString(), 'tv', appDep.consumetUrl)) .then((value) async { setState(() { tvInfoTMDB = value; @@ -690,7 +690,7 @@ class _TVVideoLoaderState extends State { } else { if (appDep.useExternalSubtitles) { await fetchSocialLinks( - Endpoints.getExternalLinksForTV(widget.metadata.tvId!, "en"), + Endpoints.getExternalLinksForTV(widget.metadata.tvId!, 'en'), isProxyEnabled, proxyUrl, ).then((value) async { @@ -738,7 +738,7 @@ class _TVVideoLoaderState extends State { for (int k = 0; k < vids.length; k++) { if (vids[k].quality! == 'unknown quality') { videos.addAll({ - "${vids[k].quality!} $k": vids[k].url!, + '${vids[k].quality!} $k': vids[k].url!, }); } else { videos.addAll({ diff --git a/lib/screens/tv/tvdetail_castandcrew.dart b/lib/screens/tv/tvdetail_castandcrew.dart index 361e387..85c2ccf 100644 --- a/lib/screens/tv/tvdetail_castandcrew.dart +++ b/lib/screens/tv/tvdetail_castandcrew.dart @@ -40,7 +40,7 @@ class _TVDetailCastAndCrewState extends State appBar: AppBar( elevation: 3, title: Text( - tr("cast_and_crew"), + tr('cast_and_crew'), ), leading: IconButton( icon: const Icon( @@ -59,14 +59,14 @@ class _TVDetailCastAndCrewState extends State tabs: [ Tab( child: Text( - tr("cast"), + tr('cast'), )), Tab( child: Text( - tr("crew"), + tr('crew'), )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/tv/tvepisode_castandcrew.dart b/lib/screens/tv/tvepisode_castandcrew.dart index f7222a3..4051b0f 100644 --- a/lib/screens/tv/tvepisode_castandcrew.dart +++ b/lib/screens/tv/tvepisode_castandcrew.dart @@ -43,7 +43,7 @@ class _TVEpisodeCastAndCrewState extends State child: Scaffold( appBar: AppBar( elevation: 3, - title: Text(tr("cast_and_crew")), + title: Text(tr('cast_and_crew')), leading: IconButton( icon: const Icon( Icons.arrow_back, @@ -64,15 +64,15 @@ class _TVEpisodeCastAndCrewState extends State tabs: [ Tab( child: Text( - tr("cast"), + tr('cast'), )), - Tab(child: Text(tr("guest_stars"))), + Tab(child: Text(tr('guest_stars'))), Tab( child: Text( - tr("crew"), + tr('crew'), )), ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/tv/tvseason_castandcrew.dart b/lib/screens/tv/tvseason_castandcrew.dart index fb975d8..e970ed8 100644 --- a/lib/screens/tv/tvseason_castandcrew.dart +++ b/lib/screens/tv/tvseason_castandcrew.dart @@ -44,7 +44,7 @@ class _TVSeasonCastAndCrewState extends State appBar: AppBar( elevation: 3, title: Text( - tr("cast_and_crew"), + tr('cast_and_crew'), ), leading: IconButton( icon: const Icon( @@ -63,14 +63,14 @@ class _TVSeasonCastAndCrewState extends State tabs: [ Tab( child: Text( - tr("cast"), + tr('cast'), )), Tab( child: Text( - tr("crew"), + tr('crew'), )) ], - indicatorColor: themeMode == "dark" || themeMode == "amoled" + indicatorColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black, indicatorWeight: 3, diff --git a/lib/screens/user/delete_account.dart b/lib/screens/user/delete_account.dart index 2a32a92..a6ae302 100644 --- a/lib/screens/user/delete_account.dart +++ b/lib/screens/user/delete_account.dart @@ -75,21 +75,29 @@ class DeleteAccountScreenState extends State { .delete() .then((value) async { await user!.delete().then((value) async { - await Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) { - return const LandingScreen(); - })).then((value) { - GlobalMethods.showCustomScaffoldMessage( - SnackBar( - content: Text( - tr("account_deleted_successfully"), - maxLines: 3, - style: kTextSmallBodyStyle, + if (!context.mounted) { + return; + } + if (mounted) { + await Navigator.pushReplacement(context, + MaterialPageRoute(builder: (context) { + return const LandingScreen(); + })).then((value) { + if (!context.mounted) { + return; + } + GlobalMethods.showCustomScaffoldMessage( + SnackBar( + content: Text( + tr('account_deleted_successfully'), + maxLines: 3, + style: kTextSmallBodyStyle, + ), + duration: const Duration(seconds: 4), ), - duration: const Duration(seconds: 4), - ), - context); - }); + context.mounted ? context : null); + }); + } }); }); }); @@ -98,20 +106,20 @@ class DeleteAccountScreenState extends State { } on FirebaseAuthException catch (e) { if (mounted) { if (e.code == 'user-mismatch') { - _globalMethods.authErrorHandle(tr("user_mismatch"), context); + _globalMethods.authErrorHandle(tr('user_mismatch'), context); } else if (e.code == 'user-not-found') { - _globalMethods.authErrorHandle(tr("user_not_found"), context); + _globalMethods.authErrorHandle(tr('user_not_found'), context); } else if (e.code == 'invalid-credential') { - _globalMethods.authErrorHandle(tr("invalid_credential"), context); + _globalMethods.authErrorHandle(tr('invalid_credential'), context); } else if (e.code == 'invalid-email') { - _globalMethods.authErrorHandle(tr("invalid_email"), context); + _globalMethods.authErrorHandle(tr('invalid_email'), context); } else if (e.code == 'wrong-password:') { - _globalMethods.authErrorHandle(tr("wrong_password"), context); + _globalMethods.authErrorHandle(tr('wrong_password'), context); } else if (e.code == 'weak-password') { - _globalMethods.authErrorHandle(tr("weak_password"), context); + _globalMethods.authErrorHandle(tr('weak_password'), context); } else if (e.code == 'requires-recent-login') { _globalMethods.authErrorHandle( - tr("requires_recent_login"), context); + tr('requires_recent_login'), context); } } // print('error occured ${error.message}'); @@ -129,7 +137,7 @@ class DeleteAccountScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text(tr("delete_account"))), + appBar: AppBar(title: Text(tr('delete_account'))), body: userDoc == null ? const Center( child: CircularProgressIndicator(), @@ -147,13 +155,13 @@ class DeleteAccountScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("delete_account"), + tr('delete_account'), style: const TextStyle( fontSize: 30, fontWeight: FontWeight.bold), ), ), Text( - tr("delete_notice"), + tr('delete_notice'), textAlign: TextAlign.center, ), Padding( @@ -168,7 +176,7 @@ class DeleteAccountScreenState extends State { key: const ValueKey('confirmation'), validator: (value) { if (value != 'CONFIRM') { - return tr("del_input_err"); + return tr('del_input_err'); } return null; }, @@ -181,10 +189,9 @@ class DeleteAccountScreenState extends State { filled: true, prefixIcon: const Icon(Icons.text_fields_rounded), - labelText: tr("type_confirm"), - fillColor: Theme.of(context) - .colorScheme - .background), + labelText: tr('type_confirm'), + fillColor: + Theme.of(context).colorScheme.surface), onSaved: (value) { setState(() { confirmationText = value!; @@ -208,12 +215,12 @@ class DeleteAccountScreenState extends State { : ElevatedButton( style: ButtonStyle( backgroundColor: - const MaterialStatePropertyAll( + const WidgetStatePropertyAll( Colors.red), minimumSize: - const MaterialStatePropertyAll( + const WidgetStatePropertyAll( Size(200, 50)), - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), @@ -227,7 +234,7 @@ class DeleteAccountScreenState extends State { MainAxisAlignment.center, children: [ Text( - tr("delete_account"), + tr('delete_account'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), diff --git a/lib/screens/user/edit_profile.dart b/lib/screens/user/edit_profile.dart index 95a1bd5..31fd512 100644 --- a/lib/screens/user/edit_profile.dart +++ b/lib/screens/user/edit_profile.dart @@ -107,7 +107,9 @@ class _ProfileEditState extends State { 'username': username!.trim().toLowerCase(), 'verified': isVerified }).then((value) { - Navigator.pop(context); + if (mounted) { + Navigator.pop(context); + } }); } else if (username != _userName) { if (await checkIfDocExists(_userName) == true) { @@ -115,7 +117,7 @@ class _ProfileEditState extends State { GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("username_exists"), + tr('username_exists'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -152,7 +154,9 @@ class _ProfileEditState extends State { 'username': _userName.trim().toLowerCase(), 'verified': isVerified }).then((value) { - Navigator.pop(context); + if (mounted) { + Navigator.pop(context); + } }); } } catch (e) { @@ -179,7 +183,7 @@ class _ProfileEditState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("edit_profile")), + title: Text(tr('edit_profile')), ), body: Container( padding: const EdgeInsets.all(8), @@ -196,7 +200,7 @@ class _ProfileEditState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - tr("profile_picture"), + tr('profile_picture'), style: const TextStyle( fontFamily: 'PoppinsSB', fontSize: 20, @@ -254,10 +258,10 @@ class _ProfileEditState extends State { key: const ValueKey('name'), validator: (value) { if (value!.isEmpty) { - return tr("name_empty"); + return tr('name_empty'); } else if (value.length > 40 || value.length < 2) { - return tr("name_short_long"); + return tr('name_short_long'); } return null; }, @@ -270,9 +274,9 @@ class _ProfileEditState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.user), - labelText: tr("full_name"), + labelText: tr('full_name'), fillColor: - Theme.of(context).colorScheme.background, + Theme.of(context).colorScheme.surface, ), onSaved: (value) { _fullName = value!; @@ -293,13 +297,13 @@ class _ProfileEditState extends State { key: const ValueKey('username'), validator: (value) { if (value!.isEmpty) { - return tr("username_empty"); + return tr('username_empty'); } else if (value.length < 5 || value.length > 30) { - return tr("username_short_long"); + return tr('username_short_long'); } else if (!value .contains(RegExp('^[a-zA-Z0-9_]*'))) { - return tr("invalid_username"); + return tr('invalid_username'); } return null; }, @@ -310,9 +314,9 @@ class _ProfileEditState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.at), - labelText: tr("username"), + labelText: tr('username'), fillColor: - Theme.of(context).colorScheme.background), + Theme.of(context).colorScheme.surface), onSaved: (value) { _userName = value!; }, @@ -328,11 +332,11 @@ class _ProfileEditState extends State { : ElevatedButton( style: const ButtonStyle( minimumSize: - MaterialStatePropertyAll(Size(250, 45))), + WidgetStatePropertyAll(Size(250, 45))), onPressed: () { updateProfile(); }, - child: Text(tr("confirm"))), + child: Text(tr('confirm'))), const SizedBox( height: 40, ), @@ -349,14 +353,14 @@ class _ProfileEditState extends State { }))); }, style: ButtonStyle( - maximumSize: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all( const Size(200, 60)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ))), - child: Text(tr("change_password")), + child: Text(tr('change_password')), ), TextButton( onPressed: () { @@ -366,14 +370,14 @@ class _ProfileEditState extends State { }))); }, style: ButtonStyle( - maximumSize: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all( const Size(200, 60)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ))), - child: Text(tr("change_email")), + child: Text(tr('change_email')), ), TextButton( onPressed: () { @@ -383,17 +387,17 @@ class _ProfileEditState extends State { }))); }, style: ButtonStyle( - maximumSize: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all( const Size(200, 60)), backgroundColor: - const MaterialStatePropertyAll(Colors.red), - shape: MaterialStateProperty.all< + const WidgetStatePropertyAll(Colors.red), + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ))), child: Text( - tr("delete_account"), + tr('delete_account'), style: const TextStyle(color: Colors.white), ), ), diff --git a/lib/screens/user/email_change.dart b/lib/screens/user/email_change.dart index 32c8bf7..821845f 100644 --- a/lib/screens/user/email_change.dart +++ b/lib/screens/user/email_change.dart @@ -89,35 +89,38 @@ class EmailChangeScreenState extends State { 'username': username!.trim().toLowerCase(), 'verified': isVerified }).then((value) { + if (!context.mounted) { + return; + } GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("email_successful"), + tr('email_successful'), maxLines: 3, style: kTextSmallBodyStyle, ), duration: const Duration(seconds: 4), ), - context); + context.mounted ? context : null); }); }); } on FirebaseAuthException catch (e) { if (mounted) { if (e.code == 'user-mismatch') { - _globalMethods.authErrorHandle(tr("user_mismatch"), context); + _globalMethods.authErrorHandle(tr('user_mismatch'), context); } else if (e.code == 'user-not-found') { - _globalMethods.authErrorHandle(tr("user_not_found"), context); + _globalMethods.authErrorHandle(tr('user_not_found'), context); } else if (e.code == 'invalid-credential') { - _globalMethods.authErrorHandle(tr("invalid_credential"), context); + _globalMethods.authErrorHandle(tr('invalid_credential'), context); } else if (e.code == 'invalid-email') { - _globalMethods.authErrorHandle(tr("invalid_email"), context); + _globalMethods.authErrorHandle(tr('invalid_email'), context); } else if (e.code == 'wrong-password:') { - _globalMethods.authErrorHandle(tr("wrong_password"), context); + _globalMethods.authErrorHandle(tr('wrong_password'), context); } else if (e.code == 'weak-password') { - _globalMethods.authErrorHandle(tr("weak_password"), context); + _globalMethods.authErrorHandle(tr('weak_password'), context); } else if (e.code == 'requires-recent-login') { _globalMethods.authErrorHandle( - tr("requires_recent_login"), context); + tr('requires_recent_login'), context); } } // print('error occured ${error.message}'); @@ -136,7 +139,7 @@ class EmailChangeScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text(tr("change_email"))), + appBar: AppBar(title: Text(tr('change_email'))), body: userDoc == null ? const Center( child: CircularProgressIndicator(), @@ -154,7 +157,7 @@ class EmailChangeScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("change_email"), + tr('change_email'), style: const TextStyle( fontSize: 30, fontWeight: FontWeight.bold), ), @@ -162,7 +165,7 @@ class EmailChangeScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("process_stuck"), + tr('process_stuck'), textAlign: TextAlign.center, ), ), @@ -179,7 +182,7 @@ class EmailChangeScreenState extends State { focusNode: _newEmailFocusNode, validator: (value) { if (value!.isEmpty || !value.contains('@')) { - return tr("invalid_email"); + return tr('invalid_email'); } return null; }, @@ -193,10 +196,9 @@ class EmailChangeScreenState extends State { filled: true, prefixIcon: const Icon(FontAwesomeIcons.envelope), - labelText: tr("new_email_address"), - fillColor: Theme.of(context) - .colorScheme - .background), + labelText: tr('new_email_address'), + fillColor: + Theme.of(context).colorScheme.surface), onSaved: (value) { newEmail = value!; }, @@ -211,7 +213,7 @@ class EmailChangeScreenState extends State { key: const ValueKey('verifyEmail'), validator: (value) { if (value != newEmail) { - return tr("email_mismatch"); + return tr('email_mismatch'); } return null; }, @@ -223,10 +225,9 @@ class EmailChangeScreenState extends State { filled: true, prefixIcon: const Icon(FontAwesomeIcons.envelope), - labelText: tr("repeat_new_email"), - fillColor: Theme.of(context) - .colorScheme - .background), + labelText: tr('repeat_new_email'), + fillColor: + Theme.of(context).colorScheme.surface), ), ), ], @@ -242,9 +243,9 @@ class EmailChangeScreenState extends State { ? const CircularProgressIndicator() : ElevatedButton( style: ButtonStyle( - minimumSize: const MaterialStatePropertyAll( + minimumSize: const WidgetStatePropertyAll( Size(200, 50)), - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), @@ -256,7 +257,7 @@ class EmailChangeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("change_email"), + tr('change_email'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), diff --git a/lib/screens/user/forgot_password.dart b/lib/screens/user/forgot_password.dart index cd30e7a..49d90ec 100644 --- a/lib/screens/user/forgot_password.dart +++ b/lib/screens/user/forgot_password.dart @@ -28,12 +28,15 @@ class ForgotPasswordScreenState extends State { try { await _auth .sendPasswordResetEmail(email: _emailAddress.trim().toLowerCase()) - .then((value) => - _globalMethods.checkMessage(tr("reset_sent"), context)); + .then((value) { + if (mounted) { + _globalMethods.checkMessage(tr('reset_sent'), context); + } + }); } on FirebaseAuthException catch (e) { if (mounted) { if (e.code == 'user-not-found') { - _globalMethods.authErrorHandle(tr("no_account"), context); + _globalMethods.authErrorHandle(tr('no_account'), context); } else { _globalMethods.authErrorHandle(e.toString(), context); } @@ -50,7 +53,7 @@ class ForgotPasswordScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text(tr("reset_password"))), + appBar: AppBar(title: Text(tr('reset_password'))), body: Center( child: Column( mainAxisSize: MainAxisSize.min, @@ -63,7 +66,7 @@ class ForgotPasswordScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("forgot_password"), + tr('forgot_password'), style: const TextStyle(fontSize: 30, fontWeight: FontWeight.bold), ), @@ -76,7 +79,7 @@ class ForgotPasswordScreenState extends State { key: const ValueKey('email'), validator: (value) { if (value!.isEmpty || !value.contains('@')) { - return tr("invalid_email"); + return tr('invalid_email'); } return null; }, @@ -86,8 +89,8 @@ class ForgotPasswordScreenState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.envelope), - labelText: tr("email_address"), - fillColor: Theme.of(context).colorScheme.background), + labelText: tr('email_address'), + fillColor: Theme.of(context).colorScheme.surface), onSaved: (value) { _emailAddress = value!; }, @@ -104,8 +107,8 @@ class ForgotPasswordScreenState extends State { : ElevatedButton( style: ButtonStyle( minimumSize: - const MaterialStatePropertyAll(Size(200, 50)), - shape: MaterialStateProperty.all( + const WidgetStatePropertyAll(Size(200, 50)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), @@ -115,7 +118,7 @@ class ForgotPasswordScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("reset_password"), + tr('reset_password'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), ), diff --git a/lib/screens/user/login_screen.dart b/lib/screens/user/login_screen.dart index a7d0068..72572b9 100644 --- a/lib/screens/user/login_screen.dart +++ b/lib/screens/user/login_screen.dart @@ -48,7 +48,9 @@ class _LoginScreenState extends State { .signInWithEmailAndPassword( email: emailAddress.toLowerCase().trim(), password: password.trim()) - .then((value) => Navigator.canPop(context) + .then((value) { + if (mounted) { + Navigator.canPop(context) ? Navigator.pushReplacement(context, MaterialPageRoute(builder: ((context) { final mixpanel = @@ -58,18 +60,20 @@ class _LoginScreenState extends State { ); return const FlixQuestHomePage(); }))) - : null); + : null; + } + }); } on FirebaseAuthException catch (error) { if (mounted) { if (error.code == 'wrong-password') { globalMethods.authErrorHandle( - tr("invalid_credential"), context); + tr('invalid_credential'), context); } else if (error.code == 'invalid-email') { - globalMethods.authErrorHandle(tr("invalid_email"), context); + globalMethods.authErrorHandle(tr('invalid_email'), context); } else if (error.code == 'user-disabled') { - globalMethods.authErrorHandle(tr("banned_user"), context); + globalMethods.authErrorHandle(tr('banned_user'), context); } else if (error.code == 'user-not-found') { - globalMethods.authErrorHandle(tr("user_not_found"), context); + globalMethods.authErrorHandle(tr('user_not_found'), context); } } // print('error occured $error}'); @@ -85,13 +89,13 @@ class _LoginScreenState extends State { GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), duration: const Duration(seconds: 3), ), - context); + context.mounted ? context : null); } }); } @@ -99,7 +103,7 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text(tr("login"))), + appBar: AppBar(title: Text(tr('login'))), body: Container( padding: const EdgeInsets.all(8), child: Center( @@ -127,7 +131,7 @@ class _LoginScreenState extends State { validator: (value) { if (value!.isEmpty || !value.contains('@')) { - return tr("invalid_email"); + return tr('invalid_email'); } return null; }, @@ -141,10 +145,10 @@ class _LoginScreenState extends State { filled: true, prefixIcon: const Icon(FontAwesomeIcons.envelope), - labelText: tr("email_address"), + labelText: tr('email_address'), fillColor: Theme.of(context) .colorScheme - .background), + .surface), onSaved: (value) { emailAddress = value!; }, @@ -156,7 +160,7 @@ class _LoginScreenState extends State { key: const ValueKey('Password'), validator: (value) { if (value!.isEmpty || value.length < 7) { - return tr("weak_password"); + return tr('weak_password'); } return null; }, @@ -177,10 +181,10 @@ class _LoginScreenState extends State { ? Icons.visibility : Icons.visibility_off), ), - labelText: tr("password"), + labelText: tr('password'), fillColor: Theme.of(context) .colorScheme - .background), + .surface), onSaved: (value) { password = value!; }, @@ -195,9 +199,9 @@ class _LoginScreenState extends State { : ElevatedButton( style: ButtonStyle( minimumSize: - MaterialStateProperty.all( + WidgetStateProperty.all( const Size(150, 50)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: @@ -207,7 +211,7 @@ class _LoginScreenState extends State { )), onPressed: submitForm, child: Text( - tr("login"), + tr('login'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), @@ -219,7 +223,7 @@ class _LoginScreenState extends State { ), TextButton( style: const ButtonStyle( - backgroundColor: MaterialStatePropertyAll( + backgroundColor: WidgetStatePropertyAll( Colors.transparent)), onPressed: () { Navigator.push(context, @@ -228,7 +232,7 @@ class _LoginScreenState extends State { }))); }, child: Text( - tr("forgot_password"), + tr('forgot_password'), )), ], )), diff --git a/lib/screens/user/password_change.dart b/lib/screens/user/password_change.dart index 89d8813..90836e4 100644 --- a/lib/screens/user/password_change.dart +++ b/lib/screens/user/password_change.dart @@ -50,34 +50,37 @@ class PasswordChangeScreenState extends State { user = _auth.currentUser; await user!.updatePassword(newPassword).then((value) { + if (!context.mounted) { + return; + } GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("password_changed"), + tr('password_changed'), maxLines: 3, style: kTextSmallBodyStyle, ), duration: const Duration(seconds: 4), ), - context); + context.mounted ? context : null); }); } on FirebaseAuthException catch (e) { if (mounted) { if (e.code == 'user-mismatch') { - _globalMethods.authErrorHandle(tr("user_mismatch"), context); + _globalMethods.authErrorHandle(tr('user_mismatch'), context); } else if (e.code == 'user-not-found') { - _globalMethods.authErrorHandle(tr("user_not_found"), context); + _globalMethods.authErrorHandle(tr('user_not_found'), context); } else if (e.code == 'invalid-credential') { - _globalMethods.authErrorHandle(tr("invalid_credential"), context); + _globalMethods.authErrorHandle(tr('invalid_credential'), context); } else if (e.code == 'invalid-email') { - _globalMethods.authErrorHandle(tr("invalid_email"), context); + _globalMethods.authErrorHandle(tr('invalid_email'), context); } else if (e.code == 'wrong-password:') { - _globalMethods.authErrorHandle(tr("wrong_password"), context); + _globalMethods.authErrorHandle(tr('wrong_password'), context); } else if (e.code == 'weak-password') { - _globalMethods.authErrorHandle(tr("weak_password"), context); + _globalMethods.authErrorHandle(tr('weak_password'), context); } else if (e.code == 'requires-recent-login') { _globalMethods.authErrorHandle( - tr("requires_recent_login"), context); + tr('requires_recent_login'), context); } } // print('error occured ${error.message}'); @@ -114,7 +117,7 @@ class PasswordChangeScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("password_change"), + tr('password_change'), style: const TextStyle( fontSize: 30, fontWeight: FontWeight.bold), ), @@ -122,7 +125,7 @@ class PasswordChangeScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("process_stuck"), + tr('process_stuck'), textAlign: TextAlign.center, ), ), @@ -138,11 +141,11 @@ class PasswordChangeScreenState extends State { key: const ValueKey('newPassword'), validator: (value) { if (value!.isEmpty || value.length < 7) { - return tr("weak_password"); + return tr('weak_password'); } else if (value == '12345678' || value == 'qwertyuiop' || value == 'password') { - return tr("lame_password"); + return tr('lame_password'); } return null; }, @@ -168,10 +171,9 @@ class PasswordChangeScreenState extends State { ? Icons.visibility : Icons.visibility_off), ), - labelText: tr("enter_new_pass"), - fillColor: Theme.of(context) - .colorScheme - .background), + labelText: tr('enter_new_pass'), + fillColor: + Theme.of(context).colorScheme.surface), onChanged: (value) { setState(() { newPassword = value; @@ -188,7 +190,7 @@ class PasswordChangeScreenState extends State { key: const ValueKey('verifyPassword'), validator: (value) { if (value != newPassword) { - return tr("password_mismatch"); + return tr('password_mismatch'); } return null; }, @@ -212,10 +214,9 @@ class PasswordChangeScreenState extends State { ? Icons.visibility : Icons.visibility_off), ), - labelText: tr("repeat_new_password"), - fillColor: Theme.of(context) - .colorScheme - .background), + labelText: tr('repeat_new_password'), + fillColor: + Theme.of(context).colorScheme.surface), ), ), ], @@ -231,9 +232,9 @@ class PasswordChangeScreenState extends State { ? const CircularProgressIndicator() : ElevatedButton( style: ButtonStyle( - minimumSize: const MaterialStatePropertyAll( + minimumSize: const WidgetStatePropertyAll( Size(200, 50)), - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), @@ -245,7 +246,7 @@ class PasswordChangeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("reset_password"), + tr('reset_password'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), diff --git a/lib/screens/user/signup_screen.dart b/lib/screens/user/signup_screen.dart index a9b0a12..08054aa 100644 --- a/lib/screens/user/signup_screen.dart +++ b/lib/screens/user/signup_screen.dart @@ -52,8 +52,8 @@ class _SignupScreenState extends State { Future usernameExists(String username) async => (await FirebaseFirestore.instance - .collection("usernames") - .where("username", isEqualTo: username.trim().toLowerCase()) + .collection('usernames') + .where('username', isEqualTo: username.trim().toLowerCase()) .get()) .docs .isEmpty; @@ -87,7 +87,7 @@ class _SignupScreenState extends State { if (await checkIfDocExists(_userName) == true) { _globalMethods.authErrorHandle( - tr("username_exists").toString(), context); + tr('username_exists').toString(), context); return; } else { await _auth.createUserWithEmailAndPassword( @@ -158,14 +158,14 @@ class _SignupScreenState extends State { } } on FirebaseAuthException catch (error) { if (error.code == 'weak-password') { - _globalMethods.authErrorHandle(tr("weak_password"), context); + _globalMethods.authErrorHandle(tr('weak_password'), context); } else if (error.code == 'email-already-in-use') { - _globalMethods.authErrorHandle(tr("email_exists"), context); + _globalMethods.authErrorHandle(tr('email_exists'), context); } else if (error.code == 'invalid-email') { - _globalMethods.authErrorHandle(tr("invalid_email"), context); + _globalMethods.authErrorHandle(tr('invalid_email'), context); } else if (error.code == 'operation-not-allowed') { _globalMethods.authErrorHandle( - tr("operation_not_allowed"), context); + tr('operation_not_allowed'), context); } } catch (e) { _globalMethods.authErrorHandle(e.toString(), context); @@ -181,7 +181,7 @@ class _SignupScreenState extends State { GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -196,7 +196,7 @@ class _SignupScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(tr("signup")), + title: Text(tr('signup')), ), body: Container( padding: const EdgeInsets.all(8), @@ -227,7 +227,7 @@ class _SignupScreenState extends State { ), Expanded( child: Text( - tr("signup_to_sync"), + tr('signup_to_sync'), overflow: TextOverflow.ellipsis, maxLines: 4, style: kTextSmallHeaderStyle, @@ -245,7 +245,7 @@ class _SignupScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - tr("choose_profile"), + tr('choose_profile'), style: const TextStyle( fontFamily: 'PoppinsSB', fontSize: 20, @@ -305,9 +305,9 @@ class _SignupScreenState extends State { key: const ValueKey('name'), validator: (value) { if (value!.isEmpty) { - return tr("name_empty"); + return tr('name_empty'); } else if (value.length > 40 || value.length < 2) { - return tr("name_short_long"); + return tr('name_short_long'); } return null; }, @@ -320,8 +320,8 @@ class _SignupScreenState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.user), - labelText: tr("full_name"), - fillColor: Theme.of(context).colorScheme.background, + labelText: tr('full_name'), + fillColor: Theme.of(context).colorScheme.surface, ), onSaved: (value) { _fullName = value!; @@ -338,7 +338,7 @@ class _SignupScreenState extends State { focusNode: _emailFocusNode, validator: (value) { if (value!.isEmpty || !value.contains('@')) { - return tr("invalid_email"); + return tr('invalid_email'); } return null; }, @@ -351,9 +351,8 @@ class _SignupScreenState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.envelope), - labelText: tr("email_address"), - fillColor: - Theme.of(context).colorScheme.background), + labelText: tr('email_address'), + fillColor: Theme.of(context).colorScheme.surface), onSaved: (value) { _emailAddress = value!; }, @@ -372,12 +371,12 @@ class _SignupScreenState extends State { key: const ValueKey('username'), validator: (value) { if (value!.isEmpty) { - return tr("username_empty"); + return tr('username_empty'); } else if (value.length < 5 || value.length > 30) { - return tr("username_short_long"); + return tr('username_short_long'); } else if (!value .contains(RegExp('^[a-zA-Z0-9_]*'))) { - return tr("invalid_username"); + return tr('invalid_username'); } return null; }, @@ -391,9 +390,8 @@ class _SignupScreenState extends State { border: const UnderlineInputBorder(), filled: true, prefixIcon: const Icon(FontAwesomeIcons.at), - labelText: tr("username"), - fillColor: - Theme.of(context).colorScheme.background), + labelText: tr('username'), + fillColor: Theme.of(context).colorScheme.surface), onSaved: (value) { _userName = value!; }, @@ -408,11 +406,11 @@ class _SignupScreenState extends State { key: const ValueKey('Password'), validator: (value) { if (value!.isEmpty || value.length < 7) { - return tr("invalid_password"); + return tr('invalid_password'); } else if (value == '12345678' || value == 'qwertyuiop' || value == 'password') { - return tr("lame_password"); + return tr('lame_password'); } return null; }, @@ -436,9 +434,8 @@ class _SignupScreenState extends State { ? Icons.visibility : Icons.visibility_off), ), - labelText: tr("enter_password"), - fillColor: - Theme.of(context).colorScheme.background), + labelText: tr('enter_password'), + fillColor: Theme.of(context).colorScheme.surface), onSaved: (value) { _password = value!; }, @@ -453,7 +450,7 @@ class _SignupScreenState extends State { key: const ValueKey('VerifyPassword'), validator: (value) { if (value != _password) { - return tr("password_mismatch"); + return tr('password_mismatch'); } return null; }, @@ -475,9 +472,8 @@ class _SignupScreenState extends State { ? Icons.visibility : Icons.visibility_off), ), - labelText: tr("repeat_password"), - fillColor: - Theme.of(context).colorScheme.background), + labelText: tr('repeat_password'), + fillColor: Theme.of(context).colorScheme.surface), // onSaved: (value) { // _passwordVerify = value!; // } @@ -493,9 +489,9 @@ class _SignupScreenState extends State { ? const CircularProgressIndicator() : ElevatedButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all( + minimumSize: WidgetStateProperty.all( const Size(150, 50)), - shape: MaterialStateProperty.all< + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: @@ -504,7 +500,7 @@ class _SignupScreenState extends State { )), onPressed: submitForm, child: Text( - tr("sign_up"), + tr('sign_up'), style: const TextStyle( fontWeight: FontWeight.w500, fontSize: 17), diff --git a/lib/screens/user/user_info.dart b/lib/screens/user/user_info.dart index faf8273..6eda554 100644 --- a/lib/screens/user/user_info.dart +++ b/lib/screens/user/user_info.dart @@ -82,13 +82,16 @@ class _UserInfoState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - tr("current_account_anonymous"), + tr('current_account_anonymous'), textAlign: TextAlign.center, ), ElevatedButton( onPressed: () async { await _auth.currentUser!.delete().then((value) async { await _auth.signOut().then((value) { + if (!context.mounted) { + return; + } Navigator.pushReplacement(context, MaterialPageRoute(builder: ((context) { return const LandingScreen(); @@ -96,7 +99,7 @@ class _UserInfoState extends State { }); }); }, - child: Text(tr("login_signup"))) + child: Text(tr('login_signup'))) ], ), ) @@ -112,7 +115,7 @@ class _UserInfoState extends State { ); } else if (snapshot.hasError) { Center( - child: Text(tr("error_occured")), + child: Text(tr('error_occured')), ); } return Container( @@ -147,7 +150,7 @@ class _UserInfoState extends State { children: [ Text( snapshot.data!['name'] ?? - tr("not_available"), + tr('not_available'), style: kTextHeaderStyle, ), Visibility( @@ -178,24 +181,24 @@ class _UserInfoState extends State { const EdgeInsets.only(top: 15.0, bottom: 10), child: ElevatedButton( style: const ButtonStyle( - minimumSize: MaterialStatePropertyAll( - Size(250, 45))), + minimumSize: + WidgetStatePropertyAll(Size(250, 45))), onPressed: () { Navigator.push(context, MaterialPageRoute(builder: (context) { return const ProfileEdit(); })); }, - child: Text(tr("edit_profile"))), + child: Text(tr('edit_profile'))), ), const Divider( thickness: 1, color: Colors.grey, ), - userListTile(tr("email"), + userListTile(tr('email'), snapshot.data!['email'] ?? '', 0, context), userListTile( - tr("joined"), + tr('joined'), '${DateFormat('MMMM').format(DateTime(0, DateTime.parse(snapshot.data!['joinedAt']).month))} ${DateTime.parse(snapshot.data!['joinedAt']).year}', 3, context), @@ -212,20 +215,23 @@ class _UserInfoState extends State { return AlertDialog( title: Padding( padding: const EdgeInsets.all(8.0), - child: Text(tr("sign_out")), + child: Text(tr('sign_out')), ), - content: Text(tr("want_to_sign_out")), + content: Text(tr('want_to_sign_out')), actions: [ ElevatedButton( onPressed: () async { Navigator.pop(context); }, - child: Text(tr("cancel"))), + child: Text(tr('cancel'))), TextButton( onPressed: () async { await _auth .signOut() .then((value) { + if (!context.mounted) { + return; + } Navigator.pushReplacement( context, MaterialPageRoute( @@ -236,7 +242,7 @@ class _UserInfoState extends State { }); }, child: Text( - tr("ok"), + tr('ok'), style: const TextStyle( color: Colors.red), )) @@ -244,7 +250,7 @@ class _UserInfoState extends State { ); }); }, - title: Text(tr("logout")), + title: Text(tr('logout')), leading: Icon( Icons.exit_to_app_rounded, color: Theme.of(context).colorScheme.primary, diff --git a/lib/screens/user/user_state.dart b/lib/screens/user/user_state.dart index d0d1dc6..028449a 100644 --- a/lib/screens/user/user_state.dart +++ b/lib/screens/user/user_state.dart @@ -22,7 +22,7 @@ class UserState extends StatelessWidget { } } else { return Center( - child: Text(tr("error_occured")), + child: Text(tr('error_occured')), ); } }); diff --git a/lib/services/globle_method.dart b/lib/services/globle_method.dart index d05463d..01a9f38 100644 --- a/lib/services/globle_method.dart +++ b/lib/services/globle_method.dart @@ -32,13 +32,13 @@ class GlobalMethods { actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text(tr("cancel"))), + child: Text(tr('cancel'))), TextButton( onPressed: () { fct(); Navigator.pop(context); }, - child: Text(tr("ok"))) + child: Text(tr('ok'))) ], ); }); @@ -53,7 +53,7 @@ class GlobalMethods { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Text(tr("error_occured")), + child: Text(tr('error_occured')), ), ], ), @@ -63,7 +63,7 @@ class GlobalMethods { onPressed: () { Navigator.pop(context); }, - child: Text(tr("ok"))) + child: Text(tr('ok'))) ], ); }); @@ -82,7 +82,7 @@ class GlobalMethods { Navigator.pop(context); Navigator.pop(context); }, - child: Text(tr("ok"))) + child: Text(tr('ok'))) ], ); }); @@ -98,7 +98,7 @@ class GlobalMethods { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Text(tr("error_occured")), + child: Text(tr('error_occured')), ), ], ), @@ -108,7 +108,7 @@ class GlobalMethods { onPressed: () { Navigator.pop(context); }, - child: Text(tr("ok"))) + child: Text(tr('ok'))) ], ); }); @@ -120,18 +120,19 @@ class GlobalMethods { duration: const Duration(milliseconds: 1500), content: Text( error is FormatException - ? tr("internal_error") + ? tr('internal_error') : error is TimeoutException - ? tr("timed_out") + ? tr('timed_out') : error is SocketException - ? tr("internet_problem") + ? tr('internet_problem') : error is NotFoundException - ? tr("media_not_found", namedArgs: {"s": server}) + ? tr('media_not_found', namedArgs: {'s': server}) : error is ServerDownException - ? tr("server_is_down", namedArgs: {"s": server}) - : error is ChannelsNotFoundException ? tr("channels_fetch_failed") - : tr("general_error", - namedArgs: {"e": error.toString()}), + ? tr('server_is_down', namedArgs: {'s': server}) + : error is ChannelsNotFoundException + ? tr('channels_fetch_failed') + : tr('general_error', + namedArgs: {'e': error.toString()}), style: const TextStyle(fontFamily: 'Poppins'), ))); } @@ -142,10 +143,10 @@ class GlobalMethods { duration: const Duration(milliseconds: 1500), content: Text( error is TimeoutException - ? tr("timed_out") + ? tr('timed_out') : error is SocketException - ? tr("internet_problem") - : tr("general_error", namedArgs: {"e": error.toString()}), + ? tr('internet_problem') + : tr('general_error', namedArgs: {'e': error.toString()}), style: const TextStyle(fontFamily: 'Poppins'), ))); } @@ -160,7 +161,9 @@ class GlobalMethods { } static void showCustomScaffoldMessage( - SnackBar message, BuildContext context) async { - ScaffoldMessenger.of(context).showSnackBar(message); + SnackBar message, BuildContext? context) async { + if (context != null) { + ScaffoldMessenger.of(context).showSnackBar(message); + } } } diff --git a/lib/ui_components/movie_ui_components.dart b/lib/ui_components/movie_ui_components.dart index a75b910..5ad9424 100644 --- a/lib/ui_components/movie_ui_components.dart +++ b/lib/ui_components/movie_ui_components.dart @@ -77,7 +77,11 @@ class HorizontalScrollingMoviesList extends StatelessWidget { imageUrl: movieList![index].posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + movieList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -109,8 +113,8 @@ class HorizontalScrollingMoviesList extends StatelessWidget { height: 25, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.black45 : Colors.white60), child: Row( @@ -219,7 +223,11 @@ class MovieListView extends StatelessWidget { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + moviesList![index].posterPath!, imageBuilder: @@ -276,7 +284,7 @@ class MovieListView extends StatelessWidget { ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -357,7 +365,11 @@ class MovieGridView extends StatelessWidget { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + moviesList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -389,8 +401,8 @@ class MovieGridView extends StatelessWidget { height: 25, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.black45 : Colors.white60), child: Row( diff --git a/lib/ui_components/tv_ui_components.dart b/lib/ui_components/tv_ui_components.dart index 19934a5..0f6f4d5 100644 --- a/lib/ui_components/tv_ui_components.dart +++ b/lib/ui_components/tv_ui_components.dart @@ -78,7 +78,11 @@ class HorizontalScrollingTVList extends StatelessWidget { imageUrl: tvList![index].posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -110,8 +114,8 @@ class HorizontalScrollingTVList extends StatelessWidget { height: 25, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.black45 : Colors.white60), child: Row( @@ -220,7 +224,11 @@ class TVListView extends StatelessWidget { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList![index].posterPath!, imageBuilder: @@ -277,7 +285,7 @@ class TVListView extends StatelessWidget { ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -356,7 +364,11 @@ class TVGridView extends StatelessWidget { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -388,8 +400,8 @@ class TVGridView extends StatelessWidget { height: 25, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.black45 : Colors.white60), child: Row( diff --git a/lib/widgets/common_widgets.dart b/lib/widgets/common_widgets.dart index 3020f70..f4ad129 100644 --- a/lib/widgets/common_widgets.dart +++ b/lib/widgets/common_widgets.dart @@ -51,7 +51,7 @@ class _DrawerWidgetState extends State { AppDependencyProvider appDependencyProvider = AppDependencyProvider(); return Drawer( child: Container( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, child: SingleChildScrollView( @@ -64,7 +64,7 @@ class _DrawerWidgetState extends State { width: double.infinity, child: DrawerHeader( decoration: BoxDecoration( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black), child: flixquestLogo == 'default' @@ -79,7 +79,7 @@ class _DrawerWidgetState extends State { FontAwesomeIcons.bookmark, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("bookmarks")), + title: Text(tr('bookmarks')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -93,7 +93,7 @@ class _DrawerWidgetState extends State { FontAwesomeIcons.tv, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("live_tv")), + title: Text(tr('live_tv')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -120,7 +120,7 @@ class _DrawerWidgetState extends State { Icons.settings_rounded, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("settings")), + title: Text(tr('settings')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -134,7 +134,7 @@ class _DrawerWidgetState extends State { FontAwesomeIcons.server, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("check_server")), + title: Text(tr('check_server')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: (context) { @@ -147,7 +147,7 @@ class _DrawerWidgetState extends State { Icons.update_rounded, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("check_for_update")), + title: Text(tr('check_for_update')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: ((context) { @@ -162,7 +162,7 @@ class _DrawerWidgetState extends State { Icons.info_outline, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("about")), + title: Text(tr('about')), onTap: () { Navigator.push(context, MaterialPageRoute(builder: (context) { @@ -175,12 +175,12 @@ class _DrawerWidgetState extends State { Icons.share_rounded, color: Theme.of(context).colorScheme.primary, ), - title: Text(tr("shared_the_app")), + title: Text(tr('shared_the_app')), onTap: () async { mixpanel.track('Share button data', properties: { 'Share button click': 'Share', }); - await Share.share(tr("share_text")); + await Share.share(tr('share_text')); }, ), ], @@ -358,9 +358,9 @@ Widget detailGenreShimmer(String themeMode) => ShimmerBase( borderRadius: BorderRadius.circular(20.0), ), label: Text( - tr("placeholder"), + tr('placeholder'), ), - backgroundColor: themeMode == "dark" || themeMode == "amoled" + backgroundColor: themeMode == 'dark' || themeMode == 'amoled' ? const Color(0xFF2b2c30) : const Color(0xFFDFDEDE), ), @@ -552,7 +552,7 @@ Widget detailVideoShimmer(String themeMode) => SizedBox( Widget socialMediaShimmer(String themeMode) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.transparent : const Color(0xFFDFDEDE), ), @@ -720,7 +720,7 @@ Widget movieCastAndCrewTabShimmer(String themeMode) => Container( ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -804,7 +804,7 @@ Widget detailsRecommendationsAndSimilarShimmer( ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -826,90 +826,91 @@ Widget detailsRecommendationsAndSimilarShimmer( ); Widget watchProvidersTabData( - {required String themeMode, - required String imageQuality, - required String noOptionMessage, - required List? watchOptions, required BuildContext context}) { - final isProxyEnabled = Provider.of(context).enableProxy; - final proxyUrl = Provider.of(context).tmdbProxy; - return Container( - padding: const EdgeInsets.all(8.0), - child: watchOptions == null - ? Center( - child: Text( - noOptionMessage, - textAlign: TextAlign.center, - )) - : GridView.builder( - gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: 100, - childAspectRatio: 0.65, - crossAxisSpacing: 5, - mainAxisSpacing: 5, - ), - itemCount: watchOptions.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: Column( - children: [ - Expanded( - flex: 6, - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: watchOptions[index].logoPath == null - ? Image.asset( - 'assets/images/na_logo.png', - fit: BoxFit.cover, - ) - : CachedNetworkImage( - cacheManager: cacheProp(), - fadeOutDuration: - const Duration(milliseconds: 300), - fadeOutCurve: Curves.easeOut, - fadeInDuration: - const Duration(milliseconds: 700), - fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - watchOptions[index].logoPath!, - imageBuilder: (context, imageProvider) => - Container( - decoration: BoxDecoration( - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, - ), + {required String themeMode, + required String imageQuality, + required String noOptionMessage, + required List? watchOptions, + required BuildContext context}) { + final isProxyEnabled = Provider.of(context).enableProxy; + final proxyUrl = Provider.of(context).tmdbProxy; + return Container( + padding: const EdgeInsets.all(8.0), + child: watchOptions == null + ? Center( + child: Text( + noOptionMessage, + textAlign: TextAlign.center, + )) + : GridView.builder( + gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( + maxCrossAxisExtent: 100, + childAspectRatio: 0.65, + crossAxisSpacing: 5, + mainAxisSpacing: 5, + ), + itemCount: watchOptions.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.all(4.0), + child: Column( + children: [ + Expanded( + flex: 6, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: watchOptions[index].logoPath == null + ? Image.asset( + 'assets/images/na_logo.png', + fit: BoxFit.cover, + ) + : CachedNetworkImage( + cacheManager: cacheProp(), + fadeOutDuration: + const Duration(milliseconds: 300), + fadeOutCurve: Curves.easeOut, + fadeInDuration: + const Duration(milliseconds: 700), + fadeInCurve: Curves.easeIn, + imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, + proxyUrl, isProxyEnabled, context) + + imageQuality + + watchOptions[index].logoPath!, + imageBuilder: (context, imageProvider) => + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, ), ), - placeholder: (context, url) => - watchProvidersImageShimmer(themeMode), - errorWidget: (context, url, error) => - Image.asset( - 'assets/images/na_logo.png', - fit: BoxFit.cover, - ), ), - ), - ), - const SizedBox( - height: 5, + placeholder: (context, url) => + watchProvidersImageShimmer(themeMode), + errorWidget: (context, url, error) => + Image.asset( + 'assets/images/na_logo.png', + fit: BoxFit.cover, + ), + ), ), - Expanded( - flex: 3, - child: Text( - watchOptions[index].providerName!, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ], - ), - ); - }), - ); - } - + ), + const SizedBox( + height: 5, + ), + Expanded( + flex: 3, + child: Text( + watchOptions[index].providerName!, + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + )), + ], + ), + ); + }), + ); +} Widget watchProvidersShimmer(String themeMode) => Container( padding: const EdgeInsets.all(8.0), @@ -1066,7 +1067,7 @@ Widget mainPageVerticalScrollShimmer( ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -1203,7 +1204,7 @@ Widget tvDetailsSeasonsTabShimmer(String themeMode) => Column( ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -1282,7 +1283,7 @@ Widget tvCastAndCrewTabShimmer(String themeMode) => Container( ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -1472,7 +1473,7 @@ Widget personAboutSimmer(themeMode) => Column( const LeadingDot(), Expanded( child: Text( - tr("biography"), + tr('biography'), style: kTextHeaderStyle, ), ), @@ -1598,7 +1599,7 @@ Widget newsShimmer(String themeMode, scrollController, isLoading) { ), ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -1641,8 +1642,10 @@ class _DidYouKnowState extends State { @override void initState() { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchSocialLinks(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1671,7 +1674,7 @@ class _DidYouKnowState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - tr("did_you_know"), + tr('did_you_know'), style: kTextHeaderStyle, ), const SizedBox( @@ -1684,7 +1687,7 @@ class _DidYouKnowState extends State { externalLinks!.imdbId!.isEmpty ? Center( child: Text( - tr("no_imdb_id"), + tr('no_imdb_id'), textAlign: TextAlign.center, )) : Wrap( @@ -1692,47 +1695,47 @@ class _DidYouKnowState extends State { children: [ ElevatedButton( onPressed: () { - navToDYK('trivia', tr("trivia"), + navToDYK('trivia', tr('trivia'), externalLinks!.imdbId!); }, - child: Text(tr("trivia")), + child: Text(tr('trivia')), ), ElevatedButton( onPressed: () { - navToDYK('quotes', tr("quotes"), + navToDYK('quotes', tr('quotes'), externalLinks!.imdbId!); }, - child: Text(tr("quotes")), + child: Text(tr('quotes')), ), ElevatedButton( onPressed: () { - navToDYK('goofs', tr("goofs"), + navToDYK('goofs', tr('goofs'), externalLinks!.imdbId!); }, - child: Text(tr("goofs")), + child: Text(tr('goofs')), ), ElevatedButton( onPressed: () { - navToDYK('crazycredits', tr("crazy_credits"), + navToDYK('crazycredits', tr('crazy_credits'), externalLinks!.imdbId!); }, - child: Text(tr("crazy_credits")), + child: Text(tr('crazy_credits')), ), ElevatedButton( onPressed: () { navToDYK( 'alternateversions', - tr("alternate_versions"), + tr('alternate_versions'), externalLinks!.imdbId!); }, - child: Text(tr("alternate_versions")), + child: Text(tr('alternate_versions')), ), ElevatedButton( onPressed: () { - navToDYK('soundtrack', tr("soundtrack"), + navToDYK('soundtrack', tr('soundtrack'), externalLinks!.imdbId!); }, - child: Text(tr("soundtrack")), + child: Text(tr('soundtrack')), ), ElevatedButton( onPressed: () { @@ -1742,7 +1745,7 @@ class _DidYouKnowState extends State { // imdbId: externalLinks!.imdbId!); // }))); }, - child: Text(tr("reviews")), + child: Text(tr('reviews')), ), ], )), @@ -1775,9 +1778,12 @@ class _WatchProvidersDetailsState extends State void initState() { super.initState(); tabController = TabController(length: 3, vsync: this); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { watchProviders = value; @@ -1805,26 +1811,26 @@ class _WatchProvidersDetailsState extends State indicatorSize: TabBarIndicatorSize.tab, tabs: [ Tab( - child: Text(tr("buy"), + child: Text(tr('buy'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("stream"), + child: Text(tr('stream'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("rent"), + child: Text(tr('rent'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -1834,7 +1840,7 @@ class _WatchProvidersDetailsState extends State ), Expanded( child: Container( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black : Colors.white, child: TabBarView( @@ -1850,18 +1856,21 @@ class _WatchProvidersDetailsState extends State watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_buy"), - watchOptions: watchProviders!.buy, context: context), + noOptionMessage: tr('no_buy'), + watchOptions: watchProviders!.buy, + context: context), watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_stream"), - watchOptions: watchProviders!.flatRate, context: context), + noOptionMessage: tr('no_stream'), + watchOptions: watchProviders!.flatRate, + context: context), watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_rent"), - watchOptions: watchProviders!.rent, context: context), + noOptionMessage: tr('no_rent'), + watchOptions: watchProviders!.rent, + context: context), ], ), ), @@ -1882,10 +1891,10 @@ class ShimmerBase extends StatelessWidget { @override Widget build(BuildContext context) { return Shimmer.fromColors( - baseColor: themeMode == "dark" || themeMode == "amoled" + baseColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.grey.shade900 : Colors.grey.shade300, - highlightColor: themeMode == "dark" || themeMode == "amoled" + highlightColor: themeMode == 'dark' || themeMode == 'amoled' ? Colors.grey.shade800.withOpacity(0.1) : Colors.grey.shade200, child: child, @@ -1931,7 +1940,7 @@ class ReportErrorWidget extends StatelessWidget { child: ElevatedButton( onPressed: () async { await launchUrl( - Uri.parse("https://t.me/flixquestgroup"), + Uri.parse('https://t.me/flixquestgroup'), mode: LaunchMode.externalApplication); }, child: Row( @@ -1943,7 +1952,7 @@ class ReportErrorWidget extends StatelessWidget { width: 10, ), Text( - tr("report_telegram"), + tr('report_telegram'), maxLines: 1, overflow: TextOverflow.ellipsis, ) @@ -2020,8 +2029,11 @@ class ExternalPlay extends StatelessWidget { FlutterClipboard.copy( videoSources.entries.elementAt(index).value) .then((value) { + if (!context.mounted) { + return; + } GlobalMethods.showScaffoldMessage( - tr("video_link_copied"), context); + tr('video_link_copied'), context); Navigator.pop(context); }); }, diff --git a/lib/widgets/movie_widgets.dart b/lib/widgets/movie_widgets.dart index c1fc5be..9085c45 100644 --- a/lib/widgets/movie_widgets.dart +++ b/lib/widgets/movie_widgets.dart @@ -63,10 +63,10 @@ class _MainMoviesDisplayState extends State { return Container( child: ListView( children: [ - DiscoverMovies(includeAdult: includeAdult, discoverType: "discover"), + DiscoverMovies(includeAdult: includeAdult, discoverType: 'discover'), const UpdateBottom(), ScrollingMovies( - title: tr("popular"), + title: tr('popular'), api: Endpoints.popularMoviesUrl(lang), discoverType: 'popular', isTrending: false, @@ -76,28 +76,28 @@ class _MainMoviesDisplayState extends State { ? Container() : ScrollingRecentMovies(moviesList: rMovies), ScrollingMovies( - title: tr("trending_this_week"), + title: tr('trending_this_week'), api: Endpoints.trendingMoviesUrl(includeAdult, lang), discoverType: 'Trending', isTrending: true, includeAdult: includeAdult, ), ScrollingMovies( - title: tr("top_rated"), + title: tr('top_rated'), api: Endpoints.topRatedUrl(lang), discoverType: 'top_rated', isTrending: false, includeAdult: includeAdult, ), ScrollingMovies( - title: tr("now_playing"), + title: tr('now_playing'), api: Endpoints.nowPlayingMoviesUrl(1, lang), discoverType: 'now_playing', isTrending: false, includeAdult: includeAdult, ), ScrollingMovies( - title: tr("upcoming"), + title: tr('upcoming'), api: Endpoints.upcomingMoviesUrl(lang), discoverType: 'upcoming', isTrending: false, @@ -161,10 +161,14 @@ class DiscoverMoviesState extends State List genres = movieGenreFilterdata; years.shuffle(); genres.shuffle(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchMovies( - '$TMDB_API_BASE_URL/discover/movie?api_key=$TMDB_API_KEY&sort_by=popularity.desc&watch_region=US&include_adult=${widget.includeAdult}&primary_release_year=${years.first}&with_genres=${genres.first.genreValue}', isProxyEnabled, proxyUrl) + '$TMDB_API_BASE_URL/discover/movie?api_key=$TMDB_API_KEY&sort_by=popularity.desc&watch_region=US&include_adult=${widget.includeAdult}&primary_release_year=${years.first}&with_genres=${genres.first.genreValue}', + isProxyEnabled, + proxyUrl) .then((value) async { if (mounted) { setState(() { @@ -214,7 +218,7 @@ class DiscoverMoviesState extends State : moviesList!.isEmpty ? Center( child: Text( - tr("wow_odd"), + tr('wow_odd'), style: kTextSmallBodyStyle, ), ) @@ -254,7 +258,11 @@ class DiscoverMoviesState extends State imageUrl: moviesList![index].posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + moviesList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -318,8 +326,10 @@ class ScrollingMoviesState extends State bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -328,7 +338,9 @@ class ScrollingMoviesState extends State }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -346,9 +358,12 @@ class ScrollingMoviesState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -409,15 +424,14 @@ class ScrollingMoviesState extends State })); }, style: ButtonStyle( - maximumSize: - MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ))), child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text(tr("view_all")), + child: Text(tr('view_all')), ), )), ], @@ -493,7 +507,11 @@ class ScrollingMoviesState extends State .posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + moviesList![ index] @@ -541,9 +559,9 @@ class ScrollingMoviesState extends State BorderRadius.circular( 8), color: - themeMode == "dark" || + themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors.black45 : Colors.white60), child: Row( @@ -594,7 +612,7 @@ class ScrollingMoviesState extends State ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -639,7 +657,7 @@ class _ScrollingRecentMoviesState extends State { const LeadingDot(), Expanded( child: Text( - tr("recently_watched"), + tr('recently_watched'), style: kTextHeaderStyle, ), ), @@ -659,8 +677,8 @@ class _ScrollingRecentMoviesState extends State { // }, // style: ButtonStyle( // maximumSize: - // MaterialStateProperty.all(const Size(200, 60)), - // shape: MaterialStateProperty.all( + // WidgetStateProperty.all(const Size(200, 60)), + // shape: WidgetStateProperty.all( // RoundedRectangleBorder( // borderRadius: BorderRadius.circular(20.0), // ))), @@ -700,7 +718,7 @@ class _ScrollingRecentMoviesState extends State { builder: (context) => MovieVideoLoader( download: false, /* return to fetchRoute instead of hard text*/ route: - fetchRoute == "flixHQ" + fetchRoute == 'flixHQ' ? StreamRoute.flixHQ : StreamRoute.tmDB, metadata: MovieStreamMetadata( @@ -724,7 +742,7 @@ class _ScrollingRecentMoviesState extends State { : GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -768,7 +786,11 @@ class _ScrollingRecentMoviesState extends State { .posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.moviesList[index] .posterPath!, @@ -852,7 +874,7 @@ class _ScrollingRecentMoviesState extends State { ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -923,13 +945,13 @@ class _SABTNState extends State { child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(50.0), - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.black12 : Colors.white38), child: IconButton( icon: Icon( Icons.arrow_back, - color: Theme.of(context).colorScheme.onBackground, + color: Theme.of(context).colorScheme.onSurface, ), onPressed: () { Navigator.pop(context); @@ -1168,7 +1190,11 @@ class MovieDetailQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + movie.posterPath!, ), @@ -1192,7 +1218,7 @@ class MovieDetailQuickInfo extends StatelessWidget { child: Text( movie.releaseDate == null ? movie.title! - : movie.releaseDate == "" + : movie.releaseDate == '' ? movie.title! : '${movie.title!} (${DateTime.parse(movie.releaseDate!).year})', maxLines: 4, @@ -1282,7 +1308,7 @@ class _MovieDetailOptionsState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("rating"), + tr('rating'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -1327,7 +1353,7 @@ class _MovieDetailOptionsState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("total_ratings"), + tr('total_ratings'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -1422,7 +1448,7 @@ class _MovieAboutState extends State { const LeadingDot(), Expanded( child: Text( - tr("overview"), + tr('overview'), style: kTextHeaderStyle, ), ), @@ -1436,15 +1462,15 @@ class _MovieAboutState extends State { padding: const EdgeInsets.all(8.0), child: widget.movie.overview == null || widget.movie.overview!.isEmpty - ? Text(tr("no_overview_movie")) + ? Text(tr('no_overview_movie')) : ReadMoreText( widget.movie.overview!, trimLines: 4, style: const TextStyle(fontFamily: 'Poppins'), colorClickableText: Theme.of(context).colorScheme.primary, trimMode: TrimMode.Line, - trimCollapsedText: tr("read_more"), - trimExpandedText: tr("read_less"), + trimCollapsedText: tr('read_more'), + trimExpandedText: tr('read_less'), lessStyle: TextStyle( fontSize: 14, color: Theme.of(context).colorScheme.primary, @@ -1464,7 +1490,7 @@ class _MovieAboutState extends State { child: Text( widget.movie.releaseDate == null || widget.movie.releaseDate!.isEmpty - ? tr("no_release_date") + ? tr('no_release_date') : '${tr("release_date")} : ${DateTime.parse(widget.movie.releaseDate!).day} ${DateFormat("MMMM").format(DateTime.parse(widget.movie.releaseDate!))}, ${DateTime.parse(widget.movie.releaseDate!).year}', style: const TextStyle(fontFamily: 'PoppinsSB'), maxLines: 2, @@ -1508,16 +1534,16 @@ class _MovieAboutState extends State { const SizedBox(height: 15), ScrollingArtists( api: Endpoints.getCreditsUrl(widget.movie.id!, lang), - title: tr("cast"), + title: tr('cast'), ), MovieImagesDisplay( - title: tr("images"), + title: tr('images'), api: Endpoints.getImages(widget.movie.id!), name: widget.movie.title, ), MovieVideosDisplay( api: Endpoints.getVideos(widget.movie.id!), - title: tr("videos"), + title: tr('videos'), ), MovieSocialLinks( api: Endpoints.getExternalLinksForMovie(widget.movie.id!, lang), @@ -1586,9 +1612,9 @@ class DownloadMovie extends StatelessWidget { return Container( child: TextButton( style: ButtonStyle( - maximumSize: MaterialStateProperty.all(Size(buttonWidth, 50)), + maximumSize: WidgetStateProperty.all(Size(buttonWidth, 50)), ).copyWith( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( Theme.of(context).colorScheme.primary, )), onPressed: () async { @@ -1632,7 +1658,7 @@ class DownloadMovie extends StatelessWidget { ), ), Text( - tr("download"), + tr('download'), style: const TextStyle(color: Colors.white), ), Visibility( @@ -1674,8 +1700,10 @@ class ScrollingArtistsState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1704,7 +1732,7 @@ class ScrollingArtistsState extends State { const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1726,7 +1754,7 @@ class ScrollingArtistsState extends State { const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1734,7 +1762,7 @@ class ScrollingArtistsState extends State { ), ), Center( - child: Text(tr("no_cast_movie"), + child: Text(tr('no_cast_movie'), textAlign: TextAlign.center)), ], ) @@ -1749,7 +1777,7 @@ class ScrollingArtistsState extends State { const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1768,17 +1796,17 @@ class ScrollingArtistsState extends State { }, style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), maximumSize: - MaterialStateProperty.all(const Size(200, 60)), + WidgetStateProperty.all(const Size(200, 60)), shape: - MaterialStateProperty.all( + WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), ), ), - child: Text(tr("see_all_cast_crew")), + child: Text(tr('see_all_cast_crew')), ) ], ), @@ -1833,7 +1861,11 @@ class ScrollingArtistsState extends State { fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + credits!.cast![index] .profilePath!, @@ -1903,8 +1935,10 @@ class MovieSocialLinksState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchSocialLinks(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1929,7 +1963,7 @@ class MovieSocialLinksState extends State { const LeadingDot(), Expanded( child: Text( - tr("social_media_links"), + tr('social_media_links'), style: kTextHeaderStyle, ), ), @@ -1946,14 +1980,14 @@ class MovieSocialLinksState extends State { externalLinks?.imdbId == null ? Center( child: Text( - tr("no_social_link_movie"), + tr('no_social_link_movie'), textAlign: TextAlign.center, ), ) : Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.transparent : const Color(0xFFDFDEDE), ), @@ -2031,9 +2065,12 @@ class BelongsToCollectionWidgetState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchBelongsToCollection(widget.api!, isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchBelongsToCollection(widget.api!, isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { belongsToCollection = value; @@ -2096,8 +2133,8 @@ class BelongsToCollectionWidgetState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("belongs_to_the", namedArgs: { - "collection": belongsToCollection!.name! + tr('belongs_to_the', namedArgs: { + 'collection': belongsToCollection!.name! }), textAlign: TextAlign.center, style: TextStyle( @@ -2114,16 +2151,15 @@ class BelongsToCollectionWidgetState extends State { child: TextButton( style: ButtonStyle( backgroundColor: - MaterialStateProperty.all( + WidgetStateProperty.all( Theme.of(context) .colorScheme .primary .withOpacity(0.3), ), - maximumSize: - MaterialStateProperty.all( - const Size(200, 40)), - shape: MaterialStateProperty.all< + maximumSize: WidgetStateProperty.all( + const Size(200, 40)), + shape: WidgetStateProperty.all< RoundedRectangleBorder>( RoundedRectangleBorder( borderRadius: @@ -2144,7 +2180,7 @@ class BelongsToCollectionWidgetState extends State { })); }, child: Text( - tr("view_collection"), + tr('view_collection'), style: const TextStyle( color: Colors.white), ), @@ -2176,8 +2212,10 @@ class CollectionOverviewWidgetState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCollectionDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2229,8 +2267,10 @@ class PartsListState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCollectionMovies(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2384,12 +2424,15 @@ class PartsListState extends State { 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - collectionMovieList![ - index] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + collectionMovieList![ + index] + .posterPath!, imageBuilder: (context, imageProvider) => Container( @@ -2433,9 +2476,9 @@ class PartsListState extends State { BorderRadius.circular( 8), color: - themeMode == "dark" || + themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors.black45 : Colors.white60), child: Row( @@ -2535,8 +2578,10 @@ class MovieImagesState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchImages(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2632,12 +2677,15 @@ class MovieImagesState extends State { 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - movieImages! - .poster![0] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + movieImages! + .poster![0] + .posterPath!, imageBuilder: (context, imageProvider) => GestureDetector( @@ -2659,7 +2707,11 @@ class MovieImagesState extends State { }))); }, child: Hero( - tag: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + tag: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + movieImages! .poster![0] @@ -2703,17 +2755,17 @@ class MovieImagesState extends State { child: Text(movieImages! .poster!.length == 1 - ? tr("poster_singular", + ? tr('poster_singular', namedArgs: { - "poster": + 'poster': movieImages! .poster! .length .toString() }) - : tr("poster_plural", + : tr('poster_plural', namedArgs: { - "poster": + 'poster': movieImages! .poster! .length @@ -2760,12 +2812,15 @@ class MovieImagesState extends State { 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - movieImages! - .backdrop![0] - .filePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + movieImages! + .backdrop![0] + .filePath!, imageBuilder: (context, imageProvider) => GestureDetector( @@ -2786,7 +2841,11 @@ class MovieImagesState extends State { }))); }, child: Hero( - tag: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + tag: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + movieImages! .backdrop![0] @@ -2825,17 +2884,17 @@ class MovieImagesState extends State { child: Text(movieImages! .backdrop!.length == 1 - ? tr("backdrop_singular", + ? tr('backdrop_singular', namedArgs: { - "backdrop": + 'backdrop': movieImages! .backdrop! .length .toString() }) - : tr("backdrop_plural", + : tr('backdrop_plural', namedArgs: { - "backdrop": + 'backdrop': movieImages! .backdrop! .length @@ -2874,8 +2933,10 @@ class MovieVideosState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchVideos(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2946,7 +3007,7 @@ class MovieVideosState extends State { width: double.infinity, height: 80, child: Center( - child: Text(tr("no_video_movie"), + child: Text(tr('no_video_movie'), textAlign: TextAlign.center), ), ) @@ -3143,7 +3204,7 @@ class WatchNowButtonState extends State { ? Navigator.push(context, MaterialPageRoute(builder: ((context) { return MovieVideoLoader( - route: fetchRoute == "flixHQ" + route: fetchRoute == 'flixHQ' ? StreamRoute.flixHQ : StreamRoute.tmDB, download: false, @@ -3161,7 +3222,7 @@ class WatchNowButtonState extends State { : GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -3182,7 +3243,7 @@ class WatchNowButtonState extends State { color: Theme.of(context).colorScheme.onPrimary, ), const SizedBox(width: 6), - Text(tr("watch_now"), + Text(tr('watch_now'), style: TextStyle( color: Theme.of(context).colorScheme.onPrimary, )) @@ -3205,8 +3266,10 @@ class GenreDisplayState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchGenre(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3294,7 +3357,7 @@ class GenreDisplayState extends State // style: widget.themeData.textTheme.bodyText1, ), backgroundColor: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? const Color(0xFF2b2c30) : const Color(0xFFDFDEDE), ), @@ -3324,8 +3387,10 @@ class MovieInfoTableState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchMovieDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3348,7 +3413,7 @@ class MovieInfoTableState extends State { const LeadingDot(), Expanded( child: Text( - tr("movie_info"), + tr('movie_info'), style: kTextHeaderStyle, ), ), @@ -3364,7 +3429,7 @@ class MovieInfoTableState extends State { : DataTable(dataRowMinHeight: 40, columns: [ DataColumn( label: Text( - tr("original_title"), + tr('original_title'), style: kTableLeftStyle, )), DataColumn( @@ -3377,27 +3442,27 @@ class MovieInfoTableState extends State { ], rows: [ DataRow(cells: [ DataCell(Text( - tr("status"), + tr('status'), style: kTableLeftStyle, )), DataCell(Text(movieDetails!.status!.isEmpty - ? tr("unknown") + ? tr('unknown') : movieDetails!.status!)), ]), DataRow(cells: [ DataCell(Text( - tr("runtime"), + tr('runtime'), style: kTableLeftStyle, )), DataCell(Text(movieDetails!.runtime! == 0 - ? tr("not_available") - : tr("runtime_mins", namedArgs: { - "mins": movieDetails!.runtime!.toString() + ? tr('not_available') + : tr('runtime_mins', namedArgs: { + 'mins': movieDetails!.runtime!.toString() }))), ]), DataRow(cells: [ DataCell(Text( - tr("spoken_language"), + tr('spoken_language'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -3415,7 +3480,7 @@ class MovieInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(movieDetails! .spokenLanguages!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${movieDetails!.spokenLanguages![index].englishName},'), ); }, @@ -3424,7 +3489,7 @@ class MovieInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("budget"), + tr('budget'), style: kTableLeftStyle, )), DataCell(movieDetails!.budget == 0 @@ -3435,7 +3500,7 @@ class MovieInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("revenue"), + tr('revenue'), style: kTableLeftStyle, )), DataCell(movieDetails!.budget == 0 @@ -3446,7 +3511,7 @@ class MovieInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("tagline"), + tr('tagline'), style: kTableLeftStyle, )), DataCell( @@ -3461,7 +3526,7 @@ class MovieInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("production_companies"), + tr('production_companies'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -3479,7 +3544,7 @@ class MovieInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(movieDetails! .productionCompanies!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${movieDetails!.productionCompanies![index].name},'), ); }, @@ -3493,7 +3558,7 @@ class MovieInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("production_countries"), + tr('production_countries'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -3511,7 +3576,7 @@ class MovieInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(movieDetails! .productionCountries!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${movieDetails!.productionCountries![index].name},'), ); }, @@ -3553,7 +3618,7 @@ class CastTabState extends State return widget.credits.cast!.isEmpty ? Container( child: Center( - child: Text(tr("no_cast_movie")), + child: Text(tr('no_cast_movie')), ), ) : Container( @@ -3613,7 +3678,11 @@ class CastTabState extends State fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.credits.cast![index] .profilePath!, @@ -3655,9 +3724,9 @@ class CastTabState extends State ), Text(widget.credits.cast![index] .character!.isEmpty - ? tr("as_empty") - : tr("as", namedArgs: { - "character": widget.credits + ? tr('as_empty') + : tr('as', namedArgs: { + 'character': widget.credits .cast![index].character! })), Visibility( @@ -3675,18 +3744,18 @@ class CastTabState extends State .roles![0] .episodeCount! == 1 - ? tr("single_episode", + ? tr('single_episode', namedArgs: { - "count": widget + 'count': widget .credits .cast![index] .roles![0] .episodeCount! .toString() }) - : tr("multi_episode", + : tr('multi_episode', namedArgs: { - "count": widget + 'count': widget .credits .cast![index] .roles![0] @@ -3701,7 +3770,7 @@ class CastTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -3741,7 +3810,7 @@ class CrewTabState extends State return widget.credits.crew!.isEmpty ? Center( child: Text( - tr("no_crew_movie"), + tr('no_crew_movie'), textAlign: TextAlign.center, ), ) @@ -3801,7 +3870,11 @@ class CrewTabState extends State fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.credits.crew![index] .profilePath!, @@ -3843,9 +3916,9 @@ class CrewTabState extends State ), Text(widget.credits.crew![index] .department!.isEmpty - ? tr("job_empty") - : tr("job", namedArgs: { - "job": widget.credits.crew![index] + ? tr('job_empty') + : tr('job', namedArgs: { + 'job': widget.credits.crew![index] .department! })), ], @@ -3854,7 +3927,7 @@ class CrewTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -3899,9 +3972,12 @@ class MovieRecommendationsTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -3913,8 +3989,10 @@ class MovieRecommendationsTabState extends State } void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -3923,7 +4001,9 @@ class MovieRecommendationsTabState extends State }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -3957,7 +4037,7 @@ class MovieRecommendationsTabState extends State const LeadingDot(), Expanded( child: Text( - tr("movie_recommendations"), + tr('movie_recommendations'), style: kTextHeaderStyle, maxLines: 2, ), @@ -3976,7 +4056,7 @@ class MovieRecommendationsTabState extends State : movieList!.isEmpty ? Center( child: Text( - tr("no_recommendations_movie"), + tr('no_recommendations_movie'), textAlign: TextAlign.center, ), ) @@ -4000,7 +4080,7 @@ class MovieRecommendationsTabState extends State ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -4041,9 +4121,12 @@ class SimilarMoviesTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4055,8 +4138,10 @@ class SimilarMoviesTabState extends State } void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -4065,7 +4150,9 @@ class SimilarMoviesTabState extends State }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4099,8 +4186,8 @@ class SimilarMoviesTabState extends State const LeadingDot(), Expanded( child: Text( - tr("movies_similar_with", - namedArgs: {"movie": widget.movieName}), + tr('movies_similar_with', + namedArgs: {'movie': widget.movieName}), style: kTextHeaderStyle, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -4120,7 +4207,7 @@ class SimilarMoviesTabState extends State : movieList!.isEmpty ? Center( child: Text( - tr("no_similars_movie"), + tr('no_similars_movie'), textAlign: TextAlign.center, ), ) @@ -4175,8 +4262,10 @@ class ParticularGenreMoviesState extends State { bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -4185,7 +4274,9 @@ class ParticularGenreMoviesState extends State { }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4203,9 +4294,12 @@ class ParticularGenreMoviesState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4231,7 +4325,7 @@ class ParticularGenreMoviesState extends State { : moviesList!.isEmpty ? Container( child: Center( - child: Text(tr("no_genre_movie")), + child: Text(tr('no_genre_movie')), ), ) : Container( @@ -4295,8 +4389,10 @@ class ParticularStreamingServiceMoviesState bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -4305,7 +4401,9 @@ class ParticularStreamingServiceMoviesState }); if (mounted) { fetchMovies( - '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', isProxyEnabled, proxyUrl) + '${widget.api}&include_adult=${widget.includeAdult}&page=$pageNum', + isProxyEnabled, + proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4323,9 +4421,12 @@ class ParticularStreamingServiceMoviesState @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchMovies('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -4351,7 +4452,7 @@ class ParticularStreamingServiceMoviesState : moviesList!.isEmpty ? Container( child: Center( - child: Text(tr("no_watchprovider_movie")), + child: Text(tr('no_watchprovider_movie')), ), ) : Container( @@ -4463,8 +4564,10 @@ class GenreListGridState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchGenre(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4491,7 +4594,7 @@ class GenreListGridState extends State const LeadingDot(), Expanded( child: Text( - tr("genres"), + tr('genres'), style: kTextHeaderStyle, ), ), @@ -4535,7 +4638,7 @@ class GenreListGridState extends State borderRadius: BorderRadius.circular(15)), child: Text( - genreList![index].genreName ?? "Null", + genreList![index].genreName ?? 'Null', style: TextStyle( color: Theme.of(context) .colorScheme @@ -4578,11 +4681,11 @@ class TopButtonState extends State { padding: const EdgeInsets.all(10.0), child: TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( Theme.of(context).colorScheme.primary.withOpacity(0.3), ), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( @@ -4620,9 +4723,12 @@ class _WatchProvidersButtonState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { watchProviders = value; @@ -4637,11 +4743,11 @@ class _WatchProvidersButtonState extends State { padding: const EdgeInsets.all(10.0), child: TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( Theme.of(context).colorScheme.primary.withOpacity(0.3), ), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( @@ -4651,7 +4757,7 @@ class _WatchProvidersButtonState extends State { widget.onTap!(); }, child: Text( - tr("watch_providers"), + tr('watch_providers'), style: const TextStyle(color: Colors.white), ), ), @@ -4684,7 +4790,7 @@ class MoviesFromWatchProvidersState extends State { const LeadingDot(), Expanded( child: Text( - tr("streaming_services"), + tr('streaming_services'), style: kTextHeaderStyle, ), ), @@ -4782,8 +4888,10 @@ class CollectionMoviesState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCollectionMovies(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4806,7 +4914,7 @@ class CollectionMoviesState extends State { : moviesList!.isEmpty ? Center( child: Text( - tr("no_watchprovider_movie"), + tr('no_watchprovider_movie'), style: const TextStyle(fontFamily: 'Poppins'), ), ) @@ -4858,11 +4966,14 @@ class CollectionMoviesState extends State { const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - moviesList![index] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + moviesList![index] + .posterPath!, imageBuilder: (context, imageProvider) => Container( diff --git a/lib/widgets/person_widgets.dart b/lib/widgets/person_widgets.dart index 453c9e7..3f3f0b2 100644 --- a/lib/widgets/person_widgets.dart +++ b/lib/widgets/person_widgets.dart @@ -53,8 +53,10 @@ class _PersonImagesDisplayState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchPersonImages(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -103,7 +105,7 @@ class _PersonImagesDisplayState extends State ? personImageShimmer(themeMode) : personImages!.profile!.isEmpty ? Center( - child: Text(tr("no_images_person")), + child: Text(tr('no_images_person')), ) : Row( children: [ @@ -133,7 +135,11 @@ class _PersonImagesDisplayState extends State fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + personImages!.profile![index] .filePath!, @@ -148,13 +154,15 @@ class _PersonImagesDisplayState extends State imageProvider: imageProvider, currentIndex: index, - heroId: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - personImages! - .profile![ - index] - .filePath!, + heroId: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + personImages! + .profile![index] + .filePath!, name: widget.personName, ); }))); @@ -223,8 +231,10 @@ class PersonMovieListWidgetState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchPersonMovies(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -233,7 +243,7 @@ class PersonMovieListWidgetState extends State } if (personMoviesList != null) { uniqueMov = []; - for (Movie mov in personMoviesList!) { + for (final Movie mov in personMoviesList!) { if (!seenIds.contains(mov.id)) { uniqueMov!.add(mov); seenIds.add(mov.id!); @@ -259,7 +269,7 @@ class PersonMovieListWidgetState extends State padding: const EdgeInsets.all(8.0), child: Center( child: Text( - tr("contains_nsfw"), + tr('contains_nsfw'), textAlign: TextAlign.center, ), ), @@ -272,8 +282,8 @@ class PersonMovieListWidgetState extends State Padding( padding: const EdgeInsets.all(10.0), child: Text( - tr("person_movie_count", namedArgs: { - "count": uniqueMov!.length.toString() + tr('person_movie_count', namedArgs: { + 'count': uniqueMov!.length.toString() }), style: const TextStyle(fontSize: 15), ), @@ -334,19 +344,17 @@ class PersonMovieListWidgetState extends State BorderRadius .circular( 8.0), - child: uniqueMov![ - index] + child: uniqueMov![index] .posterPath == null ? Image.asset( 'assets/images/na_logo.png', fit: BoxFit .cover, - width: double + width: double .infinity, height: double - .infinity - ) + .infinity) : CachedNetworkImage( cacheManager: cacheProp(), @@ -364,7 +372,11 @@ class PersonMovieListWidgetState extends State fadeInCurve: Curves .easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + uniqueMov![ index] @@ -388,19 +400,14 @@ class PersonMovieListWidgetState extends State url) => scrollingImageShimmer( themeMode), - errorWidget: (context, - url, - error) => - Image - .asset( - 'assets/images/na_logo.png', - fit: BoxFit - .cover, - width: double + errorWidget: (context, url, error) => Image.asset( + 'assets/images/na_logo.png', + fit: BoxFit + .cover, + width: double .infinity, height: double - .infinity - ), + .infinity), ), ), Positioned( @@ -420,9 +427,9 @@ class PersonMovieListWidgetState extends State .circular( 8), color: themeMode == - "dark" || + 'dark' || themeMode == - "amoled" + 'amoled' ? Colors .black45 : Colors @@ -496,8 +503,10 @@ class PersonTVListWidgetState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchPersonTV(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -506,7 +515,7 @@ class PersonTVListWidgetState extends State } if (personTVList != null) { uniqueTV = []; - for (TV tv in personTVList!) { + for (final TV tv in personTVList!) { if (!seenIds.contains(tv.id)) { uniqueTV!.add(tv); seenIds.add(tv.id!); @@ -532,7 +541,7 @@ class PersonTVListWidgetState extends State padding: const EdgeInsets.all(8.0), child: Center( child: Text( - tr("contains_nsfw"), + tr('contains_nsfw'), textAlign: TextAlign.center, ), ), @@ -545,8 +554,8 @@ class PersonTVListWidgetState extends State Padding( padding: const EdgeInsets.all(10.0), child: Text( - tr("person_tv_count", namedArgs: { - "count": uniqueTV!.length.toString() + tr('person_tv_count', namedArgs: { + 'count': uniqueTV!.length.toString() }), style: const TextStyle(fontSize: 15), ), @@ -614,11 +623,10 @@ class PersonTVListWidgetState extends State 'assets/images/na_logo.png', fit: BoxFit .cover, - width: double + width: double .infinity, height: double - .infinity - ) + .infinity) : CachedNetworkImage( cacheManager: cacheProp(), @@ -636,7 +644,11 @@ class PersonTVListWidgetState extends State fadeInCurve: Curves .easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + uniqueTV![ index] @@ -660,19 +672,14 @@ class PersonTVListWidgetState extends State url) => scrollingImageShimmer( themeMode), - errorWidget: (context, - url, - error) => - Image - .asset( - 'assets/images/na_logo.png', - fit: BoxFit - .cover, - width: double + errorWidget: (context, url, error) => Image.asset( + 'assets/images/na_logo.png', + fit: BoxFit + .cover, + width: double .infinity, height: double - .infinity - ), + .infinity), ), ), Positioned( @@ -692,9 +699,9 @@ class PersonTVListWidgetState extends State .circular( 8), color: themeMode == - "dark" || + 'dark' || themeMode == - "amoled" + 'amoled' ? Colors .black45 : Colors @@ -764,8 +771,10 @@ class _PersonAboutWidgetState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchPersonDetails(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -797,7 +806,7 @@ class _PersonAboutWidgetState extends State const LeadingDot(), Expanded( child: Text( - tr("biography"), + tr('biography'), style: kTextHeaderStyle, ), ), @@ -808,15 +817,15 @@ class _PersonAboutWidgetState extends State ], ), ReadMoreText( - personDetails?.biography != "" + personDetails?.biography != '' ? personDetails!.biography! - : tr("no_biography_person"), + : tr('no_biography_person'), trimLines: 4, style: kTextSmallAboutBodyStyle, colorClickableText: Theme.of(context).colorScheme.primary, trimMode: TrimMode.Line, - trimCollapsedText: tr("read_more"), - trimExpandedText: tr("read_less"), + trimCollapsedText: tr('read_more'), + trimExpandedText: tr('read_less'), lessStyle: TextStyle( fontSize: 14, color: Theme.of(context).colorScheme.primary, @@ -853,8 +862,10 @@ class PersonSocialLinksState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchSocialLinks(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -879,7 +890,7 @@ class PersonSocialLinksState extends State { const LeadingDot(), Expanded( child: Text( - tr("social_media_links"), + tr('social_media_links'), style: kTextHeaderStyle, ), ), @@ -896,7 +907,7 @@ class PersonSocialLinksState extends State { externalLinks?.imdbId == null ? Center( child: Text( - tr("no_social_link_person"), + tr('no_social_link_person'), textAlign: TextAlign.center, style: kTextSmallBodyStyle, ), @@ -904,7 +915,7 @@ class PersonSocialLinksState extends State { : Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.transparent : const Color(0xFFDFDEDE), ), @@ -977,8 +988,10 @@ class _PersonDataTableState extends State { PersonDetails? personDetails; @override void initState() { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchPersonDetails(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1004,11 +1017,11 @@ class _PersonDataTableState extends State { label: personDetails!.deathday != null && personDetails!.birthday != null ? Text( - tr("died_aged"), + tr('died_aged'), style: kTableLeftStyle, ) : Text( - tr("age"), + tr('age'), style: kTableLeftStyle, )), DataColumn( @@ -1023,7 +1036,7 @@ class _PersonDataTableState extends State { ], rows: [ DataRow(cells: [ DataCell(Text( - tr("born_on"), + tr('born_on'), style: kTableLeftStyle, )), DataCell( @@ -1034,7 +1047,7 @@ class _PersonDataTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("from"), + tr('from'), style: kTableLeftStyle, )), DataCell( @@ -1097,29 +1110,29 @@ class _CastDetailAboutState extends State { labelColor: Colors.white, tabs: [ Tab( - child: Text(tr("about"), + child: Text(tr('about'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -1162,7 +1175,7 @@ class _CastDetailAboutState extends State { api: Endpoints.getPersonImages( widget.cast!.id!, ), - title: tr("images"), + title: tr('images'), ), PersonDataTable( api: Endpoints.getPersonDetails( @@ -1266,7 +1279,11 @@ class CastDetailQuickInfo extends StatelessWidget { 'assets/images/na_rect.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.cast!.profilePath!, ), @@ -1365,7 +1382,11 @@ class CreatedByQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.createdBy!.profilePath!, ), @@ -1443,29 +1464,29 @@ class _CreatedByAboutState extends State { labelColor: Colors.white, tabs: [ Tab( - child: Text(tr("about"), + child: Text(tr('about'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -1508,7 +1529,7 @@ class _CreatedByAboutState extends State { api: Endpoints.getPersonImages( widget.createdBy!.id!, ), - title: tr("images"), + title: tr('images'), ), PersonDataTable( api: Endpoints.getPersonDetails( @@ -1609,7 +1630,11 @@ class CrewDetailQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.crew!.profilePath!, ), @@ -1695,29 +1720,29 @@ class _CrewDetailAboutState extends State { labelColor: Colors.white, tabs: [ Tab( - child: Text(tr("about"), + child: Text(tr('about'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -1760,7 +1785,7 @@ class _CrewDetailAboutState extends State { api: Endpoints.getPersonImages( widget.crew!.id!, ), - title: tr("images"), + title: tr('images'), ), PersonDataTable( api: Endpoints.getPersonDetails( @@ -1863,7 +1888,11 @@ class GuestStarDetailQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.cast!.profilePath!, ), @@ -1948,29 +1977,29 @@ class _GuestStarDetailAboutState extends State { labelColor: Colors.white, tabs: [ Tab( - child: Text(tr("about"), + child: Text(tr('about'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -2013,7 +2042,7 @@ class _GuestStarDetailAboutState extends State { api: Endpoints.getPersonImages( widget.cast!.id!, ), - title: tr("images"), + title: tr('images'), ), PersonDataTable( api: Endpoints.getPersonDetails( @@ -2115,7 +2144,11 @@ class SearchedPersonQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget.person!.profilePath!, ), @@ -2200,29 +2233,29 @@ class _SearchedPersonAboutState extends State { labelColor: Colors.white, tabs: [ Tab( - child: Text(tr("about"), + child: Text(tr('about'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("movies"), + child: Text(tr('movies'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("tv_shows"), + child: Text(tr('tv_shows'), style: TextStyle( fontFamily: 'Poppins', color: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -2265,7 +2298,7 @@ class _SearchedPersonAboutState extends State { api: Endpoints.getPersonImages( widget.person!.id!, ), - title: tr("images"), + title: tr('images'), ), PersonDataTable( api: Endpoints.getPersonDetails( diff --git a/lib/widgets/tv_widgets.dart b/lib/widgets/tv_widgets.dart index 49449b4..4d16b84 100644 --- a/lib/widgets/tv_widgets.dart +++ b/lib/widgets/tv_widgets.dart @@ -79,7 +79,7 @@ class _MainTVDisplayState extends State { includeAdult: Provider.of(context).isAdult), ScrollingTV( includeAdult: Provider.of(context).isAdult, - title: tr("popular"), + title: tr('popular'), api: Endpoints.popularTVUrl(lang), discoverType: 'popular', isTrending: false, @@ -89,28 +89,28 @@ class _MainTVDisplayState extends State { : ScrollingRecentEpisodes(episodesList: rEpisodes), ScrollingTV( includeAdult: Provider.of(context).isAdult, - title: tr("trending_this_week"), + title: tr('trending_this_week'), api: Endpoints.trendingTVUrl(lang), discoverType: 'trending', isTrending: true, ), ScrollingTV( includeAdult: Provider.of(context).isAdult, - title: tr("top_rated"), + title: tr('top_rated'), api: Endpoints.topRatedTVUrl(lang), discoverType: 'top_rated', isTrending: false, ), ScrollingTV( includeAdult: Provider.of(context).isAdult, - title: tr("airing_today"), + title: tr('airing_today'), api: Endpoints.airingTodayUrl(lang), discoverType: 'airing_today', isTrending: false, ), ScrollingTV( includeAdult: Provider.of(context).isAdult, - title: tr("on_the_air"), + title: tr('on_the_air'), api: Endpoints.onTheAirUrl(lang), discoverType: 'on_the_air', isTrending: false, @@ -171,13 +171,16 @@ class DiscoverTVState extends State ]; void getData() { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; List years = yearDropdownData.yearsList.getRange(1, 26).toList(); List genres = tvGenreList; years.shuffle(); genres.shuffle(); - fetchTV('$TMDB_API_BASE_URL/discover/tv?api_key=$TMDB_API_KEY&sort_by=popularity.desc&watch_region=US&first_air_date_year=${years.first}&with_genres=${genres.first.genreValue}', isProxyEnabled, proxyUrl) + fetchTV('$TMDB_API_BASE_URL/discover/tv?api_key=$TMDB_API_KEY&sort_by=popularity.desc&watch_region=US&first_air_date_year=${years.first}&with_genres=${genres.first.genreValue}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -208,7 +211,7 @@ class DiscoverTVState extends State const LeadingDot(), Expanded( child: Text( - tr("featured_tv_shows"), + tr('featured_tv_shows'), style: kTextHeaderStyle, ), ), @@ -226,7 +229,7 @@ class DiscoverTVState extends State : tvList!.isEmpty ? Center( child: Text( - tr("wow_odd"), + tr('wow_odd'), style: kTextSmallBodyStyle, ), ) @@ -265,7 +268,11 @@ class DiscoverTVState extends State fadeInCurve: Curves.easeIn, imageUrl: tvList![index].posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList![index].posterPath!, imageBuilder: (context, imageProvider) => @@ -327,8 +334,10 @@ class ScrollingTVState extends State bool isLoading = false; void getMoreData() async { - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; _scrollController.addListener(() async { if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) { @@ -336,7 +345,8 @@ class ScrollingTVState extends State isLoading = true; }); - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -353,9 +363,13 @@ class ScrollingTVState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -414,15 +428,14 @@ class ScrollingTVState extends State })); }, style: ButtonStyle( - maximumSize: - MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(20.0), ))), child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text(tr("view_all")), + child: Text(tr('view_all')), ), )), ], @@ -497,7 +510,11 @@ class ScrollingTVState extends State .posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvList![index] .posterPath!, @@ -544,9 +561,9 @@ class ScrollingTVState extends State BorderRadius.circular( 8), color: - themeMode == "dark" || + themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors.black45 : Colors.white60), child: Row( @@ -597,7 +614,7 @@ class ScrollingTVState extends State ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -643,7 +660,7 @@ class _ScrollingRecentEpisodesState extends State { const LeadingDot(), Expanded( child: Text( - tr("recently_watched"), + tr('recently_watched'), style: kTextHeaderStyle, ), ), @@ -662,8 +679,8 @@ class _ScrollingRecentEpisodesState extends State { // }, // style: ButtonStyle( // maximumSize: - // MaterialStateProperty.all(const Size(200, 60)), - // shape: MaterialStateProperty.all( + // WidgetStateProperty.all(const Size(200, 60)), + // shape: WidgetStateProperty.all( // RoundedRectangleBorder( // borderRadius: BorderRadius.circular(20.0), // ))), @@ -699,13 +716,16 @@ class _ScrollingRecentEpisodesState extends State { }, onTap: () async { await checkConnection().then((value) { + if (!context.mounted) { + return; + } value ? Navigator.push( context, MaterialPageRoute( builder: (context) => TVVideoLoader( download: false, - route: fetchRoute == "flixHQ" + route: fetchRoute == 'flixHQ' ? StreamRoute.flixHQ : StreamRoute.tmDB, metadata: TVStreamMetadata( @@ -735,7 +755,7 @@ class _ScrollingRecentEpisodesState extends State { : GlobalMethods.showCustomScaffoldMessage( SnackBar( content: Text( - tr("check_connection"), + tr('check_connection'), maxLines: 3, style: kTextSmallBodyStyle, ), @@ -779,7 +799,11 @@ class _ScrollingRecentEpisodesState extends State { .posterPath == null ? '' - : buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + : buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + widget .episodesList[index] @@ -892,7 +916,7 @@ class _ScrollingRecentEpisodesState extends State { ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -928,8 +952,10 @@ class ScrollingTVArtistsState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -959,7 +985,7 @@ class ScrollingTVArtistsState extends State const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -991,16 +1017,15 @@ class ScrollingTVArtistsState extends State } }, style: ButtonStyle( - backgroundColor: - MaterialStateProperty.all(Colors.transparent), - maximumSize: MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all(Colors.transparent), + maximumSize: WidgetStateProperty.all(const Size(200, 60)), + shape: WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), ), ), - child: Text(tr("see_all_cast_crew"))) + child: Text(tr('see_all_cast_crew'))) ], ), SizedBox( @@ -1016,7 +1041,7 @@ class ScrollingTVArtistsState extends State width: double.infinity, child: Center( child: Text( - tr("no_cast_tv"), + tr('no_cast_tv'), )), )) : ListView.builder( @@ -1068,11 +1093,14 @@ class ScrollingTVArtistsState extends State const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - credits!.cast![index] - .profilePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + credits!.cast![index] + .profilePath!, imageBuilder: (context, imageProvider) => Container( @@ -1149,8 +1177,10 @@ class ScrollingTVEpisodeCastsState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1180,7 +1210,7 @@ class ScrollingTVEpisodeCastsState extends State const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1202,7 +1232,7 @@ class ScrollingTVEpisodeCastsState extends State const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1210,7 +1240,7 @@ class ScrollingTVEpisodeCastsState extends State ), ), Center( - child: Text(tr("no_cast_episode"), + child: Text(tr('no_cast_episode'), textAlign: TextAlign.center)), ], ) @@ -1225,7 +1255,7 @@ class ScrollingTVEpisodeCastsState extends State const LeadingDot(), Expanded( child: Text( - tr("cast"), + tr('cast'), style: kTextHeaderStyle, ), ), @@ -1248,17 +1278,17 @@ class ScrollingTVEpisodeCastsState extends State }, style: ButtonStyle( backgroundColor: - MaterialStateProperty.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), maximumSize: - MaterialStateProperty.all(const Size(200, 60)), - shape: MaterialStateProperty.all< - RoundedRectangleBorder>( + WidgetStateProperty.all(const Size(200, 60)), + shape: + WidgetStateProperty.all( RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), ), ), - child: Text(tr("see_all_cast_crew"))) + child: Text(tr('see_all_cast_crew'))) ], ), SizedBox( @@ -1311,7 +1341,11 @@ class ScrollingTVEpisodeCastsState extends State fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + credits!.cast![index] .profilePath!, @@ -1386,8 +1420,10 @@ class ScrollingTVEpisodeGuestStarsState @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1413,7 +1449,7 @@ class ScrollingTVEpisodeGuestStarsState child: Row( children: [ Text( - tr("guest_stars"), + tr('guest_stars'), style: kTextHeaderStyle, ), ], @@ -1423,7 +1459,7 @@ class ScrollingTVEpisodeGuestStarsState ? Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Text(tr("no_guest_episode"), + child: Text(tr('no_guest_episode'), textAlign: TextAlign.center)), ) : Row( @@ -1432,7 +1468,7 @@ class ScrollingTVEpisodeGuestStarsState Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("guest_stars"), + tr('guest_stars'), style: kTextHeaderStyle, ), ), @@ -1499,7 +1535,11 @@ class ScrollingTVEpisodeGuestStarsState fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + credits! .episodeGuestStars![index] @@ -1572,8 +1612,10 @@ class ScrollingTVEpisodeCrewState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1599,7 +1641,7 @@ class ScrollingTVEpisodeCrewState extends State child: Row( children: [ Text( - tr("crew"), + tr('crew'), style: kTextHeaderStyle, ), ], @@ -1609,7 +1651,7 @@ class ScrollingTVEpisodeCrewState extends State ? Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Text(tr("no_crew_episode"), + child: Text(tr('no_crew_episode'), textAlign: TextAlign.center)), ) : Row( @@ -1618,7 +1660,7 @@ class ScrollingTVEpisodeCrewState extends State Padding( padding: const EdgeInsets.all(8.0), child: Text( - tr("crew"), + tr('crew'), style: kTextHeaderStyle, ), ), @@ -1681,7 +1723,11 @@ class ScrollingTVEpisodeCrewState extends State fadeInDuration: const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + credits!.crew![index] .profilePath!, @@ -1756,8 +1802,10 @@ class ScrollingTVCreatorsState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchTVDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -1786,7 +1834,7 @@ class ScrollingTVCreatorsState extends State const LeadingDot(), Expanded( child: Text( - tr("created_by"), + tr('created_by'), style: kTextHeaderStyle, ), ), @@ -1805,7 +1853,7 @@ class ScrollingTVCreatorsState extends State ? Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Text(tr("no_creators"), + child: Text(tr('no_creators'), textAlign: TextAlign.center)), ) : ListView.builder( @@ -1857,12 +1905,15 @@ class ScrollingTVCreatorsState extends State const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvDetails! - .createdBy![index] - .profilePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvDetails! + .createdBy![index] + .profilePath!, imageBuilder: (context, imageProvider) => Container( @@ -1929,8 +1980,10 @@ class TVImagesDisplayState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchImages(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2016,11 +2069,14 @@ class TVImagesDisplayState extends State { const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvImages!.poster![0] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvImages!.poster![0] + .posterPath!, imageBuilder: (context, imageProvider) => GestureDetector( @@ -2038,7 +2094,11 @@ class TVImagesDisplayState extends State { }))); }, child: Hero( - tag: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + tag: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvImages!.poster![0] .posterPath!, @@ -2074,15 +2134,15 @@ class TVImagesDisplayState extends State { color: Colors.black38, child: Text( tvImages!.poster!.length == 1 - ? tr("poster_singular", + ? tr('poster_singular', namedArgs: { - "poster": tvImages! + 'poster': tvImages! .poster!.length .toString() }) - : tr("poster_plural", + : tr('poster_plural', namedArgs: { - "poster": tvImages! + 'poster': tvImages! .poster!.length .toString() })), @@ -2122,12 +2182,14 @@ class TVImagesDisplayState extends State { const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvImages! - .backdrop![0] - .filePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvImages!.backdrop![0] + .filePath!, imageBuilder: (context, imageProvider) => GestureDetector( @@ -2146,13 +2208,15 @@ class TVImagesDisplayState extends State { }))); }, child: Hero( - tag: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvImages! - .backdrop![ - 0] - .filePath!, + tag: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvImages! + .backdrop![0] + .filePath!, child: Container( decoration: BoxDecoration( @@ -2185,17 +2249,17 @@ class TVImagesDisplayState extends State { color: Colors.black38, child: Text( tvImages!.backdrop!.length == 1 - ? tr("backdrop_singular", + ? tr('backdrop_singular', namedArgs: { - "backdrop": + 'backdrop': tvImages! .backdrop! .length .toString() }) - : tr("backdrop_plural", + : tr('backdrop_plural', namedArgs: { - "backdrop": + 'backdrop': tvImages! .backdrop! .length @@ -2233,8 +2297,10 @@ class TVSeasonImagesDisplayState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchImages(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2331,7 +2397,11 @@ class TVSeasonImagesDisplayState extends State { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvImages!.poster![0].posterPath!, imageBuilder: @@ -2372,12 +2442,12 @@ class TVSeasonImagesDisplayState extends State { child: Container( color: Colors.black38, child: Text(tvImages!.poster!.length == 1 - ? tr("poster_singular", namedArgs: { - "poster": tvImages!.poster!.length + ? tr('poster_singular', namedArgs: { + 'poster': tvImages!.poster!.length .toString() }) - : tr("poster_plural", namedArgs: { - "poster": tvImages!.poster!.length + : tr('poster_plural', namedArgs: { + 'poster': tvImages!.poster!.length .toString() })), ), @@ -2409,8 +2479,10 @@ class TVEpisodeImagesDisplayState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchImages(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2505,7 +2577,11 @@ class TVEpisodeImagesDisplayState extends State { fadeInDuration: const Duration(milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvImages!.still![0].stillPath!, imageBuilder: @@ -2546,12 +2622,12 @@ class TVEpisodeImagesDisplayState extends State { child: Container( color: Colors.black38, child: Text(tvImages!.still!.length == 1 - ? tr("still_singular", namedArgs: { - "still": + ? tr('still_singular', namedArgs: { + 'still': tvImages!.still!.length.toString() }) - : tr("still_plural", namedArgs: { - "still": + : tr('still_plural', namedArgs: { + 'still': tvImages!.still!.length.toString() })), ), @@ -2583,8 +2659,10 @@ class TVVideosDisplayState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchVideos(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2656,7 +2734,7 @@ class TVVideosDisplayState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: - Text(tr("no_video"), textAlign: TextAlign.center), + Text(tr('no_video'), textAlign: TextAlign.center), )), ) : SizedBox( @@ -2790,8 +2868,10 @@ class TVCastTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -2813,7 +2893,7 @@ class TVCastTabState extends State : credits!.cast!.isEmpty ? Center( child: Text( - tr("no_cast_tv"), + tr('no_cast_tv'), style: kTextSmallHeaderStyle, textAlign: TextAlign.center, ), @@ -2874,12 +2954,14 @@ class TVCastTabState extends State const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - credits! - .cast![index] - .profilePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + credits!.cast![index] + .profilePath!, imageBuilder: (context, imageProvider) => Container( @@ -2919,9 +3001,9 @@ class TVCastTabState extends State ), Text(credits!.cast![index].roles![0] .character!.isEmpty - ? tr("as_empty") - : tr("as", namedArgs: { - "character": credits! + ? tr('as_empty') + : tr('as', namedArgs: { + 'character': credits! .cast![index] .roles![0] .character! @@ -2934,17 +3016,17 @@ class TVCastTabState extends State .roles![0] .episodeCount! == 1 - ? tr("single_episode", + ? tr('single_episode', namedArgs: { - "count": credits! + 'count': credits! .cast![index] .roles![0] .episodeCount! .toString() }) - : tr("multi_episode", + : tr('multi_episode', namedArgs: { - "count": credits! + 'count': credits! .cast![index] .roles![0] .episodeCount! @@ -2957,7 +3039,7 @@ class TVCastTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -2996,8 +3078,10 @@ class TVSeasonsTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchTVDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3019,7 +3103,7 @@ class TVSeasonsTabState extends State : tvDetails!.seasons!.isEmpty ? Center( child: Text( - tr("no_season_tv"), + tr('no_season_tv'), style: kTextSmallHeaderStyle, textAlign: TextAlign.center, ), @@ -3092,13 +3176,15 @@ class TVSeasonsTabState extends State 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvDetails! - .seasons![ - index] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvDetails! + .seasons![index] + .posterPath!, imageBuilder: (context, imageProvider) => Container( @@ -3147,7 +3233,7 @@ class TVSeasonsTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -3184,8 +3270,10 @@ class TVCrewTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3209,7 +3297,7 @@ class TVCrewTabState extends State : credits!.crew!.isEmpty ? Center( child: Text( - tr("no_cast_tv"), + tr('no_cast_tv'), style: kTextSmallHeaderStyle, textAlign: TextAlign.center, maxLines: 4, @@ -3271,12 +3359,14 @@ class TVCrewTabState extends State const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - credits! - .crew![index] - .profilePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + credits!.crew![index] + .profilePath!, imageBuilder: (context, imageProvider) => Container( @@ -3316,9 +3406,9 @@ class TVCrewTabState extends State ), Text(credits!.crew![index].department! .isEmpty - ? tr("job_empty") - : tr("job", namedArgs: { - "job": credits! + ? tr('job_empty') + : tr('job', namedArgs: { + 'job': credits! .crew![index].department! })), ], @@ -3327,7 +3417,7 @@ class TVCrewTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -3367,9 +3457,13 @@ class TVRecommendationsTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -3391,9 +3485,13 @@ class TVRecommendationsTabState extends State setState(() { isLoading = true; }); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false) + .tmdbProxy; + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -3426,7 +3524,7 @@ class TVRecommendationsTabState extends State const LeadingDot(), Expanded( child: Text( - tr("tv_recommendations"), + tr('tv_recommendations'), maxLines: 2, overflow: TextOverflow.ellipsis, style: kTextHeaderStyle, @@ -3445,7 +3543,7 @@ class TVRecommendationsTabState extends State ? scrollingMoviesAndTVShimmer(themeMode) : tvList!.isEmpty ? Text( - tr("no_recommendations_tv"), + tr('no_recommendations_tv'), textAlign: TextAlign.center, ) : Row( @@ -3468,7 +3566,7 @@ class TVRecommendationsTabState extends State ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -3506,9 +3604,13 @@ class SimilarTVTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -3530,9 +3632,13 @@ class SimilarTVTabState extends State setState(() { isLoading = true; }); -final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false) + .tmdbProxy; + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -3565,8 +3671,8 @@ final isProxyEnabled = Provider.of(context, listen: false).ena const LeadingDot(), Expanded( child: Text( - tr("tv_similar_with", - namedArgs: {"show": widget.tvName}), + tr('tv_similar_with', + namedArgs: {'show': widget.tvName}), maxLines: 2, overflow: TextOverflow.ellipsis, style: kTextHeaderStyle, @@ -3585,7 +3691,7 @@ final isProxyEnabled = Provider.of(context, listen: false).ena ? scrollingMoviesAndTVShimmer(themeMode) : tvList!.isEmpty ? Text( - tr("no_similars_tv"), + tr('no_similars_tv'), textAlign: TextAlign.center, ) : Row( @@ -3630,8 +3736,10 @@ class TVGenreDisplayState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchGenre(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3687,7 +3795,7 @@ class TVGenreDisplayState extends State // style: widget.themeData.textTheme.bodyText1, ), backgroundColor: - themeMode == "dark" || themeMode == "amoled" + themeMode == 'dark' || themeMode == 'amoled' ? const Color(0xFF2b2c30) : const Color(0xFFDFDEDE), ), @@ -3729,9 +3837,13 @@ class ParticularGenreTVState extends State { setState(() { isLoading = true; }); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false) + .tmdbProxy; + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -3748,9 +3860,13 @@ class ParticularGenreTVState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -3775,7 +3891,7 @@ class ParticularGenreTVState extends State { : tvList!.isEmpty ? Container( child: Center( - child: Text(tr("no_genre_tv")), + child: Text(tr('no_genre_tv')), ), ) : Container( @@ -3829,8 +3945,10 @@ class TVInfoTableState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchTVDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -3853,7 +3971,7 @@ class TVInfoTableState extends State { const LeadingDot(), Expanded( child: Text( - tr("tv_series_info"), + tr('tv_series_info'), style: kTextHeaderStyle, ), ), @@ -3869,7 +3987,7 @@ class TVInfoTableState extends State { : DataTable(dataRowMinHeight: 40, columns: [ DataColumn( label: Text( - tr("original_title"), + tr('original_title'), style: kTableLeftStyle, )), DataColumn( @@ -3881,29 +3999,29 @@ class TVInfoTableState extends State { ], rows: [ DataRow(cells: [ DataCell(Text( - tr("status"), + tr('status'), style: kTableLeftStyle, )), DataCell(Text(tvDetails!.status!.isEmpty - ? tr("unknown") + ? tr('unknown') : tvDetails!.status!)), ]), DataRow(cells: [ DataCell(Text( - tr("runtime"), + tr('runtime'), style: kTableLeftStyle, )), DataCell(Text(tvDetails!.runtime!.isEmpty ? '-' : tvDetails!.runtime![0] == 0 - ? tr("not_available") - : tr("runtime_mins", namedArgs: { - "mins": tvDetails!.runtime![0].toString() + ? tr('not_available') + : tr('runtime_mins', namedArgs: { + 'mins': tvDetails!.runtime![0].toString() }))), ]), DataRow(cells: [ DataCell(Text( - tr("spoken_language"), + tr('spoken_language'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -3921,7 +4039,7 @@ class TVInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(tvDetails! .spokenLanguages!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${tvDetails!.spokenLanguages![index].englishName},'), ); }, @@ -3930,7 +4048,7 @@ class TVInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("total_seasons"), + tr('total_seasons'), style: kTableLeftStyle, )), DataCell(Text(tvDetails!.numberOfSeasons! == 0 @@ -3939,7 +4057,7 @@ class TVInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("total_episodes"), + tr('total_episodes'), style: kTableLeftStyle, )), DataCell(Text(tvDetails!.numberOfEpisodes! == 0 @@ -3948,7 +4066,7 @@ class TVInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("tagline"), + tr('tagline'), style: kTableLeftStyle, )), DataCell( @@ -3963,7 +4081,7 @@ class TVInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("production_companies"), + tr('production_companies'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -3981,7 +4099,7 @@ class TVInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(tvDetails! .productionCompanies!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${tvDetails!.productionCompanies![index].name},'), ); }, @@ -3990,7 +4108,7 @@ class TVInfoTableState extends State { ]), DataRow(cells: [ DataCell(Text( - tr("production_countries"), + tr('production_countries'), style: kTableLeftStyle, )), DataCell(SizedBox( @@ -4008,7 +4126,7 @@ class TVInfoTableState extends State { const EdgeInsets.only(right: 5.0), child: Text(tvDetails! .productionCountries!.isEmpty - ? tr("not_available") + ? tr('not_available') : '${tvDetails!.productionCountries![index].name},'), ); }, @@ -4042,8 +4160,10 @@ class TVSocialLinksState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchSocialLinks(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4068,7 +4188,7 @@ class TVSocialLinksState extends State { const LeadingDot(), Expanded( child: Text( - tr("social_media_links"), + tr('social_media_links'), style: kTextHeaderStyle, ), ), @@ -4085,14 +4205,14 @@ class TVSocialLinksState extends State { externalLinks?.imdbId == null ? Center( child: Text( - tr("no_social_link_tv"), + tr('no_social_link_tv'), textAlign: TextAlign.center, ), ) : Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.transparent : const Color(0xFFDFDEDE), ), @@ -4176,8 +4296,10 @@ class SeasonsListState extends State { @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchTVDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4224,7 +4346,7 @@ class SeasonsListState extends State { : tvDetails!.seasons!.isEmpty ? Center( child: - Text(tr("no_season_tv"), textAlign: TextAlign.center), + Text(tr('no_season_tv'), textAlign: TextAlign.center), ) : Row( children: [ @@ -4282,13 +4404,15 @@ class SeasonsListState extends State { 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - tvDetails! - .seasons![ - index] - .posterPath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + tvDetails! + .seasons![index] + .posterPath!, imageBuilder: (context, imageProvider) => Container( @@ -4368,8 +4492,10 @@ class EpisodeListWidgetState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchTVDetails(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4402,7 +4528,7 @@ class EpisodeListWidgetState extends State const LeadingDot(), Expanded( child: Text( - tr("episodes"), + tr('episodes'), style: kTextHeaderStyle, ), ), @@ -4495,7 +4621,7 @@ class EpisodeListWidgetState extends State : tvDetails!.episodes!.isEmpty ? Center( child: - Text(tr("no_episodes"), style: kTextSmallHeaderStyle), + Text(tr('no_episodes'), style: kTextSmallHeaderStyle), ) : Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -4511,7 +4637,7 @@ class EpisodeListWidgetState extends State const LeadingDot(), Expanded( child: Text( - tr("episodes"), + tr('episodes'), style: kTextHeaderStyle, ), ), @@ -4591,7 +4717,11 @@ class EpisodeListWidgetState extends State 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvDetails! .episodes![ @@ -4628,8 +4758,8 @@ class EpisodeListWidgetState extends State Image.asset( 'assets/images/na_logo.png', fit: BoxFit.cover, - width: - double.infinity, + width: double + .infinity, ), ), ), @@ -4639,11 +4769,11 @@ class EpisodeListWidgetState extends State child: Container( color: Colors.black54, margin: const EdgeInsets - .only( + .only( left: 4, bottom: 4), padding: const EdgeInsets - .symmetric( + .symmetric( vertical: 0.7, horizontal: 6), child: Text( @@ -4681,13 +4811,13 @@ class EpisodeListWidgetState extends State .episodes![index] .airDate! .isEmpty - ? tr("air_date_unknown") + ? tr('air_date_unknown') : '${DateTime.parse(tvDetails!.episodes![index].airDate!).day} ${DateFormat("MMMM").format(DateTime.parse(tvDetails!.episodes![index].airDate!))}, ${DateTime.parse(tvDetails!.episodes![index].airDate!).year}', style: TextStyle( color: - themeMode == "dark" || + themeMode == 'dark' || themeMode == - "amoled" + 'amoled' ? Colors.white54 : Colors.black54, ), @@ -4754,9 +4884,12 @@ class _TVWatchProvidersDetailsState extends State void initState() { super.initState(); tabController = TabController(length: 5, vsync: this); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchWatchProviders(widget.api, widget.country, isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { watchProviders = value; @@ -4775,7 +4908,7 @@ class _TVWatchProvidersDetailsState extends State Container( width: double.infinity, decoration: BoxDecoration( - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? const Color(0xFF2b2c30) : const Color(0xFFDFDEDE), ), @@ -4789,42 +4922,42 @@ class _TVWatchProvidersDetailsState extends State indicatorSize: TabBarIndicatorSize.tab, tabs: [ Tab( - child: Text(tr("buy"), + child: Text(tr('buy'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("stream"), + child: Text(tr('stream'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("ads"), + child: Text(tr('ads'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("rent"), + child: Text(tr('rent'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), Tab( - child: Text(tr("free"), + child: Text(tr('free'), style: TextStyle( fontFamily: 'Poppins', - color: themeMode == "dark" || themeMode == "amoled" + color: themeMode == 'dark' || themeMode == 'amoled' ? Colors.white : Colors.black)), ), @@ -4847,23 +4980,27 @@ class _TVWatchProvidersDetailsState extends State watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_buy_tv"), - watchOptions: watchProviders!.buy, context: context), + noOptionMessage: tr('no_buy_tv'), + watchOptions: watchProviders!.buy, + context: context), watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_stream_tv"), - watchOptions: watchProviders!.flatRate, context: context), + noOptionMessage: tr('no_stream_tv'), + watchOptions: watchProviders!.flatRate, + context: context), watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_ads_tv"), - watchOptions: watchProviders!.ads, context: context), + noOptionMessage: tr('no_ads_tv'), + watchOptions: watchProviders!.ads, + context: context), watchProvidersTabData( themeMode: themeMode, imageQuality: imageQuality, - noOptionMessage: tr("no_rent_tv"), - watchOptions: watchProviders!.rent, context: context), + noOptionMessage: tr('no_rent_tv'), + watchOptions: watchProviders!.rent, + context: context), Container( padding: const EdgeInsets.all(8.0), child: GridView.builder( @@ -4900,7 +5037,7 @@ class _TVWatchProvidersDetailsState extends State Expanded( flex: 6, child: Text( - tr("cinemax"), + tr('cinemax'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -4934,8 +5071,10 @@ class TVGenreListGridState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchGenre(widget.api, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -4964,7 +5103,7 @@ class TVGenreListGridState extends State const LeadingDot(), Expanded( child: Text( - tr("genres"), + tr('genres'), style: kTextHeaderStyle, ), ), @@ -5007,7 +5146,7 @@ class TVGenreListGridState extends State borderRadius: BorderRadius.circular(15)), child: Text( - genreList![index].genreName ?? "Null", + genreList![index].genreName ?? 'Null', textAlign: TextAlign.center, style: TextStyle( color: Theme.of(context) @@ -5053,7 +5192,7 @@ class TVShowsFromWatchProvidersState extends State { const LeadingDot(), Expanded( child: Text( - tr("streaming_services"), + tr('streaming_services'), style: kTextHeaderStyle, ), ), @@ -5221,9 +5360,13 @@ class ParticularStreamingServiceTVShowsState setState(() { isLoading = true; }); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl) + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false) + .tmdbProxy; + fetchTV('${widget.api}&page=$pageNum&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) .then((value) { if (mounted) { setState(() { @@ -5240,9 +5383,13 @@ class ParticularStreamingServiceTVShowsState @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; - fetchTV('${widget.api}&include_adult=${widget.includeAdult}', isProxyEnabled, proxyUrl).then((value) { + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; + fetchTV('${widget.api}&include_adult=${widget.includeAdult}', + isProxyEnabled, proxyUrl) + .then((value) { if (mounted) { setState(() { tvList = value; @@ -5267,7 +5414,7 @@ class ParticularStreamingServiceTVShowsState : tvList!.isEmpty ? Container( child: Center( - child: Text(tr("no_watchprovider_tv")), + child: Text(tr('no_watchprovider_tv')), ), ) : Container( @@ -5321,8 +5468,10 @@ class TVEpisodeCastTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -5346,7 +5495,7 @@ class TVEpisodeCastTabState extends State : credits!.cast!.isEmpty ? Center( child: Text( - tr("no_cast"), + tr('no_cast'), style: kTextSmallHeaderStyle, textAlign: TextAlign.center, maxLines: 4, @@ -5408,12 +5557,14 @@ class TVEpisodeCastTabState extends State const Duration( milliseconds: 700), fadeInCurve: Curves.easeIn, - imageUrl: - buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + - imageQuality + - credits! - .cast![index] - .profilePath!, + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + + imageQuality + + credits!.cast![index] + .profilePath!, imageBuilder: (context, imageProvider) => Container( @@ -5453,9 +5604,9 @@ class TVEpisodeCastTabState extends State ), Text(credits!.cast![index].character! .isEmpty - ? tr("as_empty") - : tr("as", namedArgs: { - "character": credits! + ? tr('as_empty') + : tr('as', namedArgs: { + 'character': credits! .cast![index].character! })), // Text( @@ -5477,7 +5628,7 @@ class TVEpisodeCastTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -5510,8 +5661,10 @@ class TVEpisodeGuestStarsTabState extends State @override void initState() { super.initState(); - final isProxyEnabled = Provider.of(context, listen: false).enableProxy; - final proxyUrl = Provider.of(context, listen: false).tmdbProxy; + final isProxyEnabled = + Provider.of(context, listen: false).enableProxy; + final proxyUrl = + Provider.of(context, listen: false).tmdbProxy; fetchCredits(widget.api!, isProxyEnabled, proxyUrl).then((value) { if (mounted) { setState(() { @@ -5535,7 +5688,7 @@ class TVEpisodeGuestStarsTabState extends State : credits!.episodeGuestStars!.isEmpty ? Center( child: Text( - tr("no_guest_episode"), + tr('no_guest_episode'), style: kTextSmallHeaderStyle, textAlign: TextAlign.center, maxLines: 4, @@ -5604,7 +5757,11 @@ class TVEpisodeGuestStarsTabState extends State 700), fadeInCurve: Curves.easeIn, - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + credits! .episodeGuestStars![ @@ -5658,7 +5815,7 @@ class TVEpisodeGuestStarsTabState extends State ], ), Divider( - color: themeMode == "light" + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, @@ -5715,7 +5872,7 @@ class TVEpisodeGuestStarsTabState extends State ), ), Divider( - color: themeMode == "light" ? Colors.black54 : Colors.white54, + color: themeMode == 'light' ? Colors.black54 : Colors.white54, thickness: 1, endIndent: 20, indent: 10, @@ -5889,7 +6046,11 @@ class TVDetailQuickInfo extends StatelessWidget { 'assets/images/na_logo.png', fit: BoxFit.cover, ), - imageUrl: buildImageUrl(TMDB_BASE_IMAGE_URL, proxyUrl, isProxyEnabled, context) + + imageUrl: buildImageUrl( + TMDB_BASE_IMAGE_URL, + proxyUrl, + isProxyEnabled, + context) + imageQuality + tvSeries.posterPath!, ), @@ -5911,7 +6072,7 @@ class TVDetailQuickInfo extends StatelessWidget { // _utilityController.toggleTitleVisibility(); }, child: Text( - tvSeries.firstAirDate == "" + tvSeries.firstAirDate == '' ? tvSeries.name! : '${tvSeries.name!} (${DateTime.parse(tvSeries.firstAirDate!).year})', maxLines: 4, @@ -5997,7 +6158,7 @@ class _TVDetailOptionsState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("rating"), + tr('rating'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -6039,7 +6200,7 @@ class _TVDetailOptionsState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("total_ratings"), + tr('total_ratings'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -6126,7 +6287,7 @@ class _TVAboutState extends State { const LeadingDot(), Expanded( child: Text( - tr("overview"), + tr('overview'), style: kTextHeaderStyle, ), ), @@ -6140,15 +6301,15 @@ class _TVAboutState extends State { padding: const EdgeInsets.all(8.0), child: widget.tvSeries.overview!.isEmpty || widget.tvSeries.overview == null - ? Text(tr("no_overview_tv")) + ? Text(tr('no_overview_tv')) : ReadMoreText( widget.tvSeries.overview!, trimLines: 4, style: const TextStyle(fontFamily: 'Poppins'), colorClickableText: Theme.of(context).colorScheme.primary, trimMode: TrimMode.Line, - trimCollapsedText: tr("read_more"), - trimExpandedText: tr("read_less"), + trimCollapsedText: tr('read_more'), + trimExpandedText: tr('read_less'), lessStyle: TextStyle( fontSize: 14, color: Theme.of(context).colorScheme.primary, @@ -6168,7 +6329,7 @@ class _TVAboutState extends State { child: Text( widget.tvSeries.firstAirDate == null || widget.tvSeries.firstAirDate!.isEmpty - ? tr("first_episode_air_empty") + ? tr('first_episode_air_empty') : '${tr("first_episode_air")} ${DateTime.parse(widget.tvSeries.firstAirDate!).day} ${DateFormat("MMMM").format(DateTime.parse(widget.tvSeries.firstAirDate!))}, ${DateTime.parse(widget.tvSeries.firstAirDate!).year}', style: const TextStyle( fontFamily: 'PoppinsSB', @@ -6183,28 +6344,28 @@ class _TVAboutState extends State { ScrollingTVArtists( passedFrom: 'tv_detail', api: Endpoints.getTVCreditsUrl(widget.tvSeries.id!, lang), - title: tr("cast"), + title: tr('cast'), id: widget.tvSeries.id!, ), ScrollingTVCreators( api: Endpoints.tvDetailsUrl(widget.tvSeries.id!, lang), - title: tr("created_by"), + title: tr('created_by'), ), SeasonsList( tvId: widget.tvSeries.id!, seriesName: widget.tvSeries.name!, - title: tr("seasons"), + title: tr('seasons'), api: Endpoints.getTVSeasons(widget.tvSeries.id!, lang), ), TVImagesDisplay( - title: tr("images"), + title: tr('images'), api: Endpoints.getTVImages(widget.tvSeries.id!), name: widget.tvSeries.originalName, ), TVVideosDisplay( api: Endpoints.getTVVideos(widget.tvSeries.id!), api2: Endpoints.tvDetailsUrl(widget.tvSeries.id!, lang), - title: tr("videos"), + title: tr('videos'), ), TVSocialLinks( api: Endpoints.getExternalLinksForTV(widget.tvSeries.id!, lang), @@ -6279,7 +6440,7 @@ class _EpisodeAboutState extends State { const LeadingDot(), Expanded( child: Text( - tr("overview"), + tr('overview'), style: kTextHeaderStyle, ), ), @@ -6293,14 +6454,14 @@ class _EpisodeAboutState extends State { padding: const EdgeInsets.all(8.0), child: ReadMoreText( widget.episodeList.overview!.isEmpty - ? tr("no_episode_overview") + ? tr('no_episode_overview') : widget.episodeList.overview!, trimLines: 4, style: const TextStyle(fontFamily: 'Poppins'), colorClickableText: Theme.of(context).colorScheme.primary, trimMode: TrimMode.Line, - trimCollapsedText: tr("read_more"), - trimExpandedText: tr("read_less"), + trimCollapsedText: tr('read_more'), + trimExpandedText: tr('read_less'), lessStyle: TextStyle( fontSize: 14, color: Theme.of(context).colorScheme.primary, @@ -6319,7 +6480,7 @@ class _EpisodeAboutState extends State { child: Text( widget.episodeList.airDate == null || widget.episodeList.airDate!.isEmpty - ? tr("episode_air_empty") + ? tr('episode_air_empty') : '${tr("episode_air")} ${DateTime.parse(widget.episodeList.airDate!).day} ${DateFormat("MMMM").format(DateTime.parse(widget.episodeList.airDate!))}, ${DateTime.parse(widget.episodeList.airDate!).year}', style: const TextStyle( fontFamily: 'PoppinsSB', @@ -6353,7 +6514,7 @@ class _EpisodeAboutState extends State { lang), ), TVEpisodeImagesDisplay( - title: tr("images"), + title: tr('images'), name: '${widget.seriesName}_${widget.episodeList.name}', api: Endpoints.getTVEpisodeImagesUrl( widget.tvId!, @@ -6467,7 +6628,7 @@ class TVEpisodeQuickInfo extends StatelessWidget { alignment: appLang == 'ar' ? Alignment.topLeft : Alignment.topRight, - child: TopButton(buttonText: tr("open_season")), + child: TopButton(buttonText: tr('open_season')), ), ), ), @@ -6508,7 +6669,7 @@ class TVEpisodeQuickInfo extends StatelessWidget { episodeList.seasonNumber!)), Text( episodeList.airDate == null || - episodeList.airDate == "" + episodeList.airDate == '' ? episodeList.name! : episodeList.name!, style: kTextSmallHeaderStyle, @@ -6523,8 +6684,8 @@ class TVEpisodeQuickInfo extends StatelessWidget { seriesName!, style: TextStyle( fontSize: 15, - color: themeMode == "dark" || - themeMode == "amoled" + color: themeMode == 'dark' || + themeMode == 'amoled' ? Colors.white54 : Colors.black54), ), @@ -6582,7 +6743,7 @@ class TVEpisodeOptions extends StatelessWidget { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("rating"), + tr('rating'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -6624,7 +6785,7 @@ class TVEpisodeOptions extends StatelessWidget { child: Align( alignment: Alignment.centerLeft, child: Text( - tr("total_ratings"), + tr('total_ratings'), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, @@ -6710,12 +6871,15 @@ class _WatchNowButtonState extends State { if (mounted) { if (mounted) { await checkConnection().then((value) { + if (!context.mounted) { + return; + } value ? Navigator.push(context, MaterialPageRoute(builder: ((context) { return TVVideoLoader( download: false, - route: fetchRoute == "flixHQ" + route: fetchRoute == 'flixHQ' ? StreamRoute.flixHQ : StreamRoute.tmDB, metadata: TVStreamMetadata( @@ -6729,16 +6893,18 @@ class _WatchNowButtonState extends State { tvId: widget.tvId, airDate: widget.episode.airDate)); }))) - : GlobalMethods.showCustomScaffoldMessage( - SnackBar( - content: Text( - tr("check_connection"), - maxLines: 3, - style: kTextSmallBodyStyle, - ), - duration: const Duration(seconds: 3), - ), - context); + : context.mounted + ? GlobalMethods.showCustomScaffoldMessage( + SnackBar( + content: Text( + tr('check_connection'), + maxLines: 3, + style: kTextSmallBodyStyle, + ), + duration: const Duration(seconds: 3), + ), + context) + : {}; }); } } @@ -6755,7 +6921,7 @@ class _WatchNowButtonState extends State { color: Theme.of(context).colorScheme.onPrimary, ), const SizedBox(width: 6), - Text(tr("watch_now"), + Text(tr('watch_now'), style: TextStyle( color: Theme.of(context).colorScheme.onPrimary, )) diff --git a/pubspec.lock b/pubspec.lock index b7611d5..bd6e04e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: "2489c399d8b23a12704bd9e056e3df957c69ceec621f4fc8d69fa7cd5211d1f4" + sha256: "5fdcea390499dd26c808a3c662df5f4208d6bbc0643072eee94f1476249e2818" url: "https://pub.dev" source: hosted - version: "1.3.24" + version: "1.3.43" animated_text_kit: dependency: "direct main" description: @@ -92,10 +92,10 @@ packages: dependency: "direct main" description: name: carousel_slider - sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42" + sha256: "7b006ec356205054af5beaef62e2221160ea36b90fb70a35e4deacd49d0349ae" url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "5.0.0" characters: dependency: transitive description: @@ -124,26 +124,26 @@ packages: dependency: "direct main" description: name: cloud_firestore - sha256: f7488f2092c1b33d855ac4bdd46de9a3bb8029c4ea5caebb52dfaf812c90f0a4 + sha256: "55872d611344977cd8ca657a4fb8ebf9f58298b791a3f34d979982b09a17ce38" url: "https://pub.dev" source: hosted - version: "4.15.7" + version: "5.4.2" cloud_firestore_platform_interface: dependency: transitive description: name: cloud_firestore_platform_interface - sha256: adff62e6d3736d8c529a417487d81c5bec1be227e0c04ba95ef64364485aee09 + sha256: e9a095429f94ecb774302bac88e62a80f46047a532005bdd580b5addc19956e3 url: "https://pub.dev" source: hosted - version: "6.1.8" + version: "6.4.2" cloud_firestore_web: dependency: transitive description: name: cloud_firestore_web - sha256: "73efac045b40263001b9265a375b1bd4032945dc6b888698d8add927dc74b818" + sha256: "6caa18235bf2641ac9457e7620adf0e65d7469596af1e3b4db76481e2bb66166" url: "https://pub.dev" source: hosted - version: "3.10.7" + version: "4.3.1" collection: dependency: transitive description: @@ -164,10 +164,10 @@ packages: dependency: transitive description: name: cross_file - sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" url: "https://pub.dev" source: hosted - version: "0.3.3+8" + version: "0.3.4+2" crypto: dependency: transitive description: @@ -204,18 +204,18 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903 + sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 url: "https://pub.dev" source: hosted - version: "8.2.2" + version: "10.1.2" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" dio: dependency: "direct main" description: @@ -249,13 +249,13 @@ packages: source: hosted version: "0.0.2" fading_edge_scrollview: - dependency: transitive + dependency: "direct main" description: name: fading_edge_scrollview - sha256: c25c2231652ce774cc31824d0112f11f653881f43d7f5302c05af11942052031 + sha256: "1f84fe3ea8e251d00d5735e27502a6a250e4aa3d3b330d3fdcb475af741464ef" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.1.1" fake_async: dependency: transitive description: @@ -268,10 +268,10 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.3" file: dependency: transitive description: @@ -284,122 +284,122 @@ packages: dependency: "direct main" description: name: firebase_analytics - sha256: c7f243b336232d01f2f7913d937107bc3a147e2aefb3008dbe0a56d2cf134c3e + sha256: "9c52c099e9cbb852c7f1d2302c7eb34a15758834eca1877f7a779e6082f9882d" url: "https://pub.dev" source: hosted - version: "10.8.8" + version: "11.3.2" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - sha256: "2e68d302f566f2dec15b9d5a0c710c5d4c759a041aea5b33548785c198921541" + sha256: "4ec57aee951832fdbf10ca722bbb83fe0001d6168d6c4cfea9ccee0df6afb1e0" url: "https://pub.dev" source: hosted - version: "3.9.8" + version: "4.2.4" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - sha256: "5975aa69c58cc1f66597fc6e769b77b7cd8e3b32c6f9df6b36a496286399b510" + sha256: "95c594fb1e8960992a607b135459e2f9ea3683dd8d01e6b845cace7c6665ec7e" url: "https://pub.dev" source: hosted - version: "0.5.5+20" + version: "0.5.10+1" firebase_auth: dependency: "direct main" description: name: firebase_auth - sha256: "8ca05d45c47451586b753e7e9040378e87cdd72220a73d3a343600dd7b138181" + sha256: "16b0b70e837539b27d4cec059b5169eaf116af9deca896b923e9f84d83af9cc6" url: "https://pub.dev" source: hosted - version: "4.17.7" + version: "5.3.0" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface - sha256: "9214148dde687d07f8e593d3b95f17fc2282167a98c04765115a1c3119837a5f" + sha256: f1f32cdba3f5620082c63d18545dd58dde8f5ffc66caa43feb9b9fe57e93d4b6 url: "https://pub.dev" source: hosted - version: "7.1.7" + version: "7.4.6" firebase_auth_web: dependency: transitive description: name: firebase_auth_web - sha256: "287e858f1fe8a62a4a7b99a47800713f98d41bef24548095e7165f65b4e0e78d" + sha256: "5731d0e51ef7aa93f9c421798b92b6961411c15c18adaff939a3c9f84e8e456b" url: "https://pub.dev" source: hosted - version: "5.9.7" + version: "5.13.1" firebase_core: dependency: "direct main" description: name: firebase_core - sha256: a746f861618eef57a11d8b658a2db1fa5a336fc82ba65b7763d7e2292687de2b + sha256: c7de9354eb2cd8bfe8059e1112174c9a58beda7051807207306bc48283277cfb url: "https://pub.dev" source: hosted - version: "2.26.0" + version: "3.5.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.3.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492 + sha256: f967a7138f5d2ffb1ce15950e2a382924239eaa521150a8f144af34e68b3b3e5 url: "https://pub.dev" source: hosted - version: "2.11.5" + version: "2.18.1" firebase_messaging: dependency: "direct main" description: name: firebase_messaging - sha256: d6a0abd7cc6e95235819962703670b54a2729b0ef5ff5a44ef51a9ac2cb44a30 + sha256: "32ce60b747e755b48d7112d728d4f736ba82acd98ec825626558d444d385fa3a" url: "https://pub.dev" source: hosted - version: "14.7.18" + version: "15.1.2" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface - sha256: "1109a16b69c3b4653f5dc266b1ac0a00f53c82a2ab13dd92ce58cfcd1038b6e3" + sha256: "69671a0f1a40c7b7c46ad0283e6f34ca2a59a0362ca14a240a4ea01c46e8a521" url: "https://pub.dev" source: hosted - version: "4.5.26" + version: "4.5.45" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web - sha256: fb46f47c860be8268023b92faacfea6a4ed74e7197836dc19e7a272854903610 + sha256: "6890111a9d01d7b13d0f6fe74850812c334e903d2c80a2d9356a3abb8c3a9e9a" url: "https://pub.dev" source: hosted - version: "3.6.7" + version: "3.9.1" firebase_remote_config: dependency: "direct main" description: name: firebase_remote_config - sha256: "1f3012f7d336421272e19ef6964a38dd54320c063174e0b6e8d32667f856de49" + sha256: "0c13662ce9cb8a5b78ae67d3d775bc2690bffb0fd040f6735f2c9d13cf989693" url: "https://pub.dev" source: hosted - version: "4.3.16" + version: "5.1.2" firebase_remote_config_platform_interface: dependency: transitive description: name: firebase_remote_config_platform_interface - sha256: c6c43f29008d347a2356be36a38acb5eaae990d8d2c703b472ca99bd138986d3 + sha256: "1748d672c9d9f460b11ec17e10c6afd844a95e26c83ed8cb99c3227511f5038e" url: "https://pub.dev" source: hosted - version: "1.4.24" + version: "1.4.43" firebase_remote_config_web: dependency: transitive description: name: firebase_remote_config_web - sha256: "0b8064533ade7baf3946f08a9310259a4d2a62a69272e7a5bbdcef8dfac78702" + sha256: "2d036ed39a7cbb5e42a4b019c62c1a05ea7327142751553a0c3fa915f5a567db" url: "https://pub.dev" source: hosted - version: "1.4.24" + version: "1.7.1" fixnum: dependency: transitive description: @@ -425,10 +425,10 @@ packages: dependency: "direct main" description: name: flutter_colorpicker - sha256: "458a6ed8ea480eb16ff892aedb4b7092b2804affd7e046591fb03127e8d8ef8b" + sha256: "969de5f6f9e2a570ac660fb7b501551451ea2a1ab9e2097e89475f60e07816ea" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.1.0" flutter_dotenv: dependency: "direct main" description: @@ -465,26 +465,26 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: "293995f94e120c8afce768981bd1fa9c5d6de67c547568e3b42ae2defdcbb4a0" + sha256: "49eeef364fddb71515bc78d5a8c51435a68bccd6e4d68e25a942c5e47761ae71" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "17.2.3" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - sha256: ccb08b93703aeedb58856e5637450bf3ffec899adb66dc325630b68994734b89 + sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af url: "https://pub.dev" source: hosted - version: "3.0.0+1" + version: "4.0.1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "5ec1feac5f7f7d9266759488bc5f76416152baba9aa1b26fe572246caa00d1ab" + sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "7.2.0" flutter_localization: dependency: "direct main" description: @@ -680,10 +680,10 @@ packages: dependency: "direct main" description: name: mixpanel_flutter - sha256: "5dc993ade5eaad51ebb6c91230971a3443ac30a3d1d24399bc3db74c5705d400" + sha256: "7ecd7169acfbda58d9afb35cc4fab8db57410b5f26907206e53d72a86955eb8e" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.2" native_device_orientation: dependency: "direct main" description: @@ -716,6 +716,22 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 + url: "https://pub.dev" + source: hosted + version: "8.0.2" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66 + url: "https://pub.dev" + source: hosted + version: "3.0.1" path: dependency: transitive description: @@ -1016,10 +1032,10 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" + sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.1" shared_preferences_windows: dependency: transitive description: @@ -1197,10 +1213,10 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.3.3" url_launcher_windows: dependency: transitive description: @@ -1241,62 +1257,46 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.4" - wakelock: + wakelock_plus: dependency: transitive description: - name: wakelock - sha256: "769ecf42eb2d07128407b50cb93d7c10bd2ee48f0276ef0119db1d25cc2f87db" + name: wakelock_plus + sha256: bf4ee6f17a2fa373ed3753ad0e602b7603f8c75af006d5b9bdade263928c0484 url: "https://pub.dev" source: hosted - version: "0.6.2" - wakelock_macos: + version: "1.2.8" + wakelock_plus_platform_interface: dependency: transitive description: - name: wakelock_macos - sha256: "047c6be2f88cb6b76d02553bca5a3a3b95323b15d30867eca53a19a0a319d4cd" + name: wakelock_plus_platform_interface + sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16" url: "https://pub.dev" source: hosted - version: "0.4.0" - wakelock_platform_interface: - dependency: transitive - description: - name: wakelock_platform_interface - sha256: "1f4aeb81fb592b863da83d2d0f7b8196067451e4df91046c26b54a403f9de621" - url: "https://pub.dev" - source: hosted - version: "0.3.0" - wakelock_web: - dependency: transitive - description: - name: wakelock_web - sha256: "1b256b811ee3f0834888efddfe03da8d18d0819317f20f6193e2922b41a501b5" - url: "https://pub.dev" - source: hosted - version: "0.4.0" - wakelock_windows: - dependency: transitive - description: - name: wakelock_windows - sha256: "857f77b3fe6ae82dd045455baa626bc4b93cb9bb6c86bf3f27c182167c3a5567" - url: "https://pub.dev" - source: hosted - version: "0.2.1" + version: "1.2.1" web: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "1.0.0" win32: dependency: transitive description: name: win32 - sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4 + sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "5.5.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "723b7f851e5724c55409bb3d5a32b203b3afe8587eaf5dafb93a5fed8ecda0d6" + url: "https://pub.dev" + source: hosted + version: "1.1.4" xdg_directories: dependency: transitive description: @@ -1322,5 +1322,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.4.0 <3.22.3" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index a2ec071..749d202 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,70 +3,68 @@ description: A Flutter movie app. publish_to: "none" -version: 2.7.0+7 +version: 2.7.1+7 environment: sdk: ">=2.12.0 <3.0.0" dependencies: + animated_text_kit: ^4.2.1 + better_player: + # git: + # url: https://github.com/BeamlakAschalew/flixquest-betterplayer.git + path: ../flixquest-betterplayer + cached_network_image: ^3.2.1 + carousel_slider: ^5.0.0 + clipboard: ^0.1.3 + cloud_firestore: ^5.4.2 + cupertino_icons: ^1.0.2 + device_info_plus: ^10.1.2 + dio: ^4.0.6 + dynamic_color: ^1.5.4 + easy_localization: ^3.0.2 + fading_edge_scrollview: ^4.1.1 + firebase_analytics: ^11.3.2 + firebase_auth: ^5.3.0 + firebase_core: ^3.5.0 + firebase_messaging: ^15.1.2 + firebase_remote_config: ^5.1.2 flutter: sdk: flutter - cupertino_icons: ^1.0.2 - carousel_slider: ^4.0.0 + flutter_cache_manager: ^3.3.0 + flutter_colorpicker: ^1.0.3 + flutter_dotenv: ^5.1.0 + flutter_download_manager: ^0.5.4 + flutter_downloader: ^1.8.3+2 + flutter_local_notifications: ^17.2.3 + flutter_localization: ^0.1.13 + flutter_svg: ^1.1.5 + font_awesome_flutter: ^10.5.0 + google_nav_bar: ^5.0.6 http: ^0.13.4 intl: ^0.19.0 - url_launcher: ^6.0.18 - #flutter_inappwebview: ^5.3.2 - shimmer: ^2.0.0 - readmore: ^2.1.0 + mixpanel_flutter: ^2.3.2 + native_device_orientation: ^1.1.4 + open_file_plus: ^3.3.0 + path_provider: ^2.1.2 + percent_indicator: ^4.2.2 + permission_handler: ^11.0.1 photo_view: ^0.14.0 - font_awesome_flutter: ^10.5.0 + provider: ^6.0.3 + readmore: ^2.1.0 + retry: ^3.1.0 share_plus: ^4.0.7 share_plus_web: ^3.0.0 - firebase_analytics: ^10.4.3 - firebase_core: ^2.14.0 - mixpanel_flutter: ^2.0.0 - animated_text_kit: ^4.2.1 shared_preferences: ^2.0.15 - cached_network_image: ^3.2.1 - google_nav_bar: ^5.0.6 - firebase_messaging: ^14.6.4 - provider: ^6.0.3 - permission_handler: ^11.0.1 - flutter_downloader: ^1.8.3+2 - dio: ^4.0.6 - #web_scraper: ^0.1.4 - flutter_svg: ^1.1.5 - flutter_download_manager: ^0.5.4 - open_file_plus: ^3.3.0 - path_provider: ^2.1.2 - dynamic_color: ^1.5.4 - #webview_flutter: ^3.0.4 - percent_indicator: ^4.2.2 + shimmer: ^2.0.0 sqflite: ^2.2.2 - firebase_auth: ^4.6.3 - cloud_firestore: ^4.8.2 - retry: ^3.1.0 - device_info_plus: ^8.1.0 - native_device_orientation: ^1.1.4 - better_player: - path: ../flixquest-betterplayer - flutter_cache_manager: ^3.3.0 - flutter_localization: ^0.1.13 - easy_localization: ^3.0.2 - flutter_colorpicker: ^1.0.3 - firebase_remote_config: ^4.2.5 - flutter_dotenv: ^5.1.0 - #unity_ads_plugin: ^0.3.8 - #modal_bottom_sheet: ^2.1.2 - flutter_local_notifications: ^13.0.0 - clipboard: ^0.1.3 + url_launcher: ^6.0.18 dev_dependencies: - flutter_test: - sdk: flutter flutter_lints: ^2.0.1 flutter_native_splash: ^2.2.10+1 + flutter_test: + sdk: flutter flutter: uses-material-design: true