diff --git a/lib/env.dart b/lib/env.dart index 110375e37..d5eb07d4f 100644 --- a/lib/env.dart +++ b/lib/env.dart @@ -1,23 +1,23 @@ +import 'package:envied/envied.dart'; import 'package:flutter/foundation.dart'; -import 'package:flutter_envify/flutter_envify.dart'; part 'env.g.dart'; class Env { - static const androidAppCenterKey = CommonEnv.androidAppCenterKey; - static const androidPurchasesKey = CommonEnv.androidPurchasesKey; + static const String androidAppCenterKey = CommonEnv.androidAppCenterKey; + static const String androidPurchasesKey = CommonEnv.androidPurchasesKey; - static const iosPurchasesKey = CommonEnv.iosPurchasesKey; - static const iosAppCenterKey = CommonEnv.iosAppCenterKey; + static const String iosPurchasesKey = CommonEnv.iosPurchasesKey; + static const String iosAppCenterKey = CommonEnv.iosAppCenterKey; - static const macosAppCenterKey = CommonEnv.macosAppCenterKey; + static const String macosAppCenterKey = CommonEnv.macosAppCenterKey; - static const commonHeaderName = CommonEnv.commonHeaderName; - static const apiHeaderName = CommonEnv.apiHeaderName; + static const String commonHeaderName = CommonEnv.commonHeaderName; + static const String apiHeaderName = CommonEnv.apiHeaderName; - static const publicKey = CommonEnv.publicKey; - static const privateKey = CommonEnv.privateKey; - static const letsEncryptKey = CommonEnv.letsEncryptKey; + static const String publicKey = CommonEnv.publicKey; + static const String privateKey = CommonEnv.privateKey; + static const String letsEncryptKey = CommonEnv.letsEncryptKey; static const bool isReleaseMode = kReleaseMode; @@ -28,33 +28,53 @@ class Env { static const String apiHeaderValue = isReleaseMode ? ProdEnv.apiHeaderValue : DevEnv.apiHeaderValue; } -@Envify(path: '.env.dev') +@Envied(path: '.env.dev', name: 'DevEnv') abstract class DevEnv { - static const apiBaseUrl = _DevEnv.apiBaseUrl; - static const assetsBaseUrl = _DevEnv.assetsBaseUrl; - static const apiHeaderValue = _DevEnv.apiHeaderValue; -} + @EnviedField(varName: 'API_BASE_URL') + static const String apiBaseUrl = _DevEnv.apiBaseUrl; -@Envify(path: '.env.prod') -abstract class ProdEnv { - static const apiBaseUrl = _ProdEnv.apiBaseUrl; - static const assetsBaseUrl = _ProdEnv.assetsBaseUrl; - static const apiHeaderValue = _ProdEnv.apiHeaderValue; + @EnviedField(varName: 'ASSETS_BASE_URL') + static const String assetsBaseUrl = _DevEnv.assetsBaseUrl; + + @EnviedField(varName: 'API_HEADER_VALUE') + static const String apiHeaderValue = _DevEnv.apiHeaderValue; } -@Envify(path: '.env.common') -abstract class CommonEnv { - static const androidAppCenterKey = _CommonEnv.androidAppCenterKey; - static const iosAppCenterKey = _CommonEnv.iosAppCenterKey; - static const macosAppCenterKey = _CommonEnv.macosAppCenterKey; +@Envied(path: '.env.prod', name: 'ProdEnv') +abstract class ProdEnv { + @EnviedField(varName: 'API_BASE_URL') + static const String apiBaseUrl = _ProdEnv.apiBaseUrl; - static const androidPurchasesKey = _CommonEnv.androidPurchasesKey; - static const iosPurchasesKey = _CommonEnv.iosPurchasesKey; + @EnviedField(varName: 'ASSETS_BASE_URL') + static const String assetsBaseUrl = _ProdEnv.assetsBaseUrl; - static const commonHeaderName = _CommonEnv.commonHeaderName; - static const apiHeaderName = _CommonEnv.apiHeaderName; + @EnviedField(varName: 'API_HEADER_VALUE') + static const String apiHeaderValue = _ProdEnv.apiHeaderValue; +} - static const publicKey = _CommonEnv.publicKey; - static const privateKey = _CommonEnv.privateKey; - static const letsEncryptKey = _CommonEnv.letsEncryptKey; +@Envied(path: '.env.common', name: 'CommonEnv') +abstract class CommonEnv { + @EnviedField(varName: 'ANDROID_APP_CENTER_KEY') + static const String androidAppCenterKey = _CommonEnv.androidAppCenterKey; + @EnviedField(varName: 'IOS_APP_CENTER_KEY') + static const String iosAppCenterKey = _CommonEnv.iosAppCenterKey; + @EnviedField(varName: 'MACOS_APP_CENTER_KEY') + static const String macosAppCenterKey = _CommonEnv.macosAppCenterKey; + + @EnviedField(varName: 'ANDROID_PURCHASES_KEY') + static const String androidPurchasesKey = _CommonEnv.androidPurchasesKey; + @EnviedField(varName: 'IOS_PURCHASES_KEY') + static const String iosPurchasesKey = _CommonEnv.iosPurchasesKey; + + @EnviedField(varName: 'COMMON_HEADER_NAME') + static const String commonHeaderName = _CommonEnv.commonHeaderName; + @EnviedField(varName: 'API_HEADER_NAME') + static const String apiHeaderName = _CommonEnv.apiHeaderName; + + @EnviedField(varName: 'PUBLIC_KEY') + static const String publicKey = _CommonEnv.publicKey; + @EnviedField(varName: 'PRIVATE_KEY') + static const String privateKey = _CommonEnv.privateKey; + @EnviedField(varName: 'LETS_ENCRYPT_KEY') + static const String letsEncryptKey = _CommonEnv.letsEncryptKey; } diff --git a/lib/infrastructure/device_info_service.dart b/lib/infrastructure/device_info_service.dart index a7679f302..3f816a338 100644 --- a/lib/infrastructure/device_info_service.dart +++ b/lib/infrastructure/device_info_service.dart @@ -90,8 +90,8 @@ class DeviceInfoServiceImpl implements DeviceInfoService { Future _initForIOs() async { final deviceInfo = DeviceInfoPlugin(); final info = await deviceInfo.iosInfo; - final model = 'Model: ${info.model ?? na} --- Name: ${info.name ?? na}'; - final osVersion = '${info.systemName ?? na} : ${info.systemVersion ?? na}'; + final model = 'Model: ${info.model} --- Name: ${info.name}'; + final osVersion = '${info.systemName} : ${info.systemVersion}'; _setDefaultDeviceInfoProps(model, osVersion); _setOtherDeviceInfoProps(info.isPhysicalDevice); } diff --git a/lib/infrastructure/logging_service.dart b/lib/infrastructure/logging_service.dart index 08c745812..07729d045 100644 --- a/lib/infrastructure/logging_service.dart +++ b/lib/infrastructure/logging_service.dart @@ -44,7 +44,7 @@ class LoggingServiceImpl implements LoggingService { void warning(Type type, String msg, [dynamic ex, StackTrace? trace]) { assert(!msg.isNullEmptyOrWhitespace); final tag = type.toString(); - _logger.w('$tag - ${_formatEx(msg, ex)}', ex, trace); + _logger.w('$tag - ${_formatEx(msg, ex)}', error: ex, stackTrace: trace); if (kReleaseMode) { _trackWarningOrError(tag, msg, ex, trace); @@ -55,7 +55,7 @@ class LoggingServiceImpl implements LoggingService { void error(Type type, String msg, [dynamic ex, StackTrace? trace]) { assert(!msg.isNullEmptyOrWhitespace); final tag = type.toString(); - _logger.e('$tag - ${_formatEx(msg, ex)}', ex, trace); + _logger.e('$tag - ${_formatEx(msg, ex)}', error: ex, stackTrace: trace); if (kReleaseMode) { _trackWarningOrError(tag, msg, ex, trace, true); diff --git a/lib/presentation/characters/widgets/character_card.dart b/lib/presentation/characters/widgets/character_card.dart index 30d4db63f..8d09dfe0c 100644 --- a/lib/presentation/characters/widgets/character_card.dart +++ b/lib/presentation/characters/widgets/character_card.dart @@ -77,7 +77,6 @@ class CharacterCard extends StatelessWidget { shape: Styles.mainCardShape, elevation: Styles.cardTenElevation, color: elementType.getElementColorFromContext(context), - shadowColor: Colors.transparent, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/presentation/charts/charts_page.dart b/lib/presentation/charts/charts_page.dart index be27512c1..37da2d5ed 100644 --- a/lib/presentation/charts/charts_page.dart +++ b/lib/presentation/charts/charts_page.dart @@ -27,6 +27,7 @@ import 'package:shiori/presentation/shared/extensions/i18n_extensions.dart'; import 'package:shiori/presentation/shared/loading.dart'; import 'package:shiori/presentation/shared/mixins/app_fab_mixin.dart'; import 'package:shiori/presentation/shared/nothing_found_column.dart'; +import 'package:shiori/presentation/shared/shiori_icons.dart'; import 'package:shiori/presentation/shared/styles.dart'; import 'package:shiori/presentation/weapon/weapon_page.dart'; @@ -625,21 +626,26 @@ class _AscensionStats extends StatelessWidget { maxNumberOfColumns: maxNumberOfColumns, ), ), - direction: Axis.vertical, borderRadius: BorderRadius.circular(10), - constraints: const BoxConstraints(minHeight: 25, maxHeight: 25), + constraints: const BoxConstraints(minHeight: 36, maxHeight: 36), isSelected: [ state.itemType == ItemType.character, state.itemType == ItemType.weapon, ], children: [ - Container( - margin: Styles.edgeInsetHorizontal16, - child: Text(s.characters), + Tooltip( + message: s.characters, + child: Container( + margin: Styles.edgeInsetHorizontal16, + child: const Icon(Icons.people), + ), ), - Container( - margin: Styles.edgeInsetHorizontal16, - child: Text(s.weapons), + Tooltip( + message: s.weapons, + child: Container( + margin: Styles.edgeInsetHorizontal16, + child: const Icon(Shiori.crossed_swords), + ), ), ], ), diff --git a/lib/presentation/charts/widgets/horizontal_bar_chart.dart b/lib/presentation/charts/widgets/horizontal_bar_chart.dart index 7ebeb744b..67ee63e2e 100644 --- a/lib/presentation/charts/widgets/horizontal_bar_chart.dart +++ b/lib/presentation/charts/widgets/horizontal_bar_chart.dart @@ -72,19 +72,18 @@ class HorizontalBarChart extends StatelessWidget { maxX: maxX, maxY: maxY, lineTouchData: LineTouchData( - handleBuiltInTouches: true, touchCallback: (event, response) { if (event is FlTapUpEvent && response?.lineBarSpots != null && response!.lineBarSpots!.isNotEmpty) { onPointTap?.call(response.lineBarSpots!.first.x); } }, touchTooltipData: LineTouchTooltipData( - tooltipBgColor: toolTipBgColor ?? theme.backgroundColor, + tooltipBgColor: toolTipBgColor ?? theme.colorScheme.background, fitInsideHorizontally: true, - getTooltipItems: getTooltipItems, + getTooltipItems: getTooltipItems ?? defaultLineTooltipItem, ), ), - gridData: FlGridData(show: false), + gridData: const FlGridData(show: false), titlesData: FlTitlesData( bottomTitles: AxisTitles( sideTitles: SideTitles( @@ -94,8 +93,8 @@ class HorizontalBarChart extends StatelessWidget { getTitlesWidget: (value, meta) => _BottomTitle(getBottomText: getBottomText, bottomTextMaxLength: bottomTextMaxLength, value: value), ), ), - rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), - topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + rightTitles: const AxisTitles(), + topTitles: const AxisTitles(), leftTitles: AxisTitles( sideTitles: SideTitles( getTitlesWidget: (value, meta) => _LeftTitle(getLeftText: getLeftText, leftTextMaxLength: leftTextMaxLength, value: value), @@ -109,12 +108,10 @@ class HorizontalBarChart extends StatelessWidget { lineBarsData: items .map( (e) => LineChartBarData( - isCurved: false, color: e.color, barWidth: barWidth, isStrokeCapRound: true, - dotData: FlDotData(show: true), - belowBarData: BarAreaData(show: false), + belowBarData: BarAreaData(), spots: e.points.map((e) { if (!canValueBeRendered(e.x)) { return FlSpot.nullSpot; diff --git a/lib/presentation/shared/extensions/app_theme_type_extensions.dart b/lib/presentation/shared/extensions/app_theme_type_extensions.dart index a8b345d01..c38a1a7ba 100644 --- a/lib/presentation/shared/extensions/app_theme_type_extensions.dart +++ b/lib/presentation/shared/extensions/app_theme_type_extensions.dart @@ -47,8 +47,6 @@ extension AppThemeTypeExtensions on AppAccentColorType { primary: color, secondary: color, primaryContainer: color, - primaryVariant: color, - secondaryVariant: color, ); final dark = ThemeData.dark().copyWith( primaryColor: color, @@ -82,8 +80,6 @@ extension AppThemeTypeExtensions on AppAccentColorType { primary: color, secondary: color, primaryContainer: color, - primaryVariant: color, - secondaryVariant: color, ), ); default: diff --git a/lib/presentation/shared/gradient_card.dart b/lib/presentation/shared/gradient_card.dart index a51a6880c..90bb7d0db 100644 --- a/lib/presentation/shared/gradient_card.dart +++ b/lib/presentation/shared/gradient_card.dart @@ -10,7 +10,6 @@ class GradientCard extends StatelessWidget { final Widget? child; final LinearGradient gradient; final double? elevation; - final Color? shadowColor; const GradientCard({ super.key, @@ -20,7 +19,6 @@ class GradientCard extends StatelessWidget { this.clipBehavior = Clip.none, this.child, this.elevation, - this.shadowColor, this.semanticContainer = true, }); @@ -32,7 +30,6 @@ class GradientCard extends StatelessWidget { child: Material( type: MaterialType.card, color: Colors.transparent, - shadowColor: shadowColor ?? Colors.transparent, elevation: elevation ?? 0, shape: shape ?? const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), clipBehavior: clipBehavior, diff --git a/lib/presentation/splash/splash_page.dart b/lib/presentation/splash/splash_page.dart index 1a2646446..c0acd4826 100644 --- a/lib/presentation/splash/splash_page.dart +++ b/lib/presentation/splash/splash_page.dart @@ -9,7 +9,7 @@ import 'package:shiori/injection.dart'; import 'package:shiori/presentation/shared/dialogs/confirm_dialog.dart'; import 'package:shiori/presentation/shared/extensions/app_theme_type_extensions.dart'; import 'package:shiori/presentation/shared/styles.dart'; -import 'package:wakelock/wakelock.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; class SplashPage extends StatelessWidget { final LanguageModel language; @@ -111,12 +111,12 @@ class SplashPage extends StatelessWidget { } void _initMain(AppResourceUpdateResultType result, BuildContext context) { - Wakelock.disable(); + WakelockPlus.disable(); context.read().add(MainEvent.init(updateResultType: result)); } void _applyUpdate(CheckForUpdatesResult result, BuildContext context) { - Wakelock.enable(); + WakelockPlus.enable(); context.read().add(SplashEvent.applyUpdate(result: result)); } } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index b21848186..39d448b6a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -15,7 +15,7 @@ import purchases_flutter import share_plus import shared_preferences_foundation import url_launcher_macos -import wakelock_macos +import wakelock_plus import window_size func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { @@ -29,6 +29,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin")) }