diff --git a/apps/mobile_app/lib/core/init_app.dart b/apps/mobile_app/lib/core/init_app.dart index 2401c8f7..bd55b153 100644 --- a/apps/mobile_app/lib/core/init_app.dart +++ b/apps/mobile_app/lib/core/init_app.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/date_symbol_data_local.dart'; import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:sca_treezor/sca_treezor.dart'; import 'package:sf_app_platform/config/env/environment_enum.dart'; import 'package:sf_app_platform/config/env/save_family_env_config.dart'; @@ -16,12 +17,15 @@ import 'package:sf_app_platform/save_family_app.dart'; import 'package:navigation/navigation.dart'; import 'package:sf_infrastructure/sf_infrastructure.dart'; import 'package:sf_tracking/sf_tracking.dart'; +import 'package:shared_preferences/shared_preferences.dart'; Future initApp(EnvironmentEnum env) async { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); await initializeDateFormatting(); + final sharedPreferences = await SharedPreferences.getInstance(); + navigationModule(); scaTreezorModule(); themePackages(); @@ -52,5 +56,12 @@ Future initApp(EnvironmentEnum env) async { }, ); - runApp(const ProviderScope(child: SaveFamilyApp())); + runApp( + ProviderScope( + overrides: [ + sharedPreferencesProvider.overrideWithValue(sharedPreferences), + ], + child: const SaveFamilyApp(), + ), + ); } diff --git a/apps/mobile_app/lib/navigation/app_router.dart b/apps/mobile_app/lib/navigation/app_router.dart index 0a0a7f78..6af328b0 100644 --- a/apps/mobile_app/lib/navigation/app_router.dart +++ b/apps/mobile_app/lib/navigation/app_router.dart @@ -250,6 +250,11 @@ void configureAppRouter() { name: 'settings', pageBuilder: SettingsBuilder().buildPage, routes: [ + GoRoute( + path: 'appearance', + name: 'appearance', + pageBuilder: AppearanceBuilder().buildPage, + ), GoRoute( path: 'alarm', name: 'alarm', diff --git a/apps/mobile_app/lib/save_family_app.dart b/apps/mobile_app/lib/save_family_app.dart index cb4a216d..48b62448 100644 --- a/apps/mobile_app/lib/save_family_app.dart +++ b/apps/mobile_app/lib/save_family_app.dart @@ -3,6 +3,7 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:sf_app_platform/core/app_version_check/app_update_gate.dart'; import 'package:sf_app_platform/core/app_version_check/app_version_check.dart'; import 'package:sf_app_platform/core/config/app_mode.dart'; @@ -130,13 +131,32 @@ class SaveFamilyAppState extends ConsumerState SizeUtils.init(context: context); ref.watch(pushTokenRefreshListenerProvider); + // Theme wiring: + // - Legacy mode: new `legacy_theme` package (Material 3 + light/dark/system). + // - Payment mode: unchanged behaviour (seed-based ColorScheme, light only). + final ThemeData lightTheme; + final ThemeData? darkTheme; + final ThemeMode themeMode; + if (isLegacyMode) { + final legacyThemeState = ref.watch(legacyThemeNotifierProvider); + lightTheme = LegacyAppTheme.light; + darkTheme = LegacyAppTheme.dark; + themeMode = legacyThemeState.themeMode; + } else { + lightTheme = ThemeData( + fontFamily: AppFonts.stolzl, + colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF329E95)), + ); + darkTheme = null; + themeMode = ThemeMode.light; + } + return AppUpdateGate( child: MaterialApp.router( title: 'SaveFamily', - theme: ThemeData( - fontFamily: AppFonts.stolzl, - colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF329E95)), - ), + theme: lightTheme, + darkTheme: darkTheme, + themeMode: themeMode, routerConfig: appRouter, debugShowCheckedModeBanner: false, localizationsDelegates: [ diff --git a/apps/mobile_app/pubspec.yaml b/apps/mobile_app/pubspec.yaml index fade1815..db7e1e00 100644 --- a/apps/mobile_app/pubspec.yaml +++ b/apps/mobile_app/pubspec.yaml @@ -68,6 +68,8 @@ dependencies: path: ../../modules/legacy/modules/legacy_auth settings: path: ../../modules/legacy/modules/settings + legacy_theme: + path: ../../modules/legacy/packages/legacy_theme #packages dependencies go here navigation: path: ../../packages/navigation diff --git a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart index a73c2c53..1162f04b 100644 --- a/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/account_settings/presentation/account_settings_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/account_settings/presentation/state/account_settings_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -20,8 +21,7 @@ class AccountSettingsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final color = theme.getColorFor(ThemeCode.legacyPrimary); + final color = context.sfColors.legacyPrimary; final selectedDevice = ref.watch(selectedDeviceProvider).value; final isLoggingOut = ref.watch( accountSettingsViewModelProvider.select((s) => s.isLoggingOut), @@ -37,7 +37,6 @@ class AccountSettingsScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.accountSettings), body: SingleChildScrollView( child: Padding( @@ -130,7 +129,7 @@ class AccountSettingsScreen extends ConsumerWidget { ), child: PrimaryButton( text: context.translate(I18n.logOut), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, leading: isLoggingOut ? const SizedBox( height: 18, diff --git a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart index cb41b7c7..32ec1df1 100644 --- a/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/app_users/presentation/app_users_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/app_users/presentation/state/app_users_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -18,10 +19,8 @@ class AppUsersScreen extends ConsumerWidget { final vm = ref.read(appUsersViewModelProvider.notifier); final state = ref.watch(appUsersViewModelProvider); - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, showEdit: true, onEditChange: vm.toggleIsEditing, title: context.translate(I18n.appUsers), @@ -44,7 +43,7 @@ class AppUsersScreen extends ConsumerWidget { ? PrimaryButton( onPressed: vm.toggleIsEditing, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 44, big: 42), ) : null, @@ -60,7 +59,6 @@ class AppUserCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -71,20 +69,20 @@ class AppUserCard extends ConsumerWidget { borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 18)), ), - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, ), child: Row( children: [ Container( decoration: BoxDecoration( shape: BoxShape.circle, - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, ), padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)), child: Icon( SFIcons.account, size: SizeUtils.getByScreen(small: 40, big: 44), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), ), @@ -121,7 +119,7 @@ class AppUserCard extends ConsumerWidget { if (isEditing) ...[ DecoratedBox( decoration: BoxDecoration( - color: Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, borderRadius: BorderRadius.all(Radius.circular(12)), ), child: IconButton( @@ -166,9 +164,7 @@ class AppUserCard extends ConsumerWidget { Navigator.pop(context); }, text: context.translate(I18n.cancel), - color: theme.getColorFor( - ThemeCode.legacyPrimary, - ), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen( small: 38, big: 36, @@ -191,9 +187,7 @@ class AppUserCard extends ConsumerWidget { Navigator.pop(context); }, text: context.translate(I18n.delete), - color: theme.getColorFor( - ThemeCode.legacyPrimary, - ), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen( small: 38, big: 36, diff --git a/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart index e4b0b717..eb76dd75 100644 --- a/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/change_password/presentation/change_password_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/change_password/presentation/state/change_password_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -14,13 +15,11 @@ class ChangePasswordScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final password = ref.watch( changePasswordViewModelProvider.select((s) => s.newPassword), ); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.changePassword), body: Container( padding: SizeUtils.getByScreen( @@ -151,7 +150,7 @@ class _CriteriaRow extends StatelessWidget { color = Colors.green; icon = Icons.check_circle; } else { - color = Colors.red.shade400; + color = Theme.of(context).colorScheme.error; icon = Icons.cancel; } @@ -181,8 +180,8 @@ class _ErrorMessageSection extends ConsumerWidget { Text( errorMessage, textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -201,7 +200,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(changePasswordViewModelProvider.notifier); @@ -232,7 +230,7 @@ class _SaveSection extends ConsumerWidget { } }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart index 782ee70d..32785a9e 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/delete_account_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/delete_account/presentation/state/delete_account_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:account/src/features/delete_account/presentation/widgets/confirm_dialog.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; @@ -15,10 +16,8 @@ class DeleteAccountScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.deleteAccount), body: SingleChildScrollView( child: Container( @@ -42,10 +41,9 @@ class _Header extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return Container( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, width: double.infinity, padding: SizeUtils.getByScreen( small: EdgeInsets.symmetric(vertical: 20), @@ -86,7 +84,6 @@ class _BodySection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return Column( children: [ @@ -100,7 +97,7 @@ class _BodySection extends ConsumerWidget { textAlign: TextAlign.start, style: TextStyle( fontSize: 12, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ], @@ -115,7 +112,6 @@ class _RequestCancelSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final isLoading = ref.watch( deleteAccountViewModelProvider.select((s) => s.isLoading), @@ -146,7 +142,7 @@ class _RequestCancelSection extends ConsumerWidget { ); }, text: context.translate(I18n.requestCancelButton), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart index 6578b940..001a8a96 100644 --- a/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart +++ b/modules/legacy/modules/account/lib/src/features/delete_account/presentation/widgets/confirm_dialog.dart @@ -6,6 +6,7 @@ import 'package:navigation/app_routes.dart'; import 'package:navigation/navigation_contract.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class ConfirmDialog extends ConsumerWidget { final NavigationContract navigationContract; @@ -14,21 +15,18 @@ class ConfirmDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(deleteAccountViewModelProvider); final viewModel = ref.read(deleteAccountViewModelProvider.notifier); final steps = [ _VerifyAccountStep( - theme: theme, email: state.loggedUser!.email, passwordController: viewModel.passwordController, errorMessage: state.errorMessage, nextStep: viewModel.nextStep, ), _ConfirmRequestStep( - theme: theme, toggleDeleteDevice: viewModel.toggleDeleteDevice, deviceNames: state.deviceNames, onCancel: () { @@ -58,14 +56,12 @@ class _VerifyAccountStep extends StatelessWidget { final TextEditingController passwordController; final String errorMessage; final VoidCallback nextStep; - final ThemePort theme; const _VerifyAccountStep({ required this.email, required this.passwordController, required this.errorMessage, required this.nextStep, - required this.theme, }); @override @@ -125,7 +121,7 @@ class _VerifyAccountStep extends StatelessWidget { Navigator.pop(context); }, text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: 40, radius: 20, ), @@ -135,7 +131,7 @@ class _VerifyAccountStep extends StatelessWidget { child: PrimaryButton( onPressed: nextStep, text: context.translate(I18n.accept), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: 40, radius: 20, ), @@ -149,14 +145,12 @@ class _VerifyAccountStep extends StatelessWidget { } class _ConfirmRequestStep extends StatelessWidget { - final ThemePort theme; final Function toggleDeleteDevice; final List deviceNames; final VoidCallback onCancel; final VoidCallback onSubmit; const _ConfirmRequestStep({ - required this.theme, required this.toggleDeleteDevice, required this.deviceNames, required this.onCancel, @@ -221,7 +215,7 @@ class _ConfirmRequestStep extends StatelessWidget { child: SecondaryButton( onPressed: onCancel, text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: 50, radius: 25, ), @@ -231,7 +225,7 @@ class _ConfirmRequestStep extends StatelessWidget { child: PrimaryButton( onPressed: onSubmit, text: context.translate(I18n.confirm), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: 50, radius: 25, ), diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart index 681feca1..a3d75234 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/edit_linked_device_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -12,7 +13,6 @@ class EditLinkedDeviceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(linkedDevicesViewModelProvider.notifier); final device = ref.watch( @@ -20,7 +20,6 @@ class EditLinkedDeviceScreen extends ConsumerWidget { ); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.editDeviceTitle), showEdit: true, onEditChange: vm.toggleIsEditing, @@ -104,7 +103,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(linkedDevicesViewModelProvider.notifier); @@ -128,7 +126,7 @@ class _SaveSection extends ConsumerWidget { } }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart index ab694981..6ef701e8 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/linked_devices_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart'; import 'package:account/src/features/linked_devices/presentation/widgets/delete_device_dialog.dart'; import 'package:design_system/design_system.dart'; @@ -20,10 +21,8 @@ class LinkedDevicesScreen extends ConsumerWidget { final vm = ref.read(linkedDevicesViewModelProvider.notifier); final state = ref.watch(linkedDevicesViewModelProvider); - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.linkedDevices), showEdit: true, onEditChange: vm.toggleIsEditing, @@ -66,7 +65,6 @@ class _LinkedDeviceCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(linkedDevicesViewModelProvider.notifier); @@ -79,20 +77,20 @@ class _LinkedDeviceCard extends ConsumerWidget { borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 18)), ), - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, ), child: Row( children: [ Container( decoration: BoxDecoration( shape: BoxShape.circle, - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, ), padding: EdgeInsets.all(SizeUtils.getByScreen(small: 8, big: 12)), child: Icon( SFIcons.watch, size: SizeUtils.getByScreen(small: 40, big: 44), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), ), @@ -120,7 +118,7 @@ class _LinkedDeviceCard extends ConsumerWidget { if (isEditing) ...[ DecoratedBox( decoration: BoxDecoration( - color: Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, borderRadius: BorderRadius.all(Radius.circular(12)), ), child: IconButton( @@ -141,7 +139,7 @@ class _LinkedDeviceCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), DecoratedBox( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, borderRadius: BorderRadius.all(Radius.circular(12)), ), child: IconButton( diff --git a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/widgets/delete_device_dialog.dart b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/widgets/delete_device_dialog.dart index af363a88..27ea5f5a 100644 --- a/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/widgets/delete_device_dialog.dart +++ b/modules/legacy/modules/account/lib/src/features/linked_devices/presentation/widgets/delete_device_dialog.dart @@ -6,6 +6,7 @@ import 'package:navigation/navigation.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:sf_shared/sf_shared.dart'; import 'package:utils/utils.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class DeleteDeviceDialog extends ConsumerWidget { final NavigationContract navigationContract; @@ -19,7 +20,6 @@ class DeleteDeviceDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(linkedDevicesViewModelProvider.notifier); @@ -49,7 +49,7 @@ class DeleteDeviceDialog extends ConsumerWidget { Navigator.pop(context); }, text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -82,7 +82,7 @@ class DeleteDeviceDialog extends ConsumerWidget { } }, text: context.translate(I18n.delete), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), diff --git a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart index 2ce24f78..d8f0c69d 100644 --- a/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart +++ b/modules/legacy/modules/account/lib/src/features/personal_data/presentation/personal_data_screen.dart @@ -1,4 +1,5 @@ import 'package:account/src/features/personal_data/presentation/state/personal_data_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -12,7 +13,6 @@ class PersonalDataScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final isLoading = ref.watch( personalDataViewModelProvider.select((s) => s.isLoading), ); @@ -39,13 +39,12 @@ class PersonalDataScreen extends ConsumerWidget { if (isLoading) { return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: const Center(child: CircularProgressIndicator()), ); } return LegacyPageLayout( - theme: theme, title: context.translate(I18n.personalData), body: Padding( padding: SizeUtils.getByScreen( @@ -204,7 +203,6 @@ class _SaveButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(personalDataViewModelProvider.notifier); return Padding( @@ -212,7 +210,7 @@ class _SaveButton extends ConsumerWidget { child: PrimaryButton( onPressed: vm.updateUser, text: context.translate(I18n.submit), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/account/pubspec.yaml b/modules/legacy/modules/account/pubspec.yaml index b3a56828..3e494b05 100644 --- a/modules/legacy/modules/account/pubspec.yaml +++ b/modules/legacy/modules/account/pubspec.yaml @@ -29,6 +29,8 @@ dependencies: legacy_auth: path: ../../modules/legacy_auth #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme sf_tracking: path: ../../../../packages/sf_tracking design_system: diff --git a/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/alerts_screen.dart b/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/alerts_screen.dart index cb9b3f39..8e712ce2 100644 --- a/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/alerts_screen.dart +++ b/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/alerts_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:navigation/navigation.dart'; @@ -15,8 +16,7 @@ class AlertsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final vm = ref.read(alertsViewModelProvider.notifier); final (isLoading, selectedType) = ref.watch( alertsViewModelProvider.select((s) => (s.isLoading, s.selectedType)), @@ -33,9 +33,9 @@ class AlertsScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -83,8 +83,7 @@ class _FilterChips extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final filters = [ (null, context.translate(I18n.alertsFilterAll)), @@ -163,7 +162,6 @@ class _AlertsListState extends ConsumerState<_AlertsList> { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); final (alerts, isLoadingMore) = ref.watch( alertsViewModelProvider.select((s) => (s.alerts, s.isLoadingMore)), ); @@ -175,7 +173,7 @@ class _AlertsListState extends ConsumerState<_AlertsList> { children: [ Icon( Icons.notifications_none, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: SizeUtils.getByScreen(small: 80, big: 90), ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 18)), diff --git a/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/widgets/alert_card.dart b/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/widgets/alert_card.dart index 320444c6..0287317f 100644 --- a/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/widgets/alert_card.dart +++ b/modules/legacy/modules/control_panel/lib/src/features/alerts/presentation/widgets/alert_card.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -13,8 +13,7 @@ class AlertCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Padding( padding: EdgeInsets.only( @@ -26,7 +25,7 @@ class AlertCard extends ConsumerWidget { vertical: SizeUtils.getByScreen(small: 12, big: 10), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 12, big: 10), ), @@ -37,12 +36,12 @@ class AlertCard extends ConsumerWidget { width: SizeUtils.getByScreen(small: 40, big: 36), height: SizeUtils.getByScreen(small: 40, big: 36), decoration: BoxDecoration( - color: _alertColor(alert.type).withValues(alpha: 0.15), + color: _alertColor(context, alert.type).withValues(alpha: 0.15), borderRadius: BorderRadius.circular(10), ), child: Icon( _alertIcon(alert.type), - color: _alertColor(alert.type), + color: _alertColor(context, alert.type), size: SizeUtils.getByScreen(small: 22, big: 20), ), ), @@ -56,7 +55,7 @@ class AlertCard extends ConsumerWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: 2), @@ -66,8 +65,7 @@ class AlertCard extends ConsumerWidget { : alert.deviceIdentificator, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.6), ), ), @@ -88,8 +86,7 @@ class AlertCard extends ConsumerWidget { _timeAgo(context, alert.createdAt), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4), ), ), @@ -116,16 +113,16 @@ class AlertCard extends ConsumerWidget { }; } - Color _alertColor(String type) { + Color _alertColor(BuildContext context, String type) { return switch (type) { - 'sos' => Colors.red, - 'falldown' => Colors.red.shade700, + 'sos' => Theme.of(context).colorScheme.error, + 'falldown' => Theme.of(context).colorScheme.error, 'lowBattery' => Colors.orange, 'disconnect' => Colors.grey, 'reconnected' => Colors.green, 'braceletRemoved' => Colors.deepOrange, 'standstill' => Colors.amber, - 'abnormalHeartRate' => Colors.red.shade400, + 'abnormalHeartRate' => Theme.of(context).colorScheme.error, 'geofenceIn' => Colors.blue, 'geofenceOut' => Colors.indigo, 'movement' => Colors.teal, diff --git a/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/control_panel_screen.dart b/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/control_panel_screen.dart index dd3d9976..fbe7d0cf 100644 --- a/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/control_panel_screen.dart +++ b/modules/legacy/modules/control_panel/lib/src/features/control_panel/presentation/control_panel_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter_svg/svg.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_device_state/legacy_device_state.dart'; import 'package:control_panel/src/shared/widgets/device_map.dart'; import 'package:design_system/design_system.dart'; @@ -18,7 +19,6 @@ class ControlPanelScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final asyncState = ref.watch(legacyDeviceViewModelProvider); ref.listen( @@ -37,7 +37,7 @@ class ControlPanelScreen extends ConsumerWidget { ); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: asyncState.when( skipLoadingOnReload: true, loading: () => const Center(child: CircularProgressIndicator()), @@ -61,7 +61,7 @@ class ControlPanelScreen extends ConsumerWidget { SizedBox(height: SizeUtils.getByScreen(small: 12, big: 14)), Expanded( child: RefreshIndicator( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, onRefresh: () async { ref.invalidate(legacyDevicesProvider); await ref.read(legacyDeviceViewModelProvider.future); @@ -231,14 +231,13 @@ class _SectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return SectionButton( onPressed: onPressed, icon: Icon( icon, size: SizeUtils.getByScreen(small: 40, big: 44), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), iconPadding: SizeUtils.getByScreen(small: 14, big: 12), @@ -264,7 +263,6 @@ class _MapSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(legacyDeviceViewModelProvider.notifier); return GestureDetector( @@ -280,7 +278,7 @@ class _MapSection extends ConsumerWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 20, big: 19), fontWeight: FontWeight.bold, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), IconButton( @@ -298,7 +296,7 @@ class _MapSection extends ConsumerWidget { }, icon: Icon( Icons.refresh, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ], diff --git a/modules/legacy/modules/control_panel/lib/src/shared/widgets/device_map.dart b/modules/legacy/modules/control_panel/lib/src/shared/widgets/device_map.dart index 2c9bf5e2..b415305e 100644 --- a/modules/legacy/modules/control_panel/lib/src/shared/widgets/device_map.dart +++ b/modules/legacy/modules/control_panel/lib/src/shared/widgets/device_map.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -56,9 +56,7 @@ class _DeviceMapState extends ConsumerState { @override Widget build(BuildContext context) { final mapStyle = ref.watch(mapStyleProvider); - final primaryColor = ref - .read(themePortProvider) - .getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final initialCenter = widget.selectedPosition != null ? LatLng( widget.selectedPosition!.latitude, @@ -114,8 +112,7 @@ class LocationBanner extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final batteryValue = device?.battery ?? 0; final batteryIcon = toBatteryIcon(batteryValue); final dateText = formatPositionDate(position.positionDate); @@ -146,7 +143,7 @@ class LocationBanner extends ConsumerWidget { vertical: isCompact ? 6 : 10, ), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(isCompact ? 10 : 16), boxShadow: [ BoxShadow( @@ -189,7 +186,7 @@ class LocationBanner extends ConsumerWidget { style: TextStyle( fontSize: isCompact ? 12 : 14, fontWeight: FontWeight.w600, - color: Colors.grey.shade800, + color: Theme.of(context).colorScheme.onSurface, ), overflow: TextOverflow.ellipsis, ), @@ -202,7 +199,7 @@ class LocationBanner extends ConsumerWidget { addressText, style: TextStyle( fontSize: isCompact ? 9 : 11, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), overflow: TextOverflow.ellipsis, ), @@ -242,7 +239,7 @@ class LocationBanner extends ConsumerWidget { dateText, style: TextStyle( fontSize: 10, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, ), ), ), diff --git a/modules/legacy/modules/control_panel/pubspec.yaml b/modules/legacy/modules/control_panel/pubspec.yaml index bfa59bc6..e6b7cc51 100644 --- a/modules/legacy/modules/control_panel/pubspec.yaml +++ b/modules/legacy/modules/control_panel/pubspec.yaml @@ -36,6 +36,8 @@ dependencies: legacy_dashboard_shell: path: ../../modules/legacy_dashboard_shell #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme sf_tracking: path: ../../../../packages/sf_tracking design_system: diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart index 88eee53d..bfd1945e 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/contact_screen.dart @@ -14,12 +14,10 @@ class ContactScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(contactViewModelProvider.notifier); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.contactTitle), body: Padding( padding: EdgeInsets.symmetric( @@ -175,8 +173,8 @@ class _ErrorMessageSection extends ConsumerWidget { Text( viewState.errorMessage, textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -195,7 +193,6 @@ class _SendSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -205,7 +202,7 @@ class _SendSection extends ConsumerWidget { child: PrimaryButton( onPressed: onSend, text: context.translate(I18n.sendEmail), - color: theme.getColorFor(ThemeCode.buttonPrimary), + color: Theme.of(context).colorScheme.primary, ), ); } diff --git a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart index c5943964..168349ba 100644 --- a/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart +++ b/modules/legacy/modules/customer_service/lib/src/presentation/customer_service_screen.dart @@ -1,4 +1,5 @@ import 'package:customer_service/src/presentation/contact_screen.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -15,10 +16,8 @@ class CustomerServiceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.customerService), body: Container( padding: SizeUtils.getByScreen( @@ -61,7 +60,7 @@ class CustomerServiceScreen extends ConsumerWidget { icon: Icon( SFIcons.handshake, size: SizeUtils.getByScreen(small: 44, big: 48), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), body: Text( @@ -87,7 +86,7 @@ class CustomerServiceScreen extends ConsumerWidget { icon: Icon( Icons.email_outlined, size: SizeUtils.getByScreen(small: 44, big: 48), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), body: Text( diff --git a/modules/legacy/modules/customer_service/pubspec.yaml b/modules/legacy/modules/customer_service/pubspec.yaml index 65def90a..8981c45a 100644 --- a/modules/legacy/modules/customer_service/pubspec.yaml +++ b/modules/legacy/modules/customer_service/pubspec.yaml @@ -28,6 +28,8 @@ dependencies: #modules dependencies go here #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme sf_tracking: path: ../../../../packages/sf_tracking design_system: diff --git a/modules/legacy/modules/device_management/lib/src/core/presentation/widgets/time_range_selector.dart b/modules/legacy/modules/device_management/lib/src/core/presentation/widgets/time_range_selector.dart index fcf8ecde..5e3ddf6f 100644 --- a/modules/legacy/modules/device_management/lib/src/core/presentation/widgets/time_range_selector.dart +++ b/modules/legacy/modules/device_management/lib/src/core/presentation/widgets/time_range_selector.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -9,14 +9,12 @@ class TimeRangeSelector extends StatelessWidget { final TimeRange selected; final ValueChanged onSelected; final VoidCallback onCustomTap; - final ThemePort theme; const TimeRangeSelector({ super.key, required this.selected, required this.onSelected, required this.onCustomTap, - required this.theme, }); @override @@ -47,7 +45,6 @@ class TimeRangeSelector extends StatelessWidget { label: label, isSelected: selected == range, onTap: isCustom ? onCustomTap : () => onSelected(range), - theme: theme, ), ); }).toList(), @@ -60,13 +57,11 @@ class _Chip extends StatelessWidget { final String label; final bool isSelected; final VoidCallback onTap; - final ThemePort theme; const _Chip({ required this.label, required this.isSelected, required this.onTap, - required this.theme, }); @override @@ -80,8 +75,8 @@ class _Chip extends StatelessWidget { ), decoration: BoxDecoration( color: isSelected - ? theme.getColorFor(ThemeCode.legacyPrimary) - : theme.getColorFor(ThemeCode.backgroundSecondary), + ? context.sfColors.legacyPrimary + : Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 20, big: 18)), ), @@ -93,9 +88,9 @@ class _Chip extends StatelessWidget { fontWeight: FontWeight.w600, color: isSelected ? Colors.white - : theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.6), + : Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.6), ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart index eb587661..6aef2b3b 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/activity_meter_screen.dart @@ -23,7 +23,6 @@ class ActivityMeterScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final isLoading = ref.watch( activityMeterViewModelProvider.select((s) => s.isLoading), ); @@ -46,7 +45,6 @@ class ActivityMeterScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.activityMeter), body: isLoading ? const Center(child: CircularProgressIndicator()) @@ -77,7 +75,6 @@ class _ActivityMeterBody extends ConsumerWidget { selected: timeRange, onSelected: vm.selectTimeRange, onCustomTap: () => _pickCustomRange(context, vm), - theme: ref.watch(themePortProvider), ), const _ActivitySection(), if (timeRange != TimeRange.today) const _HistorySection(), @@ -108,7 +105,6 @@ class _TodaySection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final (todayTotal, dailyGoal) = ref.watch( activityMeterViewModelProvider.select( (s) => (s.todayTotal, s.dailyGoal), @@ -117,7 +113,7 @@ class _TodaySection extends ConsumerWidget { return Column( children: [ - StepsProgressRing(steps: todayTotal, goal: dailyGoal, theme: theme), + StepsProgressRing(steps: todayTotal, goal: dailyGoal), if (todayTotal == 0) Padding( padding: EdgeInsets.symmetric( @@ -129,8 +125,7 @@ class _TodaySection extends ConsumerWidget { textAlign: TextAlign.center, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -178,7 +173,6 @@ class _ActivitySection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final (timeRange, hourly, daily, stats, activeHours, hasData) = ref.watch( activityMeterViewModelProvider.select( (s) => ( @@ -205,8 +199,7 @@ class _ActivitySection extends ConsumerWidget { textAlign: TextAlign.center, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -235,7 +228,6 @@ class _HistorySection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(activityMeterViewModelProvider.notifier); final (history, dailyGoal, hasMore, isLoadingMore) = ref.watch( activityMeterViewModelProvider.select( @@ -257,7 +249,6 @@ class _HistorySection extends ConsumerWidget { hasMore: hasMore, isLoadingMore: isLoadingMore, onLoadMore: vm.loadMoreHistory, - theme: theme, ), ], ); diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_bar_chart_base.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_bar_chart_base.dart index 3a29abd9..9f21a3f2 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_bar_chart_base.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_bar_chart_base.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -22,7 +21,6 @@ class ActivityBarChartBase extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final height = SizeUtils.getByScreen(small: 180, big: 160); if (isEmpty) { @@ -33,8 +31,7 @@ class ActivityBarChartBase extends ConsumerWidget { '—', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 16, big: 14), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.3), ), ), @@ -42,8 +39,7 @@ class ActivityBarChartBase extends ConsumerWidget { ); } - final labelColor = theme - .getColorFor(ThemeCode.textPrimary) + final labelColor = Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4); return Padding( @@ -61,8 +57,7 @@ class ActivityBarChartBase extends ConsumerWidget { drawVerticalLine: false, horizontalInterval: _computeInterval(maxY), getDrawingHorizontalLine: (_) => FlLine( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.08), strokeWidth: 1, ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_footers.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_footers.dart index b34bfd08..7a127a83 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_footers.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/activity_footers.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -16,7 +15,6 @@ class TodayActivityFooter extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Padding( padding: EdgeInsets.symmetric( horizontal: SizeUtils.getByScreen(small: 16, big: 14), @@ -28,8 +26,7 @@ class TodayActivityFooter extends ConsumerWidget { .replaceAll('{hours}', activeHours.toString()), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.6), ), ), @@ -44,7 +41,6 @@ class PeriodActivityFooter extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final best = stats.bestDay; return Column( @@ -63,8 +59,7 @@ class PeriodActivityFooter extends ConsumerWidget { .replaceAll('{steps}', formatStepsNumber(best.totalSteps)), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.6), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/hourly_bar_chart.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/hourly_bar_chart.dart index c9c10bf8..83b14e6b 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/hourly_bar_chart.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/hourly_bar_chart.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -14,14 +14,12 @@ class HourlyBarChart extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final isEmpty = data.isEmpty || data.every((h) => h.totalSteps == 0); final maxY = isEmpty ? 0.0 : data.map((h) => h.totalSteps.toDouble()).reduce((a, b) => a > b ? a : b); - final labelColor = theme - .getColorFor(ThemeCode.textPrimary) + final labelColor = Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4); return ActivityBarChartBase( @@ -34,7 +32,7 @@ class HourlyBarChart extends ConsumerWidget { barRods: [ ActivityBarChartBase.buildRod( toY: bucket.totalSteps.toDouble(), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, width: SizeUtils.getByScreen(small: 6, big: 5), ), ], @@ -62,13 +60,13 @@ class HourlyBarChart extends ConsumerWidget { ), tooltip: BarTouchTooltipData( getTooltipColor: (_) => - theme.getColorFor(ThemeCode.backgroundSecondary), + Theme.of(context).colorScheme.surfaceContainer, getTooltipItem: (group, _, rod, __) => BarTooltipItem( '${group.x.toString().padLeft(2, '0')}h\n${rod.toY.toInt()}', TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/pedometer_toggle.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/pedometer_toggle.dart index be092f0b..0f77afec 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/pedometer_toggle.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/pedometer_toggle.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -13,7 +14,6 @@ class PedometerToggle extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final enabled = ref.watch( selectedDeviceProvider.select( (d) => d.value?.settings.pedometer ?? false, @@ -37,7 +37,7 @@ class PedometerToggle extends ConsumerWidget { ), Switch.adaptive( value: enabled, - activeTrackColor: theme.getColorFor(ThemeCode.legacyPrimary), + activeTrackColor: context.sfColors.legacyPrimary, onChanged: (value) async { if (!await guardDeviceCommand(context, ref)) return; final success = await ref diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/period_stats_cards.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/period_stats_cards.dart index 9470fda1..c03cf022 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/period_stats_cards.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/period_stats_cards.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -68,7 +67,6 @@ class _StatCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Container( padding: EdgeInsets.symmetric( @@ -76,7 +74,7 @@ class _StatCard extends ConsumerWidget { vertical: SizeUtils.getByScreen(small: 12, big: 10), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 10)), ), @@ -90,8 +88,7 @@ class _StatCard extends ConsumerWidget { fontSize: SizeUtils.getByScreen(small: 10, big: 9), fontWeight: FontWeight.w600, letterSpacing: 0.5, - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -101,7 +98,7 @@ class _StatCard extends ConsumerWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 16), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 2, big: 1)), @@ -109,8 +106,7 @@ class _StatCard extends ConsumerWidget { unit, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 10, big: 9), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/section_header.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/section_header.dart index 7434c4af..1932580c 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/section_header.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/section_header.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:utils/utils.dart'; @@ -11,7 +11,6 @@ class SectionHeader extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Padding( padding: EdgeInsets.only( @@ -29,7 +28,7 @@ class SectionHeader extends ConsumerWidget { fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w700, letterSpacing: 1.2, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), if (subtitle != null) ...[ @@ -38,8 +37,7 @@ class SectionHeader extends ConsumerWidget { subtitle!, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_bar_chart.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_bar_chart.dart index eb186c47..7e0a3edf 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_bar_chart.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_bar_chart.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -15,15 +15,13 @@ class StepsBarChart extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final isEmpty = data.isEmpty; final maxY = isEmpty ? 0.0 : data.map((d) => d.totalSteps.toDouble()).reduce((a, b) => a > b ? a : b); final locale = Localizations.localeOf(context).toString(); - final labelColor = theme - .getColorFor(ThemeCode.textPrimary) + final labelColor = Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4); return ActivityBarChartBase( @@ -35,7 +33,7 @@ class StepsBarChart extends ConsumerWidget { barRods: [ ActivityBarChartBase.buildRod( toY: entry.value.totalSteps.toDouble(), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, width: _barWidth(data.length), ), ], @@ -61,13 +59,13 @@ class StepsBarChart extends ConsumerWidget { ), tooltip: BarTouchTooltipData( getTooltipColor: (_) => - theme.getColorFor(ThemeCode.backgroundSecondary), + Theme.of(context).colorScheme.surfaceContainer, getTooltipItem: (group, _, rod, __) => BarTooltipItem( '${DateFormat('d MMM y', locale).format(data[group.x].date)}\n${rod.toY.toInt()}', TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_history_section.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_history_section.dart index 43b54d0d..d424b2c1 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_history_section.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_history_section.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -13,7 +13,6 @@ class StepsHistorySection extends StatelessWidget { final bool hasMore; final bool isLoadingMore; final VoidCallback onLoadMore; - final ThemePort theme; const StepsHistorySection({ super.key, @@ -22,7 +21,6 @@ class StepsHistorySection extends StatelessWidget { required this.hasMore, required this.isLoadingMore, required this.onLoadMore, - required this.theme, }); @override @@ -39,16 +37,13 @@ class StepsHistorySection extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), ...items.map( - (day) => _StepsHistoryTile( - dailySteps: day, - dailyGoal: dailyGoal, - theme: theme, - ), + (day) => + _StepsHistoryTile(dailySteps: day, dailyGoal: dailyGoal), ), if (hasMore) Padding( @@ -61,7 +56,7 @@ class StepsHistorySection extends StatelessWidget { child: Text( context.translate(I18n.loadMore), style: TextStyle( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, fontWeight: FontWeight.w600, ), ), @@ -76,13 +71,8 @@ class StepsHistorySection extends StatelessWidget { class _StepsHistoryTile extends StatelessWidget { final DailySteps dailySteps; final int dailyGoal; - final ThemePort theme; - const _StepsHistoryTile({ - required this.dailySteps, - required this.dailyGoal, - required this.theme, - }); + const _StepsHistoryTile({required this.dailySteps, required this.dailyGoal}); @override Widget build(BuildContext context) { @@ -100,7 +90,7 @@ class _StepsHistoryTile extends StatelessWidget { child: Container( padding: EdgeInsets.all(SizeUtils.getByScreen(small: 14, big: 12)), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 10)), ), @@ -114,9 +104,9 @@ class _StepsHistoryTile extends StatelessWidget { formatDayHeader(context, dailySteps.date), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.6), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.6), ), ), Row( @@ -126,7 +116,7 @@ class _StepsHistoryTile extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 16, big: 14), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), if (goalReached) ...[ @@ -152,11 +142,11 @@ class _StepsHistoryTile extends StatelessWidget { child: LinearProgressIndicator( value: progress, minHeight: SizeUtils.getByScreen(small: 6, big: 5), - backgroundColor: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.1), + backgroundColor: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.1), valueColor: AlwaysStoppedAnimation( - theme.getColorFor(ThemeCode.legacyPrimary), + context.sfColors.legacyPrimary, ), ), ), @@ -167,9 +157,9 @@ class _StepsHistoryTile extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.5), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.5), ), ), ], diff --git a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_progress_ring.dart b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_progress_ring.dart index b41d1fac..bc726e75 100644 --- a/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_progress_ring.dart +++ b/modules/legacy/modules/device_management/lib/src/features/activity_meter/presentation/widgets/steps_progress_ring.dart @@ -1,22 +1,20 @@ import 'dart:math'; -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; import '../format_steps.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class StepsProgressRing extends StatelessWidget { final int steps; final int goal; - final ThemePort theme; const StepsProgressRing({ super.key, required this.steps, required this.goal, - required this.theme, }); @override @@ -37,9 +35,8 @@ class StepsProgressRing extends StatelessWidget { child: CustomPaint( painter: _RingPainter( progress: progress, - activeColor: theme.getColorFor(ThemeCode.legacyPrimary), - trackColor: theme - .getColorFor(ThemeCode.textPrimary) + activeColor: context.sfColors.legacyPrimary, + trackColor: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.1), ), child: Center( @@ -49,22 +46,21 @@ class StepsProgressRing extends StatelessWidget { Icon( Icons.directions_walk_rounded, size: SizeUtils.getByScreen(small: 28, big: 24), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), Text( formatStepsNumber(steps), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 28, big: 24), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), Text( context.translate(I18n.unitSteps), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -78,8 +74,7 @@ class StepsProgressRing extends StatelessWidget { '${formatStepsNumber(goal)} ${context.translate(I18n.unitSteps)} · $percentage%', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/apps_use_screen.dart b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/apps_use_screen.dart index ac2d3ab2..a583d661 100644 --- a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/apps_use_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/apps_use_screen.dart @@ -15,7 +15,6 @@ class AppsUseScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(appsUseViewModelProvider); final vm = ref.read(appsUseViewModelProvider.notifier); @@ -29,7 +28,6 @@ class AppsUseScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.appsUse), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -41,7 +39,6 @@ class AppsUseScreen extends ConsumerWidget { selected: state.timeRange, onSelected: (range) => vm.selectTimeRange(range), onCustomTap: () => _pickCustomRange(context, vm), - theme: theme, ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), if (state.dailyData.isEmpty) @@ -55,9 +52,9 @@ class AppsUseScreen extends ConsumerWidget { context.translate(I18n.noAppUsageData), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.5), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.5), ), textAlign: TextAlign.center, ), @@ -67,7 +64,6 @@ class AppsUseScreen extends ConsumerWidget { TopAppsSection( apps: state.topApps, totalDuration: state.totalDuration, - theme: theme, ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 14)), DailyAppUsageSection( @@ -75,7 +71,6 @@ class AppsUseScreen extends ConsumerWidget { hasMore: state.hasMore, isLoadingMore: state.isLoadingMore, onLoadMore: () => vm.loadMore(), - theme: theme, ), ], SizedBox(height: SizeUtils.getByScreen(small: 24, big: 20)), diff --git a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/daily_app_usage_section.dart b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/daily_app_usage_section.dart index 4ba0eb7f..342a0bb4 100644 --- a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/daily_app_usage_section.dart +++ b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/daily_app_usage_section.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -12,7 +12,6 @@ class DailyAppUsageSection extends StatelessWidget { final bool hasMore; final bool isLoadingMore; final VoidCallback onLoadMore; - final ThemePort theme; const DailyAppUsageSection({ super.key, @@ -20,7 +19,6 @@ class DailyAppUsageSection extends StatelessWidget { required this.hasMore, required this.isLoadingMore, required this.onLoadMore, - required this.theme, }); @override @@ -37,11 +35,11 @@ class DailyAppUsageSection extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), - ...items.map((day) => _DailyAppUsageTile(day: day, theme: theme)), + ...items.map((day) => _DailyAppUsageTile(day: day)), if (hasMore) Padding( padding: EdgeInsets.all(SizeUtils.getByScreen(small: 16, big: 14)), @@ -53,7 +51,7 @@ class DailyAppUsageSection extends StatelessWidget { child: Text( context.translate(I18n.loadMore), style: TextStyle( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, fontWeight: FontWeight.w600, ), ), @@ -67,9 +65,8 @@ class DailyAppUsageSection extends StatelessWidget { class _DailyAppUsageTile extends StatelessWidget { final DailyAppUsage day; - final ThemePort theme; - const _DailyAppUsageTile({required this.day, required this.theme}); + const _DailyAppUsageTile({required this.day}); @override Widget build(BuildContext context) { @@ -81,7 +78,7 @@ class _DailyAppUsageTile extends StatelessWidget { child: Container( padding: EdgeInsets.all(SizeUtils.getByScreen(small: 14, big: 12)), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 10)), ), @@ -96,9 +93,9 @@ class _DailyAppUsageTile extends StatelessWidget { formatDayHeader(context, day.date), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.6), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.6), ), ), Text( @@ -106,7 +103,7 @@ class _DailyAppUsageTile extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ], @@ -130,9 +127,9 @@ class _DailyAppUsageTile extends StatelessWidget { small: 12, big: 11, ), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.7), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.7), ), overflow: TextOverflow.ellipsis, ), @@ -142,9 +139,9 @@ class _DailyAppUsageTile extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.5), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.5), ), ), ], @@ -160,9 +157,9 @@ class _DailyAppUsageTile extends StatelessWidget { '+${day.apps.length - 3}', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.4), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.4), ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/top_apps_section.dart b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/top_apps_section.dart index 52bb5415..f2ac5e09 100644 --- a/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/top_apps_section.dart +++ b/modules/legacy/modules/device_management/lib/src/features/apps_use/presentation/widgets/top_apps_section.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -9,13 +9,11 @@ import '../state/apps_use_view_state.dart'; class TopAppsSection extends StatelessWidget { final List apps; final int totalDuration; - final ThemePort theme; const TopAppsSection({ super.key, required this.apps, required this.totalDuration, - required this.theme, }); @override @@ -37,7 +35,7 @@ class TopAppsSection extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), Text( @@ -45,18 +43,15 @@ class TopAppsSection extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ], ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), ...apps.map( - (app) => _AppUsageBar( - app: app, - maxDuration: apps.first.totalDuration, - theme: theme, - ), + (app) => + _AppUsageBar(app: app, maxDuration: apps.first.totalDuration), ), ], ), @@ -67,13 +62,8 @@ class TopAppsSection extends StatelessWidget { class _AppUsageBar extends StatelessWidget { final AppUsageSummary app; final int maxDuration; - final ThemePort theme; - const _AppUsageBar({ - required this.app, - required this.maxDuration, - required this.theme, - }); + const _AppUsageBar({required this.app, required this.maxDuration}); @override Widget build(BuildContext context) { @@ -96,7 +86,7 @@ class _AppUsageBar extends StatelessWidget { app.name, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), overflow: TextOverflow.ellipsis, ), @@ -106,9 +96,9 @@ class _AppUsageBar extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.6), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.6), ), ), ], @@ -121,11 +111,11 @@ class _AppUsageBar extends StatelessWidget { child: LinearProgressIndicator( value: progress, minHeight: SizeUtils.getByScreen(small: 6, big: 5), - backgroundColor: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.1), + backgroundColor: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.1), valueColor: AlwaysStoppedAnimation( - theme.getColorFor(ThemeCode.legacyPrimary), + context.sfColors.legacyPrimary, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/background_image/presentation/background_image_screen.dart b/modules/legacy/modules/device_management/lib/src/features/background_image/presentation/background_image_screen.dart index 7500f801..61f7ecbf 100644 --- a/modules/legacy/modules/device_management/lib/src/features/background_image/presentation/background_image_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/background_image/presentation/background_image_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -16,8 +17,7 @@ class BackgroundImageScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final state = ref.watch(backgroundImageViewModelProvider); final vm = ref.read(backgroundImageViewModelProvider.notifier); @@ -60,9 +60,9 @@ class BackgroundImageScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -155,7 +155,7 @@ class _EmptyState extends StatelessWidget { Icon( Icons.add_photo_alternate_outlined, size: 100, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, ), const SizedBox(height: 24), Text( @@ -221,7 +221,7 @@ class _PhotoGrid extends StatelessWidget { border: Border.all( color: isActive ? primaryColor - : Colors.grey.shade300, + : Theme.of(context).colorScheme.outline, width: isActive ? 3 : 1, ), ), @@ -232,7 +232,7 @@ class _PhotoGrid extends StatelessWidget { child: Icon( Icons.image_outlined, size: 48, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/call_history_screen.dart b/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/call_history_screen.dart index 8362ff8b..f31ceee4 100644 --- a/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/call_history_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/call_history/presentation/call_history_screen.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -7,19 +6,18 @@ import 'package:sf_localizations/sf_localizations.dart'; import '../data/call_history_entity.dart'; import 'state/call_history_view_model.dart'; import 'state/call_history_view_state.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class CallHistoryScreen extends ConsumerWidget { const CallHistoryScreen({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(callHistoryViewModelProvider); final vm = ref.read(callHistoryViewModelProvider.notifier); final filtered = state.filteredCalls; return LegacyPageLayout( - theme: theme, title: context.translate(I18n.callHistory), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -31,12 +29,12 @@ class CallHistoryScreen extends ConsumerWidget { Icon( Icons.error_outline, size: 64, - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, ), const SizedBox(height: 12), Text( state.errorMessage, - style: TextStyle(color: Colors.grey.shade500, fontSize: 14), + style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 14), textAlign: TextAlign.center, ), ], @@ -54,13 +52,13 @@ class CallHistoryScreen extends ConsumerWidget { Icon( Icons.phone_missed_outlined, size: 64, - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, ), const SizedBox(height: 12), Text( context.translate(I18n.callHistoryEmpty), style: TextStyle( - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 14, ), ), @@ -89,9 +87,7 @@ class CallHistoryScreen extends ConsumerWidget { _DateHeader(timestamp: call.occurredAt), _CallTile( call: call, - primaryColor: theme.getColorFor( - ThemeCode.legacyPrimary, - ), + primaryColor: context.sfColors.legacyPrimary, ), ], ); @@ -126,7 +122,7 @@ class _FilterBar extends StatelessWidget { padding: const EdgeInsets.all(4), height: 40, decoration: BoxDecoration( - color: Colors.grey.shade200, + color: Theme.of(context).colorScheme.outlineVariant, borderRadius: BorderRadius.circular(10), ), child: LayoutBuilder( @@ -144,7 +140,7 @@ class _FilterBar extends StatelessWidget { width: tabWidth, child: Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow( @@ -180,7 +176,7 @@ class _FilterBar extends StatelessWidget { : FontWeight.w500, color: isSelected ? Colors.black87 - : Colors.grey.shade600, + : Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), @@ -226,7 +222,7 @@ class _DateHeader extends StatelessWidget { style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ); @@ -261,7 +257,7 @@ class _CallTile extends StatelessWidget { final Color iconColor; if (!isAccepted) { icon = isIncoming ? Icons.phone_missed : Icons.phone_disabled; - iconColor = Colors.red; + iconColor = Theme.of(context).colorScheme.error; } else { icon = isIncoming ? Icons.call_received : Icons.call_made; iconColor = primaryColor; @@ -285,7 +281,7 @@ class _CallTile extends StatelessWidget { style: TextStyle( fontSize: 15, fontWeight: FontWeight.w500, - color: isAccepted ? Colors.black87 : Colors.red.shade700, + color: isAccepted ? Colors.black87 : Theme.of(context).colorScheme.error, ), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -301,20 +297,20 @@ class _CallTile extends StatelessWidget { if (subtitle != null) ...[ Text( subtitle, - style: TextStyle(fontSize: 12, color: Colors.grey.shade600), + style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(width: 8), ], if (isAccepted) Text( durationStr, - style: TextStyle(fontSize: 12, color: Colors.grey.shade500), + style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), trailing: Text( timeStr, - style: TextStyle(fontSize: 13, color: Colors.grey.shade500), + style: TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ), ); diff --git a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/contacts_screen.dart b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/contacts_screen.dart index 4b4d9ecb..82ebf1df 100644 --- a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/contacts_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/contacts_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -19,7 +20,6 @@ class ContactsScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final vm = ref.read(contactsViewModelProvider.notifier); final state = ref.watch(contactsViewModelProvider); - final theme = ref.watch(themePortProvider); ref.listen(contactsViewModelProvider.select((s) => s.error), (prev, next) { if (next == null) return; @@ -32,14 +32,13 @@ class ContactsScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.contactsAgendaTitle), showEdit: true, onEditChange: vm.toggleIsEditing, body: state.isLoading ? const Center(child: CircularProgressIndicator()) : state.contacts.isEmpty - ? _EmptyState(theme: theme) + ? const _EmptyState() : ListView.separated( padding: EdgeInsets.symmetric( horizontal: SizeUtils.getByScreen(small: 22, big: 21), @@ -54,7 +53,7 @@ class ContactsScreen extends ConsumerWidget { itemCount: state.contacts.length, ), footer: Material( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, shape: const CircleBorder(), child: InkWell( customBorder: const CircleBorder(), @@ -93,9 +92,8 @@ class ContactsScreen extends ConsumerWidget { } class _EmptyState extends StatelessWidget { - final ThemePort theme; - const _EmptyState({required this.theme}); + const _EmptyState(); @override Widget build(BuildContext context) { @@ -106,8 +104,7 @@ class _EmptyState extends StatelessWidget { Icon( SFIcons.contactsCircle, size: SizeUtils.getByScreen(small: 64, big: 60), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.3), ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 14)), @@ -116,7 +113,7 @@ class _EmptyState extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 17), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), @@ -124,8 +121,7 @@ class _EmptyState extends StatelessWidget { context.translate(I18n.contactsEmptyHint), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/edit_contact_screen.dart b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/edit_contact_screen.dart index ef2504e8..65f9a84e 100644 --- a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/edit_contact_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/edit_contact_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -16,7 +17,6 @@ class EditContactScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final provider = editContactViewModelProvider(contactId); final vm = ref.read(provider.notifier); final state = ref.watch(provider); @@ -35,13 +35,13 @@ class EditContactScreen extends ConsumerWidget { if (contact == null) { return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Center(child: Text(context.translate(I18n.errorGeneric))), ); } return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: Column( children: [ @@ -139,7 +139,7 @@ class EditContactScreen extends ConsumerWidget { } }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ], ), diff --git a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/confirm_delete_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/confirm_delete_dialog.dart index 522cbebb..5fd45364 100644 --- a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/confirm_delete_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/confirm_delete_dialog.dart @@ -6,6 +6,7 @@ import 'package:utils/utils.dart'; import '../../domain/entities/contact_entity.dart'; import '../state/contacts_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class ConfirmDeleteDialog extends ConsumerWidget { final ContactEntity contact; @@ -14,7 +15,6 @@ class ConfirmDeleteDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Container( padding: EdgeInsets.symmetric( @@ -22,7 +22,7 @@ class ConfirmDeleteDialog extends ConsumerWidget { vertical: SizeUtils.getByScreen(small: 30, big: 28), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 12, big: 10), ), @@ -46,7 +46,7 @@ class ConfirmDeleteDialog extends ConsumerWidget { child: PrimaryButton( onPressed: () => Navigator.pop(context), text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -60,7 +60,7 @@ class ConfirmDeleteDialog extends ConsumerWidget { if (context.mounted) Navigator.pop(context); }, text: context.translate(I18n.delete), - color: const Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/contact_card.dart b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/contact_card.dart index d4b2c3f4..17beaa8e 100644 --- a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/contact_card.dart +++ b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/contact_card.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; @@ -20,7 +21,6 @@ class ContactCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Container( padding: EdgeInsets.symmetric( @@ -31,20 +31,20 @@ class ContactCard extends ConsumerWidget { borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 18)), ), - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, ), child: Row( children: [ Container( decoration: BoxDecoration( shape: BoxShape.circle, - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, ), padding: EdgeInsets.all(SizeUtils.getByScreen(small: 10, big: 12)), child: Icon( SFIcons.account, size: SizeUtils.getByScreen(small: 40, big: 44), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), ), @@ -72,7 +72,7 @@ class ContactCard extends ConsumerWidget { if (isEditing) ...[ DecoratedBox( decoration: BoxDecoration( - color: const Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, borderRadius: BorderRadius.all(Radius.circular(12)), ), child: IconButton( @@ -87,7 +87,7 @@ class ContactCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)), DecoratedBox( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, borderRadius: BorderRadius.all(Radius.circular(12)), ), child: IconButton( diff --git a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/new_contact_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/new_contact_dialog.dart index 53b14ea6..903efd23 100644 --- a/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/new_contact_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/contacts/presentation/widgets/new_contact_dialog.dart @@ -7,13 +7,13 @@ import 'package:utils/utils.dart'; import '../../domain/entities/contact_error.dart'; import '../state/new_contact_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class NewContactDialog extends ConsumerWidget { const NewContactDialog({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(newContactViewModelProvider.notifier); final isoCode = ref.watch( newContactViewModelProvider.select((s) => s.isoCode), @@ -47,7 +47,7 @@ class NewContactDialog extends ConsumerWidget { height: SizeUtils.getByScreen(small: 430, big: 410), width: SizeUtils.getByScreen(small: 400, big: 390), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 6, big: 5)), ), @@ -63,7 +63,7 @@ class NewContactDialog extends ConsumerWidget { onPressed: () => Navigator.pop(context), icon: Icon( Icons.close, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ), @@ -71,7 +71,7 @@ class NewContactDialog extends ConsumerWidget { child: Text( context.translate(I18n.newContact).toUpperCase(), style: TextStyle( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, fontWeight: FontWeight.w500, ), ), @@ -110,7 +110,7 @@ class NewContactDialog extends ConsumerWidget { DecoratedBox( decoration: BoxDecoration( shape: BoxShape.circle, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), child: IconButton( onPressed: vm.pickContactFromDevice, @@ -137,7 +137,7 @@ class NewContactDialog extends ConsumerWidget { if (success && context.mounted) Navigator.pop(context); }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ], diff --git a/modules/legacy/modules/device_management/lib/src/features/device_management/device_management_screen.dart b/modules/legacy/modules/device_management/lib/src/features/device_management/device_management_screen.dart index cbba107c..6d1e1725 100644 --- a/modules/legacy/modules/device_management/lib/src/features/device_management/device_management_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/device_management/device_management_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:device_management/src/features/device_management/widgets/call_watch_dialog.dart'; @@ -15,15 +16,13 @@ class DeviceManagementScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final capabilities = ref.watch( selectedDeviceProvider.select((device) => device.value?.capabilities), ); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final gap = SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.deviceFunctionsTitle), showBack: false, body: SingleChildScrollView( diff --git a/modules/legacy/modules/device_management/lib/src/features/device_management/widgets/call_watch_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/device_management/widgets/call_watch_dialog.dart index 18b5f579..03bbc71f 100644 --- a/modules/legacy/modules/device_management/lib/src/features/device_management/widgets/call_watch_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/device_management/widgets/call_watch_dialog.dart @@ -4,13 +4,13 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:device_management/src/features/device_management/state/call_watch_view_model.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class CallWatchDialog extends ConsumerWidget { const CallWatchDialog({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(callWatchViewModelProvider.notifier); final viewState = ref.watch(callWatchViewModelProvider); @@ -43,7 +43,7 @@ class CallWatchDialog extends ConsumerWidget { }, icon: Icon( Icons.close, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ), @@ -99,7 +99,7 @@ class CallWatchDialog extends ConsumerWidget { PrimaryButton( onPressed: viewModel.call, text: context.translate(I18n.call), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/do_not_disturb_screen.dart b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/do_not_disturb_screen.dart index c7e1c8d7..e7d3c916 100644 --- a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/do_not_disturb_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/do_not_disturb_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -16,7 +17,6 @@ class DoNotDisturbScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(doNotDisturbViewModelProvider.notifier); final (periods, maxPeriods, isLoading, isSaving) = ref.watch( doNotDisturbViewModelProvider.select( @@ -55,10 +55,9 @@ class DoNotDisturbScreen extends ConsumerWidget { } }); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return LegacyPageLayout( - theme: theme, title: context.translate(I18n.doNotDisturb), body: isLoading ? const Center(child: CircularProgressIndicator()) @@ -74,8 +73,7 @@ class DoNotDisturbScreen extends ConsumerWidget { context.translate(I18n.doNotDisturbDescription), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), height: 1.4, ), @@ -112,8 +110,7 @@ class DoNotDisturbScreen extends ConsumerWidget { small: 14, big: 13, ), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/do_not_disturb_period_card.dart b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/do_not_disturb_period_card.dart index 1302267c..0c324934 100644 --- a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/do_not_disturb_period_card.dart +++ b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/do_not_disturb_period_card.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:utils/utils.dart'; @@ -18,13 +18,12 @@ class DoNotDisturbPeriodCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Container( padding: EdgeInsets.all(SizeUtils.getByScreen(small: 14, big: 12)), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 12, big: 10), ), @@ -46,7 +45,7 @@ class DoNotDisturbPeriodCard extends ConsumerWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 16, big: 15), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/edit_period_sheet.dart b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/edit_period_sheet.dart index b85dc051..d0f2e5c2 100644 --- a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/edit_period_sheet.dart +++ b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/edit_period_sheet.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -57,8 +58,7 @@ class _EditPeriodSheetState extends ConsumerState { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final isEditing = widget.initial != null; final hasSelectedDays = _weekDays.any((d) => d); @@ -82,7 +82,7 @@ class _EditPeriodSheetState extends ConsumerState { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 16), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), @@ -125,7 +125,7 @@ class _EditPeriodSheetState extends ConsumerState { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 10, big: 8)), @@ -183,7 +183,7 @@ class _TimePickerTile extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 12, big: 10), ), decoration: BoxDecoration( - border: Border.all(color: Colors.grey.shade300), + border: Border.all(color: Theme.of(context).colorScheme.outline), borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 12, big: 10), ), @@ -195,7 +195,7 @@ class _TimePickerTile extends StatelessWidget { label, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), SizedBox(height: SizeUtils.getByScreen(small: 4, big: 3)), diff --git a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/week_day_row.dart b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/week_day_row.dart index c943fd04..adb3470b 100644 --- a/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/week_day_row.dart +++ b/modules/legacy/modules/device_management/lib/src/features/do_not_disturb/presentation/widgets/week_day_row.dart @@ -53,7 +53,7 @@ class WeekDayRow extends StatelessWidget { decoration: BoxDecoration( color: active ? activeColor : Colors.transparent, borderRadius: BorderRadius.circular(6), - border: active ? null : Border.all(color: Colors.grey.shade300), + border: active ? null : Border.all(color: Theme.of(context).colorScheme.outline), ), child: Center( child: Text( @@ -63,7 +63,7 @@ class WeekDayRow extends StatelessWidget { ? SizeUtils.getByScreen(small: 11, big: 10) : SizeUtils.getByScreen(small: 13, big: 12), fontWeight: FontWeight.w600, - color: active ? Colors.white : Colors.grey.shade500, + color: active ? Colors.white : Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_colors.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_colors.dart index b2c341d0..52d53a4c 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_colors.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_colors.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; const _kGreen = Color(0xFF4CAF50); const _kOrange = Color(0xFFFF9800); -const _kRed = Color(0xFFFF5D52); +const _kRed = Color(0xFFEF1111); Color heartRateColor(int bpm) { if (bpm < 50 || bpm > 120) return _kRed; diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart index 6fa95f6b..d996b937 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/health_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -55,7 +56,6 @@ class _HealthScreenState extends ConsumerState @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); final state = ref.watch(healthViewModelProvider); final vm = ref.read(healthViewModelProvider.notifier); final device = ref.watch(selectedDeviceProvider).value; @@ -80,14 +80,12 @@ class _HealthScreenState extends ConsumerState }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.healthTitle), body: state.isLoading ? const Center(child: CircularProgressIndicator()) : state.isMeasuringCountdown ? _MeasuringOverlay( remainingSeconds: state.measureRemainingSeconds, - theme: theme, ) : Column( children: [ @@ -95,20 +93,17 @@ class _HealthScreenState extends ConsumerState heartbeats: state.latestHeartbeats, oxygens: state.latestOxygens, tabController: _tabController, - theme: theme, ), TimeRangeSelector( selected: state.timeRange, onSelected: (range) => vm.selectTimeRange(range), onCustomTap: () => _pickCustomRange(vm), - theme: theme, ), if (device?.capabilities?.heartbeats != null && device!.capabilities!.heartbeats!.options.isNotEmpty) _HeartRateFrequencySelector( currentFrequency: device.settings.frequencyHeartRate, options: device.capabilities!.heartbeats!.options, - theme: theme, onChanged: (frequency) async { if (!await guardDeviceCommand(context, ref)) return; final success = await vm.updateHeartRateFrequency( @@ -129,11 +124,11 @@ class _HealthScreenState extends ConsumerState ), TabBar( controller: _tabController, - labelColor: theme.getColorFor(ThemeCode.legacyPrimary), - unselectedLabelColor: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.5), - indicatorColor: theme.getColorFor(ThemeCode.legacyPrimary), + labelColor: context.sfColors.legacyPrimary, + unselectedLabelColor: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.5), + indicatorColor: context.sfColors.legacyPrimary, labelStyle: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), fontWeight: FontWeight.w600, @@ -183,7 +178,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(healthViewModelProvider.notifier); final isMeasuring = ref.watch( healthViewModelProvider.select((s) => s.isMeasuring), @@ -204,7 +198,7 @@ class _SaveSection extends ConsumerWidget { vm.measure(); }, text: isMeasuring ? '...' : context.translate(I18n.measure), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } @@ -213,19 +207,17 @@ class _SaveSection extends ConsumerWidget { class _HeartRateFrequencySelector extends StatelessWidget { final int currentFrequency; final List options; - final ThemePort theme; final ValueChanged onChanged; const _HeartRateFrequencySelector({ required this.currentFrequency, required this.options, - required this.theme, required this.onChanged, }); @override Widget build(BuildContext context) { - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -264,16 +256,12 @@ class _HeartRateFrequencySelector extends StatelessWidget { class _MeasuringOverlay extends StatelessWidget { final int remainingSeconds; - final ThemePort theme; - const _MeasuringOverlay({ - required this.remainingSeconds, - required this.theme, - }); + const _MeasuringOverlay({required this.remainingSeconds}); @override Widget build(BuildContext context) { - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Center( child: Column( diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/blood_pressure_tab.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/blood_pressure_tab.dart index f6cbaba6..a9e4de44 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/blood_pressure_tab.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/blood_pressure_tab.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -28,7 +27,6 @@ class BloodPressureTab extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(healthViewModelProvider.notifier); final chartWithPressure = chartData @@ -39,7 +37,7 @@ class BloodPressureTab extends ConsumerWidget { .toList(); if (chartWithPressure.isEmpty && historyWithPressure.isEmpty) { - return HealthEmptyState(theme: theme, icon: Icons.monitor_heart_outlined); + return HealthEmptyState(icon: Icons.monitor_heart_outlined); } return ListView( @@ -52,13 +50,12 @@ class BloodPressureTab extends ConsumerWidget { chartWithPressure, (h) => h.highBloodPressure!.toDouble(), ), - lineColor: const Color(0xFFFF5D52), + lineColor: Theme.of(context).colorScheme.error, secondarySpots: toFlSpots( chartWithPressure, (h) => h.lowBloodPressure!.toDouble(), ), secondaryLineColor: const Color(0xFFFF9800), - theme: theme, ), HealthHistorySection( items: historyWithPressure, @@ -74,7 +71,6 @@ class BloodPressureTab extends ConsumerWidget { hasMore: hasMore, isLoadingMore: isLoadingMore, onLoadMore: () => vm.loadMoreHistory(), - theme: theme, ), ], ); diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/day_header.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/day_header.dart index 15ef7603..b7ed15ec 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/day_header.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/day_header.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -6,9 +5,8 @@ import '../../../../core/presentation/format_date.dart'; class DayHeader extends StatelessWidget { final DateTime date; - final ThemePort theme; - const DayHeader({super.key, required this.date, required this.theme}); + const DayHeader({super.key, required this.date}); @override Widget build(BuildContext context) { @@ -22,8 +20,7 @@ class DayHeader extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), fontWeight: FontWeight.w600, - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_empty_state.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_empty_state.dart index 188faf73..0b729671 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_empty_state.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_empty_state.dart @@ -1,13 +1,11 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; class HealthEmptyState extends StatelessWidget { - final ThemePort theme; final IconData icon; - const HealthEmptyState({super.key, required this.theme, required this.icon}); + const HealthEmptyState({super.key, required this.icon}); @override Widget build(BuildContext context) { @@ -18,8 +16,7 @@ class HealthEmptyState extends StatelessWidget { Icon( icon, size: SizeUtils.getByScreen(small: 64, big: 60), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.3), ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 14)), @@ -28,7 +25,7 @@ class HealthEmptyState extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 17), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)), @@ -37,8 +34,7 @@ class HealthEmptyState extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 13), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_history_section.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_history_section.dart index eb093e62..80c26d39 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_history_section.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_history_section.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -16,7 +16,6 @@ class HealthHistorySection extends StatelessWidget { final bool hasMore; final bool isLoadingMore; final VoidCallback onLoadMore; - final ThemePort theme; const HealthHistorySection({ super.key, @@ -26,7 +25,6 @@ class HealthHistorySection extends StatelessWidget { required this.hasMore, required this.isLoadingMore, required this.onLoadMore, - required this.theme, }); @override @@ -45,7 +43,7 @@ class HealthHistorySection extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ), @@ -56,7 +54,7 @@ class HealthHistorySection extends StatelessWidget { padding: EdgeInsets.symmetric( horizontal: SizeUtils.getByScreen(small: 22, big: 21), ), - child: DayHeader(date: day, theme: theme), + child: DayHeader(date: day), ), ...dayItems.map((item) { final record = buildRecord(context, item); @@ -69,7 +67,6 @@ class HealthHistorySection extends StatelessWidget { unit: record.unit, date: formatTime(getTimestamp(item)), valueColor: record.valueColor, - theme: theme, ), ); }), @@ -86,7 +83,7 @@ class HealthHistorySection extends StatelessWidget { child: Text( context.translate(I18n.loadMore), style: TextStyle( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, fontWeight: FontWeight.w600, ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_line_chart.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_line_chart.dart index 6840b5f6..8b3d8afe 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_line_chart.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_line_chart.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -6,7 +5,6 @@ import 'package:utils/utils.dart'; class HealthLineChart extends StatelessWidget { final List spots; final Color lineColor; - final ThemePort theme; final List? secondarySpots; final Color? secondaryLineColor; @@ -15,7 +13,6 @@ class HealthLineChart extends StatelessWidget { super.key, required this.spots, required this.lineColor, - required this.theme, this.secondarySpots, this.secondaryLineColor, }); @@ -30,8 +27,7 @@ class HealthLineChart extends StatelessWidget { '--', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 16, big: 14), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.3), ), ), @@ -59,8 +55,7 @@ class HealthLineChart extends StatelessWidget { drawVerticalLine: false, horizontalInterval: _computeInterval(spots), getDrawingHorizontalLine: (value) => FlLine( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.08), strokeWidth: 1, ), @@ -74,8 +69,7 @@ class HealthLineChart extends StatelessWidget { value.toInt().toString(), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 10, big: 9), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.4), ), ), @@ -95,7 +89,7 @@ class HealthLineChart extends StatelessWidget { lineTouchData: LineTouchData( touchTooltipData: LineTouchTooltipData( getTooltipColor: (_) => - theme.getColorFor(ThemeCode.backgroundSecondary), + Theme.of(context).colorScheme.surfaceContainer, getTooltipItems: (spots) => spots .map( (spot) => LineTooltipItem( @@ -103,7 +97,7 @@ class HealthLineChart extends StatelessWidget { TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ) diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_record_tile.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_record_tile.dart index 59cc67a5..2f4a8635 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_record_tile.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_record_tile.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -7,7 +6,6 @@ class HealthRecordTile extends StatelessWidget { final String unit; final String date; final Color valueColor; - final ThemePort theme; const HealthRecordTile({ super.key, @@ -15,7 +13,6 @@ class HealthRecordTile extends StatelessWidget { required this.unit, required this.date, required this.valueColor, - required this.theme, }); @override @@ -26,7 +23,7 @@ class HealthRecordTile extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 12, big: 10), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 10)), ), @@ -51,8 +48,7 @@ class HealthRecordTile extends StatelessWidget { unit, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -63,8 +59,7 @@ class HealthRecordTile extends StatelessWidget { date, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_stats_row.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_stats_row.dart index 88518262..574147d5 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_stats_row.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_stats_row.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -8,13 +7,11 @@ import '../state/health_view_state.dart'; class HealthStatsRow extends StatelessWidget { final HealthStats stats; final String unit; - final ThemePort theme; const HealthStatsRow({ super.key, required this.stats, required this.unit, - required this.theme, }); @override @@ -33,7 +30,6 @@ class HealthStatsRow extends StatelessWidget { label: context.translate(I18n.average), value: hasData ? '${stats.avg}' : '--', unit: unit, - theme: theme, ), ), Expanded( @@ -41,7 +37,6 @@ class HealthStatsRow extends StatelessWidget { label: context.translate(I18n.minimum), value: hasData ? '${stats.min}' : '--', unit: unit, - theme: theme, ), ), Expanded( @@ -49,7 +44,6 @@ class HealthStatsRow extends StatelessWidget { label: context.translate(I18n.maximum), value: hasData ? '${stats.max}' : '--', unit: unit, - theme: theme, ), ), ], @@ -62,13 +56,11 @@ class _StatItem extends StatelessWidget { final String label; final String value; final String unit; - final ThemePort theme; const _StatItem({ required this.label, required this.value, required this.unit, - required this.theme, }); @override @@ -79,8 +71,7 @@ class _StatItem extends StatelessWidget { label, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -93,15 +84,14 @@ class _StatItem extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 20, big: 18), fontWeight: FontWeight.w700, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), TextSpan( text: ' $unit', style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_summary_cards.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_summary_cards.dart index f5e52b41..58b76350 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_summary_cards.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/health_summary_cards.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -12,14 +11,12 @@ class HealthSummaryCards extends StatelessWidget { final List heartbeats; final List oxygens; final TabController tabController; - final ThemePort theme; const HealthSummaryCards({ super.key, required this.heartbeats, required this.oxygens, required this.tabController, - required this.theme, }); @override @@ -30,6 +27,10 @@ class HealthSummaryCards extends StatelessWidget { .firstOrNull; final lastOxygen = oxygens.isNotEmpty ? oxygens.first : null; + final mutedColor = Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.3); + return Padding( padding: EdgeInsets.symmetric( horizontal: SizeUtils.getByScreen(small: 16, big: 14), @@ -50,10 +51,7 @@ class HealthSummaryCards extends StatelessWidget { : '', valueColor: lastHeartbeat != null ? heartRateColor(lastHeartbeat.heartbeats) - : theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.3), - theme: theme, + : mutedColor, ), ), SizedBox(width: SizeUtils.getByScreen(small: 8, big: 6)), @@ -73,10 +71,7 @@ class HealthSummaryCards extends StatelessWidget { lastWithPressure.highBloodPressure!, lastWithPressure.lowBloodPressure!, ) - : theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.3), - theme: theme, + : mutedColor, ), ), SizedBox(width: SizeUtils.getByScreen(small: 8, big: 6)), @@ -91,10 +86,7 @@ class HealthSummaryCards extends StatelessWidget { : '', valueColor: lastOxygen != null ? oxygenColor(lastOxygen.oxygen) - : theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.3), - theme: theme, + : mutedColor, ), ), ], @@ -110,7 +102,6 @@ class _SummaryCard extends StatelessWidget { final String unit; final String timeAgo; final Color valueColor; - final ThemePort theme; const _SummaryCard({ required this.onTap, @@ -119,7 +110,6 @@ class _SummaryCard extends StatelessWidget { required this.unit, required this.timeAgo, required this.valueColor, - required this.theme, }); @override @@ -132,7 +122,7 @@ class _SummaryCard extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 12, big: 10), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 12, big: 10)), ), @@ -157,9 +147,9 @@ class _SummaryCard extends StatelessWidget { unit, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 11, big: 10), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.5), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.5), ), ), if (timeAgo.isNotEmpty) ...[ @@ -168,9 +158,9 @@ class _SummaryCard extends StatelessWidget { timeAgo, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 10, big: 9), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.4), + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.4), ), ), ], diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/heart_rate_tab.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/heart_rate_tab.dart index a9dd8bc2..5b48c206 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/heart_rate_tab.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/heart_rate_tab.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -32,11 +31,10 @@ class HeartRateTab extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(healthViewModelProvider.notifier); if (chartData.isEmpty && historyData.isEmpty) { - return HealthEmptyState(theme: theme, icon: Icons.favorite_rounded); + return HealthEmptyState(icon: Icons.favorite_rounded); } return ListView( @@ -46,13 +44,11 @@ class HeartRateTab extends ConsumerWidget { children: [ HealthLineChart( spots: toFlSpots(chartData, (h) => h.heartbeats.toDouble()), - lineColor: const Color(0xFFFF5D52), - theme: theme, + lineColor: Theme.of(context).colorScheme.error, ), HealthStatsRow( stats: stats, unit: context.translate(I18n.unitBpm), - theme: theme, ), HealthHistorySection( items: historyData, @@ -65,7 +61,6 @@ class HeartRateTab extends ConsumerWidget { hasMore: hasMore, isLoadingMore: isLoadingMore, onLoadMore: () => vm.loadMoreHistory(), - theme: theme, ), ], ); diff --git a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/oxygen_tab.dart b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/oxygen_tab.dart index 5984b79c..e7ada59e 100644 --- a/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/oxygen_tab.dart +++ b/modules/legacy/modules/device_management/lib/src/features/health/presentation/widgets/oxygen_tab.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -32,11 +31,10 @@ class OxygenTab extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(healthViewModelProvider.notifier); if (chartData.isEmpty && historyData.isEmpty) { - return HealthEmptyState(theme: theme, icon: Icons.air_rounded); + return HealthEmptyState(icon: Icons.air_rounded); } return ListView( @@ -47,12 +45,10 @@ class OxygenTab extends ConsumerWidget { HealthLineChart( spots: toFlSpots(chartData, (o) => o.oxygen.toDouble()), lineColor: const Color(0xFF4CAF50), - theme: theme, ), HealthStatsRow( stats: stats, unit: context.translate(I18n.unitSpO2), - theme: theme, ), HealthHistorySection( items: historyData, @@ -65,7 +61,6 @@ class OxygenTab extends ConsumerWidget { hasMore: hasMore, isLoadingMore: isLoadingMore, onLoadMore: () => vm.loadMoreHistory(), - theme: theme, ), ], ); diff --git a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/locate_device_screen.dart b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/locate_device_screen.dart index 1d7c20f7..5c366051 100644 --- a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/locate_device_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/locate_device_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -13,7 +14,6 @@ class LocateDeviceScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); ref.listen(locateDeviceViewModelProvider.select((s) => s.errorMessage), ( previous, @@ -38,7 +38,6 @@ class LocateDeviceScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.locateDevicePlaySoundButton), body: Padding( padding: EdgeInsets.symmetric( @@ -77,7 +76,7 @@ class LocateDeviceScreen extends ConsumerWidget { ); }, text: context.translate(I18n.locateDeviceTitle), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 36, big: 35), ), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart index cc860df8..93b7d8d6 100644 --- a/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/locate_device/presentation/widgets/locate_device_dialog.dart @@ -7,13 +7,13 @@ import 'package:utils/utils.dart'; import 'package:legacy_shared/legacy_shared.dart'; import '../state/locate_device_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class LocateDeviceDialog extends ConsumerWidget { const LocateDeviceDialog({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(locateDeviceViewModelProvider); final vm = ref.read(locateDeviceViewModelProvider.notifier); @@ -41,16 +41,14 @@ class LocateDeviceDialog extends ConsumerWidget { mainAxisSize: MainAxisSize.min, children: [ if (state.isLoading) - _DialogMessage(text: context.translate(I18n.sending), theme: theme), + _DialogMessage(text: context.translate(I18n.sending)), if (!state.isLoading && state.isComplete) _DialogMessage( text: context.translate(I18n.sentSuccessfully), - theme: theme, ), if (state.errorMessage.isNotEmpty) ...[ _DialogMessage( text: context.translate(I18n.deviceNotConnected), - theme: theme, fontSize: SizeUtils.getByScreen(small: 20, big: 19), ), SizedBox(height: SizeUtils.getByScreen(small: 24, big: 23)), @@ -60,7 +58,7 @@ class LocateDeviceDialog extends ConsumerWidget { vm.reset(); }, text: context.translate(I18n.ok), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -82,7 +80,7 @@ class LocateDeviceDialog extends ConsumerWidget { child: PrimaryButton( onPressed: () => Navigator.pop(context), text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -95,7 +93,7 @@ class LocateDeviceDialog extends ConsumerWidget { vm.locateDevice(); }, text: context.translate(I18n.accept), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -111,12 +109,10 @@ class LocateDeviceDialog extends ConsumerWidget { class _DialogMessage extends StatelessWidget { final String text; - final ThemePort theme; final double? fontSize; const _DialogMessage({ required this.text, - required this.theme, this.fontSize, }); diff --git a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_camera_screen.dart b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_camera_screen.dart index 409fd16c..cbb54642 100644 --- a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_camera_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_camera_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:lottie/lottie.dart'; @@ -53,8 +54,6 @@ class RemoteCameraScreen extends ConsumerWidget { }, ); - final theme = ref.watch(themePortProvider); - final isLoading = ref.watch( remoteConnectionViewModelProvider.select((s) => s.isLoadingPictures), ); @@ -72,13 +71,12 @@ class RemoteCameraScreen extends ConsumerWidget { if (isLoading || isTaking) { body = const Center(child: CircularProgressIndicator()); } else if (isWaiting) { - body = _WaitingForPhotoOverlay(remainingSeconds: countdown, theme: theme); + body = _WaitingForPhotoOverlay(remainingSeconds: countdown); } else { body = const _GallerySection(); } return LegacyPageLayout( - theme: theme, title: context.translate(I18n.remoteCamera), body: body, footer: isWaiting ? const SizedBox.shrink() : const _TakePictureSection(), @@ -91,8 +89,6 @@ class _GallerySection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final vm = ref.read(remoteConnectionViewModelProvider.notifier); final pictures = ref.watch( @@ -124,7 +120,7 @@ class _GallerySection extends ConsumerWidget { width: SizeUtils.getByScreen(small: 60, big: 58), decoration: BoxDecoration( border: Border.fromBorderSide( - BorderSide(color: theme.getColorFor(ThemeCode.textTertiary)), + BorderSide(color: Theme.of(context).colorScheme.outline), ), ), child: pictures[index].fileBytes != null @@ -142,8 +138,6 @@ class _TakePictureSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final vm = ref.read(remoteConnectionViewModelProvider.notifier); return Padding( @@ -157,7 +151,7 @@ class _TakePictureSection extends ConsumerWidget { vm.takePicture(); }, text: context.translate(I18n.takePicture), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 36, big: 35), ), ); @@ -169,16 +163,12 @@ class _WaitingForPhotoOverlay extends StatelessWidget { 'assets/shared/animations/shooting_photo.json'; final int remainingSeconds; - final ThemePort theme; - const _WaitingForPhotoOverlay({ - required this.remainingSeconds, - required this.theme, - }); + const _WaitingForPhotoOverlay({required this.remainingSeconds}); @override Widget build(BuildContext context) { - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Center( child: Column( diff --git a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_connection_screen.dart b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_connection_screen.dart index 3c04cca9..ab792d08 100644 --- a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_connection_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/remote_connection_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:device_management/src/features/remote_connection/presentation/remote_camera_screen.dart'; @@ -16,12 +17,10 @@ class RemoteConnectionScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final device = ref.watch(selectedDeviceProvider).value; final cameraEnabled = device?.capabilities?.camera?.enabled ?? false; return LegacyPageLayout( - theme: theme, title: context.translate(I18n.remoteConnection), body: SingleChildScrollView( child: Padding( @@ -83,14 +82,13 @@ class _SectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return SectionButton( onPressed: onPressed, icon: Icon( icon, size: SizeUtils.getByScreen(small: 40, big: 44), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, weight: 30, ), body: Text( diff --git a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart index 10154c01..4802a099 100644 --- a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/show_picture_dialog.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -11,7 +10,6 @@ class ShowPictureDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final viewModel = ref.read(remoteConnectionViewModelProvider.notifier); final pictures = ref.watch( remoteConnectionViewModelProvider.select((s) => s.pictures), @@ -23,7 +21,7 @@ class ShowPictureDialog extends ConsumerWidget { if (pictures.isEmpty) { return Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: const BorderRadius.all(Radius.circular(8)), ), height: SizeUtils.getByScreen(small: 200, big: 190), @@ -40,7 +38,7 @@ class ShowPictureDialog extends ConsumerWidget { return Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: const BorderRadius.all(Radius.circular(8)), ), height: SizeUtils.getByScreen(small: 350, big: 340), @@ -92,7 +90,7 @@ class _MetadataSection extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 8), child: Text( dateStr, - style: TextStyle(fontSize: 13, color: Colors.grey.shade600), + style: TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ); } diff --git a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart index 5458fe3c..4d5cc84b 100644 --- a/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/remote_connection/presentation/widgets/spy_call_dialog.dart @@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:device_management/src/features/remote_connection/presentation/state/remote_connection_view_model.dart'; import 'package:device_management/src/features/remote_connection/presentation/state/remote_connection_view_state.dart'; import 'package:legacy_shared/legacy_shared.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -12,7 +13,6 @@ class SpyCallDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(remoteConnectionViewModelProvider.notifier); ref.listen(remoteConnectionViewModelProvider.select((s) => s.errorEvent), ( @@ -60,13 +60,13 @@ class SpyCallDialog extends ConsumerWidget { ), decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(8)), - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, ), width: SizeUtils.getByScreen(small: 390, big: 380), child: Column( mainAxisSize: MainAxisSize.min, children: [ - _Header(theme: theme), + const _Header(), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)), Text( context.translate(I18n.spyCallSubtitle), @@ -93,9 +93,7 @@ class SpyCallDialog extends ConsumerWidget { } class _Header extends StatelessWidget { - final ThemePort theme; - - const _Header({required this.theme}); + const _Header(); @override Widget build(BuildContext context) { @@ -114,10 +112,7 @@ class _Header extends StatelessWidget { alignment: Alignment.centerRight, child: IconButton( onPressed: () => Navigator.pop(context), - icon: Icon( - Icons.close, - color: theme.getColorFor(ThemeCode.legacyPrimary), - ), + icon: Icon(Icons.close, color: context.sfColors.legacyPrimary), ), ), ], @@ -170,7 +165,6 @@ class _CallSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final isCalling = ref.watch( remoteConnectionViewModelProvider.select((s) => s.isCalling), ); @@ -180,7 +174,7 @@ class _CallSection extends ConsumerWidget { : PrimaryButton( onPressed: onPressed, text: context.translate(I18n.call), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ); diff --git a/modules/legacy/modules/device_management/lib/src/features/rewards/presentation/rewards_screen.dart b/modules/legacy/modules/device_management/lib/src/features/rewards/presentation/rewards_screen.dart index 59b1edeb..547a2cbc 100644 --- a/modules/legacy/modules/device_management/lib/src/features/rewards/presentation/rewards_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/rewards/presentation/rewards_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,7 +13,6 @@ class RewardsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(rewardsViewModelProvider); final vm = ref.read(rewardsViewModelProvider.notifier); @@ -39,7 +39,6 @@ class RewardsScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.rewards), body: Column( children: [ @@ -47,7 +46,7 @@ class RewardsScreen extends ConsumerWidget { child: Icon( SFIcons.rewardsCircle, size: SizeUtils.getByScreen(small: 180, big: 160), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), SizedBox(height: SizeUtils.getByScreen(small: 32, big: 28)), @@ -56,7 +55,7 @@ class RewardsScreen extends ConsumerWidget { textAlign: TextAlign.start, ), SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), - _CounterSection(theme: theme), + const _CounterSection(), ], ), footer: Padding( @@ -67,7 +66,7 @@ class RewardsScreen extends ConsumerWidget { child: PrimaryButton( onPressed: state.isLoading ? null : vm.submit, text: context.translate(I18n.sendRewards), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ); @@ -75,9 +74,8 @@ class RewardsScreen extends ConsumerWidget { } class _CounterSection extends ConsumerWidget { - final ThemePort theme; - const _CounterSection({required this.theme}); + const _CounterSection(); @override Widget build(BuildContext context, WidgetRef ref) { @@ -89,7 +87,7 @@ class _CounterSection extends ConsumerWidget { IconButton( onPressed: vm.decreaseAmount, icon: Icon(Icons.remove), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), SizedBox( width: SizeUtils.getByScreen(small: 240, big: 220), @@ -98,14 +96,14 @@ class _CounterSection extends ConsumerWidget { decoration: InputDecoration( border: OutlineInputBorder( borderSide: BorderSide( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), borderRadius: BorderRadius.all( Radius.circular(SizeUtils.getByScreen(small: 32, big: 28)), ), ), ), - style: TextStyle(color: theme.getColorFor(ThemeCode.legacyPrimary)), + style: TextStyle(color: context.sfColors.legacyPrimary), textAlign: TextAlign.center, keyboardType: TextInputType.number, ), @@ -113,7 +111,7 @@ class _CounterSection extends ConsumerWidget { IconButton( onPressed: vm.increaseAmount, icon: Icon(Icons.add), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ], ); diff --git a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/scheduled_activities_screen.dart b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/scheduled_activities_screen.dart index 1eb45a33..e0316dff 100644 --- a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/scheduled_activities_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/scheduled_activities_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -44,7 +45,6 @@ class _ScheduledActivitiesScreenState @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); final state = ref.watch(scheduledActivitiesViewModelProvider); ref.listen( @@ -57,7 +57,6 @@ class _ScheduledActivitiesScreenState ); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.activityScheduleTitle), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -65,11 +64,10 @@ class _ScheduledActivitiesScreenState children: [ TabBar( controller: _tabController, - labelColor: theme.getColorFor(ThemeCode.legacyPrimary), - unselectedLabelColor: theme.getColorFor( - ThemeCode.textPrimary, - ), - indicatorColor: theme.getColorFor(ThemeCode.legacyPrimary), + labelColor: context.sfColors.legacyPrimary, + unselectedLabelColor: + Theme.of(context).colorScheme.onSurface, + indicatorColor: context.sfColors.legacyPrimary, indicatorWeight: 3, labelStyle: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), @@ -100,7 +98,7 @@ class _ScheduledActivitiesScreenState ], ), footer: Material( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, shape: const CircleBorder(), child: InkWell( customBorder: const CircleBorder(), diff --git a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/activity_form_sheet.dart b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/activity_form_sheet.dart index 45c5560b..28d610e3 100644 --- a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/activity_form_sheet.dart +++ b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/activity_form_sheet.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -122,14 +122,13 @@ class _ActivityFormSheetState extends ConsumerState { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); final bottomInset = MediaQuery.of(context).viewInsets.bottom; return Padding( padding: EdgeInsets.only(bottom: bottomInset), child: Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical( top: Radius.circular(SizeUtils.getByScreen(small: 20, big: 18)), ), @@ -163,7 +162,7 @@ class _ActivityFormSheetState extends ConsumerState { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 20, big: 19), fontWeight: FontWeight.bold, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)), @@ -180,7 +179,6 @@ class _ActivityFormSheetState extends ConsumerState { ? widget.activity!.weekDay : _selectedWeekDay, enabled: !_isEditing, - theme: theme, onChanged: (value) => setState(() => _selectedWeekDay = value), ), @@ -195,7 +193,6 @@ class _ActivityFormSheetState extends ConsumerState { time: _startTime, isExpanded: _showStartPicker, onTap: () => _togglePicker(isStart: true), - theme: theme, ), ), SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)), @@ -205,7 +202,6 @@ class _ActivityFormSheetState extends ConsumerState { time: _endTime, isExpanded: _showEndPicker, onTap: () => _togglePicker(isStart: false), - theme: theme, ), ), ], @@ -226,9 +222,7 @@ class _ActivityFormSheetState extends ConsumerState { child: ElevatedButton( onPressed: _isFormValid ? _submit : null, style: ElevatedButton.styleFrom( - backgroundColor: theme.getColorFor( - ThemeCode.legacyPrimary, - ), + backgroundColor: context.sfColors.legacyPrimary, disabledBackgroundColor: Colors.grey[300], shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular( @@ -260,14 +254,12 @@ class _TimeSelector extends StatelessWidget { final TimeOfDay time; final bool isExpanded; final VoidCallback onTap; - final ThemePort theme; const _TimeSelector({ required this.label, required this.time, required this.isExpanded, required this.onTap, - required this.theme, }); @override @@ -282,7 +274,7 @@ class _TimeSelector extends StatelessWidget { decoration: BoxDecoration( border: Border.all( color: isExpanded - ? theme.getColorFor(ThemeCode.legacyPrimary) + ? context.sfColors.legacyPrimary : Colors.grey, width: isExpanded ? 2 : 1, ), @@ -295,8 +287,7 @@ class _TimeSelector extends StatelessWidget { label, style: TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -315,8 +306,7 @@ class _TimeSelector extends StatelessWidget { ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, size: SizeUtils.getByScreen(small: 20, big: 18), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ], diff --git a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/confirm_delete_activity_dialog.dart b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/confirm_delete_activity_dialog.dart index a87abc94..fb321fd0 100644 --- a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/confirm_delete_activity_dialog.dart +++ b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/confirm_delete_activity_dialog.dart @@ -6,6 +6,7 @@ import 'package:utils/utils.dart'; import '../../domain/entities/scheduled_activity_entity.dart'; import '../state/scheduled_activities_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class ConfirmDeleteActivityDialog extends ConsumerWidget { final ScheduledActivityEntity activity; @@ -14,7 +15,6 @@ class ConfirmDeleteActivityDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return Container( padding: SizeUtils.getByScreen( @@ -23,7 +23,7 @@ class ConfirmDeleteActivityDialog extends ConsumerWidget { ), width: SizeUtils.getByScreen(small: 360, big: 350), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 16, big: 14), ), @@ -48,7 +48,7 @@ class ConfirmDeleteActivityDialog extends ConsumerWidget { child: PrimaryButton( onPressed: () => Navigator.pop(context), text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), @@ -63,7 +63,7 @@ class ConfirmDeleteActivityDialog extends ConsumerWidget { .deleteActivity(activity.id); }, text: context.translate(I18n.delete), - color: const Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, height: SizeUtils.getByScreen(small: 38, big: 36), radius: SizeUtils.getByScreen(small: 32, big: 34), ), diff --git a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/day_timeline.dart b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/day_timeline.dart index b2460047..809b117f 100644 --- a/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/day_timeline.dart +++ b/modules/legacy/modules/device_management/lib/src/features/scheduled_activities/presentation/widgets/day_timeline.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -16,7 +17,6 @@ class DayTimeline extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); if (activities.isEmpty) { return Center( @@ -26,14 +26,14 @@ class DayTimeline extends ConsumerWidget { Icon( SFIcons.calendarCircle, size: SizeUtils.getByScreen(small: 48, big: 44), - color: theme.getColorFor(ThemeCode.textSecondary), + color: Theme.of(context).colorScheme.onPrimary, ), SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), Text( context.translate(I18n.scheduledActivityEmpty), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 15, big: 14), - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), SizedBox(height: SizeUtils.getByScreen(small: 6, big: 4)), @@ -41,7 +41,7 @@ class DayTimeline extends ConsumerWidget { context.translate(I18n.scheduledActivityEmptyHint), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 13, big: 12), - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ], @@ -58,7 +58,7 @@ class DayTimeline extends ConsumerWidget { itemBuilder: (context, index) { final activity = activities[index]; final isLast = index == activities.length - 1; - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return IntrinsicHeight( child: Row( @@ -67,12 +67,11 @@ class DayTimeline extends ConsumerWidget { _TimeLabels( startTime: activity.startTime, endTime: activity.endTime, - theme: theme, ), _TimelineDotAndLine(isLast: isLast, color: primaryColor), SizedBox(width: SizeUtils.getByScreen(small: 10, big: 8)), Expanded( - child: _ActivityTimelineCard(activity: activity, theme: theme), + child: _ActivityTimelineCard(activity: activity), ), ], ), @@ -85,12 +84,10 @@ class DayTimeline extends ConsumerWidget { class _TimeLabels extends StatelessWidget { final String startTime; final String endTime; - final ThemePort theme; const _TimeLabels({ required this.startTime, required this.endTime, - required this.theme, }); @override @@ -98,7 +95,7 @@ class _TimeLabels extends StatelessWidget { final style = TextStyle( fontSize: SizeUtils.getByScreen(small: 12, big: 11), fontWeight: FontWeight.w500, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ); return SizedBox( @@ -108,7 +105,7 @@ class _TimeLabels extends StatelessWidget { children: [ SizedBox(height: SizeUtils.getByScreen(small: 10, big: 8)), Text(startTime, style: style), - const Spacer(), + Spacer(), Padding( padding: EdgeInsets.only( bottom: SizeUtils.getByScreen(small: 14, big: 12), @@ -116,8 +113,7 @@ class _TimeLabels extends StatelessWidget { child: Text( endTime, style: style.copyWith( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withValues(alpha: 0.5), ), ), @@ -158,9 +154,8 @@ class _TimelineDotAndLine extends StatelessWidget { class _ActivityTimelineCard extends ConsumerWidget { final ScheduledActivityEntity activity; - final ThemePort theme; - const _ActivityTimelineCard({required this.activity, required this.theme}); + const _ActivityTimelineCard({required this.activity}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -174,7 +169,7 @@ class _ActivityTimelineCard extends ConsumerWidget { borderRadius: BorderRadius.circular( SizeUtils.getByScreen(small: 12, big: 10), ), - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, ), child: Row( children: [ @@ -195,10 +190,10 @@ class _ActivityTimelineCard extends ConsumerWidget { }, icon: Icon( Icons.edit_outlined, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: SizeUtils.getByScreen(small: 20, big: 18), ), - constraints: const BoxConstraints(), + constraints: BoxConstraints(), padding: EdgeInsets.all(SizeUtils.getByScreen(small: 8, big: 6)), ), IconButton( @@ -215,7 +210,7 @@ class _ActivityTimelineCard extends ConsumerWidget { }, icon: Icon( Icons.delete_outlined, - color: const Color(0xFFFF5D52), + color: Theme.of(context).colorScheme.error, size: SizeUtils.getByScreen(small: 20, big: 18), ), constraints: const BoxConstraints(), diff --git a/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/volume_control_screen.dart b/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/volume_control_screen.dart index d0d119ae..cb64b4fc 100644 --- a/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/volume_control_screen.dart +++ b/modules/legacy/modules/device_management/lib/src/features/volume_control/presentation/volume_control_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,7 +13,6 @@ class VolumeControlScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(volumeControlViewModelProvider.notifier); final state = ref.watch(volumeControlViewModelProvider); @@ -32,10 +32,9 @@ class VolumeControlScreen extends ConsumerWidget { if (done) Navigator.pop(context); }); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return LegacyPageLayout( - theme: theme, title: context.translate(I18n.volumeControl), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -69,7 +68,7 @@ class VolumeControlScreen extends ConsumerWidget { context.translate(I18n.volumeHint), style: TextStyle( fontSize: 13, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, height: 1.4, ), ), @@ -113,7 +112,7 @@ class _VolumeCard extends StatelessWidget { return Container( padding: const EdgeInsets.fromLTRB(16, 14, 16, 8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -133,14 +132,14 @@ class _VolumeCard extends StatelessWidget { const SizedBox(height: 4), Row( children: [ - Icon(Icons.volume_up, color: Colors.grey.shade400, size: 22), + Icon(Icons.volume_up, color: Theme.of(context).colorScheme.outline, size: 22), Expanded( child: SliderTheme( data: SliderThemeData( activeTrackColor: color, thumbColor: Colors.white, thumbShape: VolumeThumbShape(color: color), - inactiveTrackColor: Colors.grey.shade200, + inactiveTrackColor: Theme.of(context).colorScheme.outlineVariant, overlayColor: color.withValues(alpha: 0.1), trackHeight: 6, ), @@ -161,7 +160,7 @@ class _VolumeCard extends StatelessWidget { style: TextStyle( fontSize: 15, fontWeight: FontWeight.w500, - color: Colors.grey.shade600, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), diff --git a/modules/legacy/modules/device_management/pubspec.yaml b/modules/legacy/modules/device_management/pubspec.yaml index 4660f8f4..df9a0eb3 100644 --- a/modules/legacy/modules/device_management/pubspec.yaml +++ b/modules/legacy/modules/device_management/pubspec.yaml @@ -28,6 +28,8 @@ dependencies: #modules dependencies go here #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme sf_tracking: path: ../../../../packages/sf_tracking design_system: diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/device_setup_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/device_setup_screen.dart index 4e54d415..e4dbe782 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/device_setup_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/device_setup_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:legacy_auth/src/features/device_setup/presentation/state/device_setup_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/device_setup/presentation/state/device_setup_view_state.dart'; import 'package:legacy_auth/src/features/device_setup/presentation/enums/add_kid_step.dart'; import 'package:legacy_auth/src/features/device_setup/presentation/step_body.dart'; @@ -33,7 +34,6 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final state = ref.watch(legacyDeviceSetupViewModelProvider); final vm = ref.read(legacyDeviceSetupViewModelProvider.notifier); - final theme = ref.watch(themePortProvider); final isIntro = state.step == LegacyAddKidStep.intro; @@ -61,7 +61,7 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { vm.back(); }, child: Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: Column( children: [ @@ -76,20 +76,20 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { if (isIntro && isFirstDevice) IconButton( onPressed: () => _confirmLogout(context, ref), - icon: const Icon(Icons.logout), - color: theme.getColorFor(ThemeCode.textPrimary), + icon: Icon(Icons.logout), + color: Theme.of(context).colorScheme.onSurface, ) else if (isIntro) IconButton( onPressed: () => Navigator.maybePop(context), icon: Icon(Icons.adaptive.arrow_back), - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ) else IconButton( onPressed: vm.back, icon: Icon(Icons.adaptive.arrow_back), - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, tooltip: MaterialLocalizations.of( context, ).backButtonTooltip, @@ -100,7 +100,7 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { : StepIndicator( total: LegacyAddKidStep.mainStepCount, current: state.step.mainStepIndex + 1, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), const SizedBox(width: 48), @@ -145,7 +145,6 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { } await vm.next(); }, - theme: theme, ), ], ), @@ -155,8 +154,7 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { } void _confirmLogout(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; showDialog( context: context, @@ -186,7 +184,7 @@ class LegacyDeviceSetupScreen extends ConsumerWidget { }, child: Text( context.translate(I18n.logOut), - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/intro_step.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/intro_step.dart index 0b9c087c..da5ae176 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/intro_step.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/intro_step.dart @@ -1,5 +1,5 @@ import 'package:legacy_auth/src/features/device_setup/presentation/widgets/numbered_steps.dart'; -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -10,7 +10,6 @@ class LegacyIntroStepScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Padding( padding: EdgeInsets.symmetric( @@ -36,7 +35,7 @@ class LegacyIntroStepScreen extends ConsumerWidget { context.translate(I18n.deviceSetupIntroStep1), context.translate(I18n.deviceSetupIntroStep2), ], - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ], ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/scan_watch_step.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/scan_watch_step.dart index ce42e28b..98dfa9e2 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/scan_watch_step.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/steps/scan_watch_step.dart @@ -54,7 +54,7 @@ class LegacyScanWatchStepScreen extends ConsumerWidget { width: 170, height: 170, decoration: BoxDecoration( - border: Border.all(color: Colors.grey.shade500, width: 1), + border: Border.all(color: Theme.of(context).colorScheme.onSurfaceVariant, width: 1), borderRadius: BorderRadius.circular(16), ), child: Center( diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/success_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/success_screen.dart index 3b25481d..d64b74a6 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/success_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/success_screen.dart @@ -1,6 +1,6 @@ import 'package:legacy_auth/src/features/device_setup/presentation/state/device_setup_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/device_setup/presentation/widgets/flow_footer.dart'; -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:navigation/navigation.dart'; @@ -15,10 +15,9 @@ class LegacySuccessScreen extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final vm = ref.read(legacyDeviceSetupViewModelProvider.notifier); final state = ref.watch(legacyDeviceSetupViewModelProvider); - final theme = ref.watch(themePortProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: Column( children: [ @@ -30,7 +29,7 @@ class LegacySuccessScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 50, ), const SizedBox(height: 20), @@ -68,7 +67,6 @@ class LegacySuccessScreen extends ConsumerWidget { vm.resetForNewKid(); Navigator.of(context).pop(); }, - theme: theme, ), ], ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/activation_code_dialog.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/activation_code_dialog.dart index dd872f0c..bb31b662 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/activation_code_dialog.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/activation_code_dialog.dart @@ -30,7 +30,7 @@ class _ActivationCodeDialog extends StatelessWidget { Icon( Icons.email_outlined, size: SizeUtils.getByScreen(small: 48, big: 44), - color: const Color(0xFF329E95), + color: Theme.of(context).colorScheme.primary, ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 14)), Text( @@ -47,7 +47,7 @@ class _ActivationCodeDialog extends StatelessWidget { child: TextButton( onPressed: () => Navigator.pop(context), style: TextButton.styleFrom( - foregroundColor: const Color(0xFF329E95), + foregroundColor: Theme.of(context).colorScheme.primary, ), child: Text( context.translate(I18n.ok), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/flow_footer.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/flow_footer.dart index b0c85579..e30f4663 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/flow_footer.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/flow_footer.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; class LegacyFlowFooter extends StatelessWidget { @@ -6,14 +7,12 @@ class LegacyFlowFooter extends StatelessWidget { super.key, required this.primaryText, required this.onPrimary, - required this.theme, this.secondaryText, this.onSecondary, }); final String primaryText; final VoidCallback onPrimary; - final ThemePort theme; final String? secondaryText; final VoidCallback? onSecondary; @@ -22,8 +21,8 @@ class LegacyFlowFooter extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), - border: Border(top: BorderSide(color: Colors.grey.shade300, width: 1)), + color: Theme.of(context).colorScheme.surface, + border: Border(top: BorderSide(color: Theme.of(context).colorScheme.outline, width: 1)), borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), ), child: Padding( @@ -34,7 +33,7 @@ class LegacyFlowFooter extends StatelessWidget { PrimaryButton( text: primaryText, onPressed: onPrimary, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), if (secondaryText != null && onSecondary != null) ...[ const SizedBox(height: 10), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/numbered_steps.dart b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/numbered_steps.dart index 6a378c66..f9a4d550 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/numbered_steps.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/device_setup/presentation/widgets/numbered_steps.dart @@ -20,7 +20,7 @@ class LegacyNumberedSteps extends StatelessWidget { Widget build(BuildContext context) { final Color resolvedColor = color ?? Theme.of(context).colorScheme.secondaryContainer; - final Color resolvedTextColor = textColor ?? Colors.grey.shade800; + final Color resolvedTextColor = textColor ?? Theme.of(context).colorScheme.onSurface; final TextStyle resolvedTextStyle = textStyle ?? TextStyle( @@ -65,7 +65,7 @@ class LegacyNumberedSteps extends StatelessWidget { width: 4, height: 15, decoration: BoxDecoration( - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(99), ), ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/request_phone/request_link_phone_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/request_phone/request_link_phone_screen.dart index 66da021e..c721fb3f 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/request_phone/request_link_phone_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/request_phone/request_link_phone_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/link_phone/presentation/state/link_phone_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -15,13 +16,12 @@ class LegacyRequestLinkPhoneScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(legacyLinkPhoneViewModelProvider.notifier); final viewState = ref.watch(legacyLinkPhoneViewModelProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: Column( @@ -84,8 +84,8 @@ class LegacyRequestLinkPhoneScreen extends ConsumerWidget { Text( context.translate(viewState.errorMessage), textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -102,7 +102,7 @@ class LegacyRequestLinkPhoneScreen extends ConsumerWidget { } }, text: context.translate(I18n.next), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ], ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/verify_code/verify_link_phone_code_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/verify_code/verify_link_phone_code_screen.dart index 85db64ac..0604a2dd 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/verify_code/verify_link_phone_code_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/link_phone/presentation/verify_code/verify_link_phone_code_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/link_phone/presentation/state/link_phone_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/link_phone/presentation/widgets/link_phone_code_input.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; @@ -16,13 +17,12 @@ class LegacyVerifyLinkPhoneCodeScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(legacyLinkPhoneViewModelProvider.notifier); final viewState = ref.watch(legacyLinkPhoneViewModelProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Padding( padding: const EdgeInsets.symmetric(horizontal: 24), child: Center( @@ -69,8 +69,8 @@ class LegacyVerifyLinkPhoneCodeScreen extends ConsumerWidget { Text( context.translate(viewState.errorMessage), textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -91,7 +91,7 @@ class LegacyVerifyLinkPhoneCodeScreen extends ConsumerWidget { } }, text: context.translate(I18n.enter), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), const SizedBox(height: 24), Text( diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/login_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/login_screen.dart index a1523d7a..103950ad 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/login_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/login_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/login/domain/entities/legacy_auth_error_event.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/login/presentation/state/login_view_model.dart'; import 'package:legacy_auth/src/features/login/presentation/widgets/field_error_text.dart'; import 'package:legacy_auth/src/features/login/presentation/widgets/two_factor_sheet_launcher.dart'; @@ -30,7 +31,6 @@ class LegacyLoginScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final bool isLoading = ref.watch( legacyLoginViewModelProvider.select((s) => s.isLoading), ); @@ -73,7 +73,7 @@ class LegacyLoginScreen extends ConsumerWidget { ); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: AbsorbPointer( absorbing: isLoading, @@ -82,7 +82,7 @@ class LegacyLoginScreen extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _Header(theme: theme), + const _Header(), SizedBox(height: 48), _EmailSection(), SizedBox(height: 24), @@ -96,7 +96,6 @@ class LegacyLoginScreen extends ConsumerWidget { // _ForgotPassword(navigationContract: navigationContract), // SizedBox(height: 30), _SignInSection( - theme: theme, onSignIn: () { FocusManager.instance.primaryFocus?.unfocus(); ref.read(legacyLoginViewModelProvider.notifier).login(); @@ -114,8 +113,7 @@ class LegacyLoginScreen extends ConsumerWidget { } class _Header extends StatelessWidget { - const _Header({required this.theme}); - final ThemePort theme; + const _Header(); @override Widget build(BuildContext context) { @@ -123,7 +121,7 @@ class _Header extends StatelessWidget { children: [ Icon( Icons.check, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 54, ), Text( @@ -217,10 +215,9 @@ class _ForgotPassword extends ConsumerWidget { } class _SignInSection extends ConsumerWidget { - const _SignInSection({required this.onSignIn, required this.theme}); + const _SignInSection({required this.onSignIn}); final VoidCallback onSignIn; - final ThemePort theme; @override Widget build(BuildContext context, WidgetRef ref) { @@ -234,7 +231,7 @@ class _SignInSection extends ConsumerWidget { PrimaryButton( onPressed: isLoading ? () {} : onSignIn, text: context.translate(I18n.signIn), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, leading: isLoading ? const SizedBox( height: 18, diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart index 9eed2bff..5c6f7cd4 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_bottom_sheet.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:legacy_auth/src/features/login/presentation/widgets/otp_code_fields.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -8,7 +9,6 @@ import 'package:utils/utils.dart'; class LegacyTwoFactorBottomSheetView extends StatelessWidget { const LegacyTwoFactorBottomSheetView({ super.key, - required this.theme, required this.title, required this.subtitle, required this.verifyText, @@ -24,8 +24,6 @@ class LegacyTwoFactorBottomSheetView extends StatelessWidget { required this.onClose, }); - final ThemePort theme; - final String title; final String subtitle; final String verifyText; @@ -50,7 +48,7 @@ class LegacyTwoFactorBottomSheetView extends StatelessWidget { return Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: const BorderRadius.vertical(top: Radius.circular(24)), ), padding: EdgeInsets.fromLTRB(12, 12, 12, 24 + bottomInset), @@ -98,7 +96,7 @@ class LegacyTwoFactorBottomSheetView extends StatelessWidget { ? () {} : () => unawaited(onVerify()), text: verifyText, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, leading: isOtpLoading ? const SizedBox( height: 18, diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_sheet_launcher.dart b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_sheet_launcher.dart index eee6d8e0..6ea1d68a 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_sheet_launcher.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/login/presentation/widgets/two_factor_sheet_launcher.dart @@ -28,7 +28,6 @@ void showTwoFactorSheet(BuildContext context) { builder: (sheetContext) { return Consumer( builder: (sheetContext, ref, _) { - final theme = ref.watch(themePortProvider); final vm = ref.read(legacyLoginViewModelProvider.notifier); final otpErrorKey = ref.watch( @@ -73,7 +72,6 @@ void showTwoFactorSheet(BuildContext context) { final canResend = !isLoading && resendCooldown == 0; return LegacyTwoFactorBottomSheetView( - theme: theme, title: sheetContext.translate(I18n.twoFactorTitle), subtitle: sheetContext.translate(I18n.twoFactorSubtitle), verifyText: sheetContext.translate(I18n.twoFactorVerify), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/onboarding/presentation/onboarding_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/onboarding/presentation/onboarding_screen.dart index 0c9eccc3..fa58e52c 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/onboarding/presentation/onboarding_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/onboarding/presentation/onboarding_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/onboarding/domain/onboarding_page.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/onboarding/presentation/onboarding_view_model.dart'; import 'package:legacy_auth/src/features/onboarding/presentation/widgets/onboarding_content.dart'; import 'package:design_system/design_system.dart'; @@ -23,11 +24,10 @@ class LegacyOnboardingScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(legacyOnBoardingViewModelProvider); final viewModel = ref.read(legacyOnBoardingViewModelProvider.notifier); final pageController = ref.watch(legacyOnboardingPageControllerProvider); - final legacyColor = theme.getColorFor(ThemeCode.legacyPrimary); + final legacyColor = context.sfColors.legacyPrimary; final isLast = state.cardIndex >= onboardingPages.length - 1; diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/new_password/new_password_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/new_password/new_password_screen.dart index a48ae87d..5565eeec 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/new_password/new_password_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/new_password/new_password_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/recover_password/presentation/state/recover_password_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:legacy_auth/src/features/recover_password/presentation/state/recover_password_view_state.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; @@ -16,13 +17,12 @@ class LegacyNewPasswordScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final NavigationContract navigationContract = GetIt.I(); - final theme = ref.watch(themePortProvider); final viewModel = ref.read(legacyRecoverPasswordViewModelProvider.notifier); final viewState = ref.watch(legacyRecoverPasswordViewModelProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Container( margin: const EdgeInsets.symmetric(horizontal: 24), child: Center( @@ -56,23 +56,23 @@ class LegacyNewPasswordScreen extends ConsumerWidget { hint: '********', controller: viewModel.repeatedPasswordController, // onVisibilityChanged: viewModel.togglePasswordVisible, - // color: viewState.equalPasswords ? const Color(0xFF4B4B4B) : const Color.fromRGBO(239, 17, 17, 1), + // color: viewState.equalPasswords ? Theme.of(context).colorScheme.onSurface : Theme.of(context).colorScheme.error, ), if (!viewState.equalPasswords) ...[ SizedBox(height: 4), Row( spacing: 8, children: [ - const Icon( + Icon( Icons.info_outline_rounded, - color: Color.fromRGBO(239, 17, 17, 1), + color: Theme.of(context).colorScheme.error, size: 16, ), Text( context.translate(I18n.errorMessageUnequalPasswords), textAlign: TextAlign.left, style: TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + color: Theme.of(context).colorScheme.error, fontSize: 10, ), ), @@ -86,11 +86,9 @@ class LegacyNewPasswordScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor( - viewState.securityChecks['min']! - ? ThemeCode.legacyPrimary - : ThemeCode.buttonSecondary, - ), + color: viewState.securityChecks['min']! + ? context.sfColors.legacyPrimary + : Theme.of(context).colorScheme.secondary, ), Text( context.translate(I18n.passwordLength), @@ -110,11 +108,9 @@ class LegacyNewPasswordScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor( - viewState.securityChecks['capital']! - ? ThemeCode.legacyPrimary - : ThemeCode.buttonSecondary, - ), + color: viewState.securityChecks['capital']! + ? context.sfColors.legacyPrimary + : Theme.of(context).colorScheme.secondary, ), Text( context.translate(I18n.passwordCapital), @@ -134,11 +130,9 @@ class LegacyNewPasswordScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor( - viewState.securityChecks['number']! - ? ThemeCode.legacyPrimary - : ThemeCode.buttonSecondary, - ), + color: viewState.securityChecks['number']! + ? context.sfColors.legacyPrimary + : Theme.of(context).colorScheme.secondary, ), Text( context.translate(I18n.passwordNumber), @@ -158,11 +152,9 @@ class LegacyNewPasswordScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor( - viewState.securityChecks['special']! - ? ThemeCode.legacyPrimary - : ThemeCode.buttonSecondary, - ), + color: viewState.securityChecks['special']! + ? context.sfColors.legacyPrimary + : Theme.of(context).colorScheme.secondary, ), Text( context.translate(I18n.passwordSpecial), @@ -181,8 +173,8 @@ class LegacyNewPasswordScreen extends ConsumerWidget { Text( context.translate(viewState.displayErrorKey!), textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -199,7 +191,7 @@ class LegacyNewPasswordScreen extends ConsumerWidget { } }, text: context.translate(I18n.accept), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ], ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/request_recovery/request_recovery_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/request_recovery/request_recovery_screen.dart index 8979dba1..438dd69c 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/request_recovery/request_recovery_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/request_recovery/request_recovery_screen.dart @@ -19,13 +19,12 @@ class LegacyRequestRecoveryScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(legacyRecoverPasswordViewModelProvider.notifier); final viewState = ref.watch(legacyRecoverPasswordViewModelProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Container( margin: EdgeInsets.all( SizeUtils.getByScreen(small: 30, big: 30, xl: 20), @@ -63,8 +62,8 @@ class LegacyRequestRecoveryScreen extends ConsumerWidget { Text( context.translate(viewState.displayErrorKey!), textAlign: TextAlign.center, - style: const TextStyle( - color: Color.fromRGBO(239, 17, 17, 1), + style: TextStyle( + color: Theme.of(context).colorScheme.error, fontSize: 12, ), ), @@ -103,7 +102,7 @@ class LegacyRequestRecoveryScreen extends ConsumerWidget { }, text: context.translate(I18n.send), size: SizeUtils.getByScreen(small: 16, big: 16, xl: 14), - color: theme.getColorFor(ThemeCode.buttonSecondary), + color: Theme.of(context).colorScheme.secondary, ), ), ], diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/sent/sent_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/sent/sent_screen.dart index 084e6a7b..c493b017 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/sent/sent_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/recover_password/presentation/sent/sent_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/recover_password/presentation/new_password/new_password_screen.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -15,12 +16,11 @@ class LegacySentScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final viewModel = ref.read(legacyRecoverPasswordViewModelProvider.notifier); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Container( margin: EdgeInsets.all(24), child: Center( @@ -44,7 +44,7 @@ class LegacySentScreen extends ConsumerWidget { children: [ Icon( Icons.check, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), SizedBox( width: SizeUtils.getByScreen(small: 10, big: 10, xl: 6), @@ -106,7 +106,7 @@ class LegacySentScreen extends ConsumerWidget { ), ), text: context.translate(I18n.continueKey), - color: theme.getColorFor(ThemeCode.buttonSecondary), + color: Theme.of(context).colorScheme.secondary, size: SizeUtils.getByScreen(small: 16, big: 16, xl: 14), ), ), diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart index d303a344..c3b41a7c 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/account_created_screen.dart @@ -1,4 +1,5 @@ import 'package:legacy_auth/src/features/sign_up/presentation/state/sign_up_view_model.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -15,7 +16,6 @@ class LegacyAccountCreatedScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(legacySignUpViewModelProvider); @@ -23,7 +23,7 @@ class LegacyAccountCreatedScreen extends ConsumerWidget { final String fullName = '${state.firstName} ${state.lastName}'.trim(); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: Container( margin: const EdgeInsets.all(30), child: Center( @@ -32,7 +32,7 @@ class LegacyAccountCreatedScreen extends ConsumerWidget { const Spacer(flex: 10), Icon( Icons.check, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 50, ), const SizedBox(height: 20), @@ -83,7 +83,7 @@ class LegacyAccountCreatedScreen extends ConsumerWidget { PrimaryButton( onPressed: () => navigationContract.goTo(AppRoutes.legacyLogin), text: context.translate(I18n.accountCreatedContinue), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), const Spacer(flex: 8), ], diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_password_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_password_screen.dart index 740be2cd..c2d2fd0c 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_password_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_password_screen.dart @@ -105,7 +105,7 @@ class _CriteriaRow extends StatelessWidget { color = Colors.green; icon = Icons.check_circle; } else { - color = Colors.red.shade400; + color = Theme.of(context).colorScheme.error; icon = Icons.cancel; } diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart index bfc4cf91..ebe5baf5 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/screens/sign_up_personal_screen.dart @@ -1,4 +1,5 @@ import 'package:country_code_picker/country_code_picker.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -26,7 +27,6 @@ class LegacySignupPersonalScreen extends StatelessWidget { final bool acceptTerms; final ValueChanged? onAcceptTermsPressed; final String termsText; - final ThemePort theme; const LegacySignupPersonalScreen({ super.key, @@ -47,7 +47,6 @@ class LegacySignupPersonalScreen extends StatelessWidget { required this.acceptTerms, required this.onAcceptTermsPressed, required this.termsText, - required this.theme, }); @override @@ -105,7 +104,7 @@ class LegacySignupPersonalScreen extends StatelessWidget { ), checkboxScaleFactor: 1.5, contentPadding: EdgeInsets.zero, - activeColor: theme.getColorFor(ThemeCode.legacyPrimary), + activeColor: context.sfColors.legacyPrimary, controlAffinity: ListTileControlAffinity.leading, ), ], diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_screen.dart b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_screen.dart index 5efe0e90..ac54c3e2 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_screen.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_screen.dart @@ -46,7 +46,6 @@ class LegacySignupScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(legacySignUpViewModelProvider.notifier); final state = ref.watch(legacySignUpViewModelProvider); @@ -86,7 +85,6 @@ class LegacySignupScreen extends ConsumerWidget { return LegacyAccountCreatedScreen(navigationContract: navigationContract); } return LegacySignUpLayout( - theme: theme, supertitle: step.supertitle, title: step.title, subtitle: step.subtitle ?? '', diff --git a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_steps.dart b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_steps.dart index aff44310..f21344f7 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_steps.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/features/sign_up/presentation/sign_up_steps.dart @@ -1,5 +1,4 @@ import 'package:country_code_picker/country_code_picker.dart'; -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:legacy_auth/src/features/sign_up/models/sign_up_step_config.dart'; import 'package:legacy_auth/src/features/sign_up/presentation/screens/sign_up_password_screen.dart'; @@ -13,7 +12,6 @@ List signUpSteps(BuildContext context) => [ title: context.translate(I18n.stepUserContactTitle), subtitle: context.translate(I18n.stepUserContactSubtitle), bodyBuilder: (context, ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(legacySignUpViewModelProvider.notifier); final state = ref.watch(legacySignUpViewModelProvider); @@ -26,7 +24,6 @@ List signUpSteps(BuildContext context) => [ acceptTerms: state.acceptTerms, onAcceptTermsPressed: (v) => vm.setAcceptTerms(v ?? false), termsText: context.translate(I18n.termsText), - theme: theme, firstNameLabel: context.translate(I18n.firstNameLabel), firstNameHint: context.translate(I18n.firstNameHint), diff --git a/modules/legacy/modules/legacy_auth/lib/src/widgets/form_error_banner.dart b/modules/legacy/modules/legacy_auth/lib/src/widgets/form_error_banner.dart index 8c356c38..9afaac25 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/widgets/form_error_banner.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/widgets/form_error_banner.dart @@ -21,7 +21,7 @@ class LegacyFormErrorBanner extends StatelessWidget { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Icon(Icons.error_outline, size: 18, color: Colors.red), + Icon(Icons.error_outline, size: 18, color: Theme.of(context).colorScheme.error), const SizedBox(width: 8), Expanded( child: Text( diff --git a/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/form_step_layout.dart b/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/form_step_layout.dart index 6c95d026..094e5d84 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/form_step_layout.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/form_step_layout.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -32,11 +33,11 @@ class LegacyFormStepLayout extends ConsumerWidget { final theme = ref.watch(themePortProvider); return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: SingleChildScrollView( child: Container( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, padding: EdgeInsets.only(left: 24, right: 24), child: Column( children: [ @@ -47,7 +48,7 @@ class LegacyFormStepLayout extends ConsumerWidget { child: StepIndicator( total: numSteps, current: currentStep, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), SizedBox(height: 16), @@ -107,7 +108,7 @@ class LegacyFormStepLayout extends ConsumerWidget { return PrimaryButton( onPressed: nextStep, text: context.translate(I18n.continueKey), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ); } else { return Row( @@ -125,7 +126,7 @@ class LegacyFormStepLayout extends ConsumerWidget { onPressed: nextStep, text: context.translate(I18n.next), size: 16, - color: theme.getColorFor(ThemeCode.buttonSecondary), + color: Theme.of(context).colorScheme.secondary, ), ), ], diff --git a/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/sign_up_layout.dart b/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/sign_up_layout.dart index 6390052e..2e61525a 100644 --- a/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/sign_up_layout.dart +++ b/modules/legacy/modules/legacy_auth/lib/src/widgets/layouts/sign_up_layout.dart @@ -1,9 +1,9 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:sf_localizations/sf_localizations.dart'; class LegacySignUpLayout extends StatelessWidget { - final ThemePort theme; final String title; final String subtitle; final String supertitle; @@ -18,7 +18,6 @@ class LegacySignUpLayout extends StatelessWidget { const LegacySignUpLayout({ super.key, - required this.theme, required this.title, required this.subtitle, required this.supertitle, @@ -46,10 +45,10 @@ class LegacySignUpLayout extends StatelessWidget { Widget _buildScaffold(BuildContext context) { return Scaffold( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, body: SafeArea( child: Container( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, padding: const EdgeInsets.only(left: 24, right: 24), child: Column( children: [ @@ -58,7 +57,7 @@ class LegacySignUpLayout extends StatelessWidget { child: StepIndicator( total: numSteps, current: currentStep, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), const SizedBox(height: 8), @@ -106,7 +105,7 @@ class LegacySignUpLayout extends StatelessWidget { onPressed: onNextPressed, text: context.translate(I18n.next), size: 16, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ], diff --git a/modules/legacy/modules/legacy_auth/pubspec.yaml b/modules/legacy/modules/legacy_auth/pubspec.yaml index 2bc7bcff..48b7b9b6 100644 --- a/modules/legacy/modules/legacy_auth/pubspec.yaml +++ b/modules/legacy/modules/legacy_auth/pubspec.yaml @@ -13,6 +13,8 @@ dependencies: flutter: sdk: flutter #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme design_system: path: ../../../../packages/design_system navigation: diff --git a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart index 84232f85..dfeae5da 100644 --- a/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart +++ b/modules/legacy/modules/legacy_dashboard_shell/lib/src/presentation/legacy_main_shell_screen.dart @@ -17,12 +17,11 @@ class LegacyDashboardScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return Scaffold( body: navigationShell, bottomNavigationBar: NavigationBar( - backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary), + backgroundColor: Theme.of(context).colorScheme.surface, selectedIndex: navigationShell.currentIndex, onDestinationSelected: (index) { navigationShell.goBranch(index); diff --git a/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml b/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml index 645bd010..3852b4bb 100644 --- a/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml +++ b/modules/legacy/modules/legacy_dashboard_shell/pubspec.yaml @@ -18,6 +18,8 @@ dependencies: control_panel: path: ../../modules/control_panel #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme design_system: path: ../../../../packages/design_system sf_localizations: diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart index e21bd47e..6535f28b 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/location_screen.dart @@ -13,7 +13,6 @@ class LocationScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final asyncDeviceState = ref.watch(legacyDeviceViewModelProvider); final asyncLocationState = ref.watch(locationViewModelProvider); @@ -111,7 +110,6 @@ class LocationScreen extends ConsumerWidget { deviceState == null; return LegacyPageLayout( - theme: theme, title: context.translate(I18n.mapTitle), showBack: false, body: isLoading diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart index 2b2d4eeb..d28dfb25 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_frequent_place_sheet.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:latlong2/latlong.dart'; @@ -104,7 +104,7 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { void _addWifi() { setState(() { - _wifiList.add(const WifiInfoEntity(ssid: '', bssid: '', signal: '')); + _wifiList.add(WifiInfoEntity(ssid: '', bssid: '', signal: '')); }); } @@ -118,8 +118,7 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final isSubmitting = ref.watch( locationViewModelProvider.select((s) => s.value?.isSubmitting ?? false), ); @@ -134,7 +133,7 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { builder: (context, scrollController) { return Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: ListView( @@ -149,7 +148,7 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), @@ -256,12 +255,12 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { style: const TextStyle(fontSize: 13), ), ), - const SizedBox(width: 8), + SizedBox(width: 8), GestureDetector( onTap: () => _removeWifi(i), child: Icon( Icons.remove_circle_outline, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, size: 22, ), ), @@ -275,7 +274,7 @@ class _FrequentPlaceSheetState extends ConsumerState<_FrequentPlaceSheet> { padding: const EdgeInsets.only(top: 8), child: Text( context.translate(I18n.errorGeneric), - style: const TextStyle(color: Colors.red, fontSize: 13), + style: TextStyle(color: Theme.of(context).colorScheme.error, fontSize: 13), ), ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 10)), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart index 261cd218..5b6e0d71 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/create_geofence_sheet.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:latlong2/latlong.dart'; @@ -123,8 +123,7 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final isSubmitting = ref.watch( locationViewModelProvider.select((s) => s.value?.isSubmitting ?? false), ); @@ -139,7 +138,7 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { builder: (context, scrollController) { return Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: ListView( @@ -154,7 +153,7 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), @@ -255,7 +254,7 @@ class _GeofenceSheetState extends ConsumerState<_GeofenceSheet> { padding: const EdgeInsets.only(top: 8), child: Text( context.translate(I18n.errorGeneric), - style: const TextStyle(color: Colors.red, fontSize: 13), + style: TextStyle(color: Theme.of(context).colorScheme.error, fontSize: 13), ), ), SizedBox(height: SizeUtils.getByScreen(small: 8, big: 10)), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/device_banner.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/device_banner.dart index 1ceeb5a4..442f5d06 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/device_banner.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/device_banner.dart @@ -1,5 +1,5 @@ import 'package:legacy_shared/legacy_shared.dart'; -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_shared/sf_shared.dart'; @@ -57,8 +57,7 @@ class _DeviceBannerState extends ConsumerState { @override Widget build(BuildContext context) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Container( width: SizeUtils.getByScreen(small: 340, big: 338), @@ -66,7 +65,7 @@ class _DeviceBannerState extends ConsumerState { bottom: SizeUtils.getByScreen(small: 16, big: 14), ), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( @@ -117,7 +116,7 @@ class _DeviceBannerState extends ConsumerState { borderRadius: BorderRadius.circular(3), color: i == _currentPage ? primaryColor - : Colors.grey.shade300, + : Theme.of(context).colorScheme.outline, ), ), ), @@ -188,7 +187,7 @@ class _DeviceCard extends StatelessWidget { style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, - color: Colors.grey.shade800, + color: Theme.of(context).colorScheme.onSurface, ), overflow: TextOverflow.ellipsis, ), @@ -200,7 +199,7 @@ class _DeviceCard extends StatelessWidget { Icon( Icons.location_on, size: 12, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, ), const SizedBox(width: 3), Expanded( @@ -208,7 +207,7 @@ class _DeviceCard extends StatelessWidget { addressText, style: TextStyle( fontSize: 11, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), overflow: TextOverflow.ellipsis, ), @@ -255,7 +254,7 @@ class _DeviceCard extends StatelessWidget { formatPositionDate(position!.positionDate), style: TextStyle( fontSize: 10, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, ), ), ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_list_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_list_sheet.dart index 7a51bb17..f53b3387 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_list_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_list_sheet.dart @@ -56,8 +56,8 @@ class _LocationListSheetState extends ConsumerState { maxChildSize: 0.85, builder: (context, scrollController) { return Container( - decoration: const BoxDecoration( - color: Colors.white, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(16)), boxShadow: [ BoxShadow( @@ -188,10 +188,10 @@ class _LocationListSheetState extends ConsumerState { decoration: BoxDecoration( color: isSelected ? Colors.purple.withValues(alpha: 0.15) - : Colors.grey.shade100, + : Theme.of(context).colorScheme.outlineVariant, borderRadius: BorderRadius.circular(16), border: Border.all( - color: isSelected ? Colors.purple : Colors.grey.shade300, + color: isSelected ? Colors.purple : Theme.of(context).colorScheme.outline, width: 1.5, ), ), @@ -200,7 +200,7 @@ class _LocationListSheetState extends ConsumerState { style: TextStyle( fontSize: 11, fontWeight: FontWeight.w600, - color: isSelected ? Colors.purple : Colors.grey.shade600, + color: isSelected ? Colors.purple : Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), @@ -214,7 +214,7 @@ class _LocationListSheetState extends ConsumerState { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), @@ -270,7 +270,7 @@ class _LocationListSheetState extends ConsumerState { elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey.shade200), + side: BorderSide(color: Theme.of(context).colorScheme.outlineVariant), ), child: ListTile( dense: true, @@ -291,11 +291,11 @@ class _LocationListSheetState extends ConsumerState { ), subtitle: Text( subtitle, - style: TextStyle(fontSize: 11, color: Colors.grey.shade600), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), trailing: Icon( Icons.chevron_right, - color: Colors.grey.shade400, + color: Theme.of(context).colorScheme.outline, size: 20, ), onTap: onTap, diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart index ea899e82..50d985e4 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/location_map.dart @@ -30,6 +30,7 @@ import 'map_info_cards/geofence_info_card.dart'; import 'map_info_cards/history_position_info_card.dart'; import 'modal_overlay.dart'; import 'route_history_layer.dart'; +import 'package:legacy_theme/legacy_theme.dart'; const _defaultCenter = LatLng(40.4168, -3.7038); const _defaultZoom = 17.0; @@ -77,7 +78,7 @@ class _LocationMapState extends ConsumerState ref.read(locationMapViewModelProvider.notifier); Color get _primaryColor => - ref.read(themePortProvider).getColorFor(ThemeCode.legacyPrimary); + context.sfColors.legacyPrimary; @override void initState() { diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/layer_toggles.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/layer_toggles.dart index 5b60107f..94af8113 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/layer_toggles.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/layer_toggles.dart @@ -90,7 +90,7 @@ class _LayerChip extends StatelessWidget { color: isActive ? color : Colors.white, borderRadius: BorderRadius.circular(20), border: Border.all( - color: isActive ? color : Colors.grey.shade400, + color: isActive ? color : Theme.of(context).colorScheme.outline, width: 1.5, ), boxShadow: [ @@ -107,7 +107,7 @@ class _LayerChip extends StatelessWidget { Icon( icon, size: 16, - color: isActive ? Colors.white : Colors.grey.shade600, + color: isActive ? Colors.white : Theme.of(context).colorScheme.onSurfaceVariant, ), const SizedBox(width: 5), Text( @@ -115,7 +115,7 @@ class _LayerChip extends StatelessWidget { style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, - color: isActive ? Colors.white : Colors.grey.shade600, + color: isActive ? Colors.white : Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_action_button.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_action_button.dart index a030b8e2..d7547768 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_action_button.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_action_button.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -16,13 +16,12 @@ class MapActionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Material( color: isActive ? primaryColor - : theme.getColorFor(ThemeCode.backgroundPrimary), + : Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(8), elevation: 2, child: InkWell( diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_style_selector.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_style_selector.dart index 35a9fbd8..4c82f451 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_style_selector.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/map_style_selector.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -28,12 +28,11 @@ class _MapStyleSelectorState extends ConsumerState { @override Widget build(BuildContext context) { final currentStyle = ref.watch(mapStyleProvider); - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; if (!_expanded) { return Material( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(8), elevation: 2, child: InkWell( @@ -50,7 +49,7 @@ class _MapStyleSelectorState extends ConsumerState { return Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -85,7 +84,7 @@ class _MapStyleSelectorState extends ConsumerState { ? Icons.satellite_alt : Icons.map, size: 16, - color: isSelected ? primaryColor : Colors.grey.shade600, + color: isSelected ? primaryColor : Theme.of(context).colorScheme.onSurfaceVariant, ), const SizedBox(width: 8), Text( @@ -95,7 +94,7 @@ class _MapStyleSelectorState extends ConsumerState { fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400, - color: isSelected ? primaryColor : Colors.grey.shade700, + color: isSelected ? primaryColor : Theme.of(context).colorScheme.onSurface, ), ), ], diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/placement_banner.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/placement_banner.dart index 8647209c..8685465e 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/placement_banner.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/placement_banner.dart @@ -1,7 +1,7 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class PlacementBanner extends ConsumerWidget { final VoidCallback onCancel; @@ -15,13 +15,11 @@ class PlacementBanner extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final primaryColor = ref - .read(themePortProvider) - .getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -38,10 +36,10 @@ class PlacementBanner extends ConsumerWidget { child: Container( padding: const EdgeInsets.all(6), decoration: BoxDecoration( - color: Colors.grey.shade200, + color: Theme.of(context).colorScheme.outlineVariant, shape: BoxShape.circle, ), - child: Icon(Icons.close, size: 20, color: Colors.grey.shade700), + child: Icon(Icons.close, size: 20, color: Theme.of(context).colorScheme.onSurface), ), ), const SizedBox(width: 12), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/radius_slider_bar.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/radius_slider_bar.dart index 7c34ea0f..0ada1802 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/radius_slider_bar.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_controls/radius_slider_bar.dart @@ -22,7 +22,7 @@ class RadiusSliderBar extends StatelessWidget { return Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( @@ -42,13 +42,13 @@ class RadiusSliderBar extends StatelessWidget { child: Container( padding: const EdgeInsets.all(4), decoration: BoxDecoration( - color: Colors.grey.shade200, + color: Theme.of(context).colorScheme.outlineVariant, shape: BoxShape.circle, ), child: Icon( Icons.close, size: 18, - color: Colors.grey.shade700, + color: Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/geofence_info_card.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/geofence_info_card.dart index 7141d1c9..92da6ccf 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/geofence_info_card.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/geofence_info_card.dart @@ -1,10 +1,10 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:location/src/core/domain/entities/geofence_entity.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'map_info_card.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class GeofenceInfoCard extends ConsumerWidget { final GeofenceEntity geofence; @@ -22,9 +22,7 @@ class GeofenceInfoCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final primaryColor = ref - .read(themePortProvider) - .getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return MapItemInfoCard( icon: Icons.shield, iconColor: Colors.blue, @@ -39,7 +37,7 @@ class GeofenceInfoCard extends ConsumerWidget { geofence.description!.isNotEmpty) ...[ Text( geofence.description!, - style: TextStyle(fontSize: 13, color: Colors.grey.shade600), + style: TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.onSurfaceVariant), maxLines: 2, overflow: TextOverflow.ellipsis, ), diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/map_info_card.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/map_info_card.dart index 3a6c86e4..3a007b22 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/map_info_card.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/map_info_cards/map_info_card.dart @@ -1,16 +1,16 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; +import 'package:legacy_theme/legacy_theme.dart'; Widget infoRow(IconData icon, String label, String value, {Color? iconColor}) { return Row( children: [ - Icon(icon, size: 16, color: iconColor ?? Colors.grey.shade500), + Icon(icon, size: 16, color: iconColor ?? Colors.grey.shade600), const SizedBox(width: 6), Text( '$label: ', - style: TextStyle(fontSize: 12, color: Colors.grey.shade500), + style: TextStyle(fontSize: 12, color: Colors.grey.shade600), ), Expanded( child: Text( @@ -45,16 +45,14 @@ class MapItemInfoCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final primaryColor = ref - .read(themePortProvider) - .getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return GestureDetector( onTap: () {}, child: Container( width: 280, padding: const EdgeInsets.all(16), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( @@ -94,7 +92,7 @@ class MapItemInfoCard extends ConsumerWidget { child: Icon( Icons.close, size: 20, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -140,14 +138,14 @@ class MapItemInfoCard extends ConsumerWidget { horizontal: 14, ), decoration: BoxDecoration( - color: Colors.grey.shade100, + color: Theme.of(context).colorScheme.outlineVariant, borderRadius: BorderRadius.circular(10), - border: Border.all(color: Colors.grey.shade400), + border: Border.all(color: Theme.of(context).colorScheme.outline), ), child: Icon( Icons.delete_outline, size: 18, - color: Colors.grey.shade600, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), @@ -184,7 +182,7 @@ class ReadOnlyInfoCard extends StatelessWidget { width: 280, padding: const EdgeInsets.all(16), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( @@ -224,7 +222,7 @@ class ReadOnlyInfoCard extends StatelessWidget { child: Icon( Icons.close, size: 20, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], diff --git a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/name_input_sheet.dart b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/name_input_sheet.dart index 472c2047..64ec863b 100644 --- a/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/name_input_sheet.dart +++ b/modules/legacy/modules/location/lib/src/features/location/presentation/widgets/name_input_sheet.dart @@ -1,10 +1,10 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; import 'location_input_decoration.dart'; +import 'package:legacy_theme/legacy_theme.dart'; Future showNameInputSheet( BuildContext context, { @@ -17,9 +17,7 @@ Future showNameInputSheet( String? submitLabel, required Future Function(String name, String? description) onSubmit, }) { - final primaryColor = ref - .read(themePortProvider) - .getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final resolvedSubmitLabel = submitLabel ?? context.translate(I18n.locationCreate); @@ -94,8 +92,8 @@ class _NameInputSheetContentState extends State<_NameInputSheetContent> { return Padding( padding: EdgeInsets.only(bottom: bottomInset), child: Container( - decoration: const BoxDecoration( - color: Colors.white, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: SafeArea( @@ -114,7 +112,7 @@ class _NameInputSheetContentState extends State<_NameInputSheetContent> { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), diff --git a/modules/legacy/modules/location/pubspec.yaml b/modules/legacy/modules/location/pubspec.yaml index 7b0c0770..59b3bdb2 100644 --- a/modules/legacy/modules/location/pubspec.yaml +++ b/modules/legacy/modules/location/pubspec.yaml @@ -13,6 +13,8 @@ dependencies: sdk: flutter legacy_device_state: path: ../../packages/legacy_device_state + legacy_theme: + path: ../../packages/legacy_theme design_system: path: ../../../../packages/design_system sf_localizations: diff --git a/modules/legacy/modules/settings/lib/settings.dart b/modules/legacy/modules/settings/lib/settings.dart index 0c260714..b506cc56 100644 --- a/modules/legacy/modules/settings/lib/settings.dart +++ b/modules/legacy/modules/settings/lib/settings.dart @@ -1,5 +1,6 @@ export 'src/features/settings/settings_builder.dart'; export 'src/features/alarm/alarm_builder.dart'; +export 'src/features/appearance/appearance_builder.dart'; export 'src/features/app_store/app_store_builder.dart'; export 'src/features/battery/battery_builder.dart'; export 'src/features/block_phone/block_phone_builder.dart'; diff --git a/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_form_sheet.dart b/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_form_sheet.dart index 571ffdca..ce74f386 100644 --- a/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_form_sheet.dart +++ b/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_form_sheet.dart @@ -41,8 +41,8 @@ class ContactFormSheet extends StatelessWidget { return Padding( padding: EdgeInsets.only(bottom: bottomInset), child: Container( - decoration: const BoxDecoration( - color: Colors.white, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: SafeArea( @@ -117,7 +117,7 @@ class _DragHandle extends StatelessWidget { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), diff --git a/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_list_contact_card.dart b/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_list_contact_card.dart index 7d14c3ea..635ae470 100644 --- a/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_list_contact_card.dart +++ b/modules/legacy/modules/settings/lib/src/core/presentation/widgets/contact_list_contact_card.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -7,13 +7,11 @@ import '../../domain/entities/contact_list_contact_entity.dart'; class ContactListContactCard extends StatelessWidget { final ContactListContactEntity contact; final VoidCallback onDelete; - final ThemePort theme; const ContactListContactCard({ super.key, required this.contact, required this.onDelete, - required this.theme, }); @override @@ -28,14 +26,14 @@ class ContactListContactCard extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 14, big: 12), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all(Radius.circular(16)), ), child: Row( children: [ Icon( Icons.person_outline, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: SizeUtils.getByScreen(small: 28, big: 30), ), SizedBox(width: SizeUtils.getByScreen(small: 12, big: 14)), @@ -47,7 +45,7 @@ class ContactListContactCard extends StatelessWidget { contact.name, style: TextStyle( fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, fontSize: SizeUtils.getByScreen(small: 15, big: 16), ), ), @@ -55,8 +53,7 @@ class ContactListContactCard extends StatelessWidget { Text( contact.phone, style: TextStyle( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), fontSize: SizeUtils.getByScreen(small: 13, big: 14), ), @@ -73,7 +70,7 @@ class ContactListContactCard extends StatelessWidget { ), child: Icon( Icons.delete_outline, - color: Colors.red, + color: Theme.of(context).colorScheme.error, size: SizeUtils.getByScreen(small: 22, big: 24), ), ), diff --git a/modules/legacy/modules/settings/lib/src/features/alarm/presentation/alarm_screen.dart b/modules/legacy/modules/settings/lib/src/features/alarm/presentation/alarm_screen.dart index 657a75b3..59392ead 100644 --- a/modules/legacy/modules/settings/lib/src/features/alarm/presentation/alarm_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/alarm/presentation/alarm_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -18,14 +19,13 @@ class AlarmScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(alarmViewModelProvider.notifier); final (alarms, isLoading, isSaving, maxAlarms) = ref.watch( alarmViewModelProvider.select( (s) => (s.alarms, s.isLoading, s.isSaving, s.maxAlarms), ), ); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; ref.listen(alarmViewModelProvider.select((s) => s.errorEvent), (_, next) { if (next == null) return; @@ -56,9 +56,9 @@ class AlarmScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -235,8 +235,7 @@ class _AlarmCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final frequencyLabel = switch (alarm.frequency) { AlarmFrequency.once => context.translate(I18n.once), @@ -254,7 +253,7 @@ class _AlarmCard extends ConsumerWidget { vertical: SizeUtils.getByScreen(small: 14, big: 12), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all(Radius.circular(16)), ), child: Column( @@ -267,7 +266,7 @@ class _AlarmCard extends ConsumerWidget { alarm.time, style: TextStyle( fontWeight: FontWeight.bold, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, fontSize: SizeUtils.getByScreen(small: 24, big: 26), ), ), @@ -298,7 +297,7 @@ class _AlarmCard extends ConsumerWidget { SizedBox(width: SizeUtils.getByScreen(small: 8, big: 10)), _ActionButton( icon: Icons.delete_outline, - color: Colors.red, + color: Theme.of(context).colorScheme.error, onPressed: onDelete, ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/alarm/presentation/widgets/alarm_form_screen.dart b/modules/legacy/modules/settings/lib/src/features/alarm/presentation/widgets/alarm_form_screen.dart index 64e64938..10ad9a4a 100644 --- a/modules/legacy/modules/settings/lib/src/features/alarm/presentation/widgets/alarm_form_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/alarm/presentation/widgets/alarm_form_screen.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -79,15 +79,14 @@ class _AlarmFormSheetState extends ConsumerState<_AlarmFormSheet> { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final bottomInset = MediaQuery.of(context).viewInsets.bottom; return Padding( padding: EdgeInsets.only(bottom: bottomInset), child: Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: SafeArea( @@ -107,7 +106,7 @@ class _AlarmFormSheetState extends ConsumerState<_AlarmFormSheet> { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), @@ -196,7 +195,6 @@ class _AlarmFormSheetState extends ConsumerState<_AlarmFormSheet> { _days[index] = !_days[index]; }); }, - theme: theme, ), ], SizedBox(height: SizeUtils.getByScreen(small: 16, big: 18)), diff --git a/modules/legacy/modules/settings/lib/src/features/alerts/presentation/alerts_screen.dart b/modules/legacy/modules/settings/lib/src/features/alerts/presentation/alerts_screen.dart index 325dad5b..3730334e 100644 --- a/modules/legacy/modules/settings/lib/src/features/alerts/presentation/alerts_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/alerts/presentation/alerts_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,7 +13,6 @@ class AlertsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(alertsViewModelProvider); final vm = ref.read(alertsViewModelProvider.notifier); @@ -43,7 +43,6 @@ class AlertsScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.alerts), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -59,9 +58,9 @@ class AlertsScreen extends ConsumerWidget { context.translate(I18n.alertsDescription), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 15), - color: theme - .getColorFor(ThemeCode.textPrimary) - .withAlpha(178), + color: Theme.of( + context, + ).colorScheme.onSurface.withAlpha(178), ), ), SizedBox(height: SizeUtils.getByScreen(small: 16, big: 14)), @@ -70,7 +69,6 @@ class AlertsScreen extends ConsumerWidget { label: _alertLabel(context, alert), isActive: state.activeAlerts.contains(alert), onChanged: (_) => vm.toggleAlert(alert), - theme: theme, ), ), ], @@ -86,7 +84,7 @@ class AlertsScreen extends ConsumerWidget { vm.save(); }, text: state.isSaving ? '...' : context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ); @@ -114,13 +112,11 @@ class _AlertToggle extends StatelessWidget { final String label; final bool isActive; final ValueChanged onChanged; - final ThemePort theme; const _AlertToggle({ required this.label, required this.isActive, required this.onChanged, - required this.theme, }); @override @@ -131,7 +127,7 @@ class _AlertToggle extends StatelessWidget { children: [ Switch.adaptive( value: isActive, - activeTrackColor: theme.getColorFor(ThemeCode.legacyPrimary), + activeTrackColor: context.sfColors.legacyPrimary, onChanged: onChanged, ), const SizedBox(width: 8), diff --git a/modules/legacy/modules/settings/lib/src/features/app_store/presentation/app_store_screen.dart b/modules/legacy/modules/settings/lib/src/features/app_store/presentation/app_store_screen.dart index 56ef1656..db816328 100644 --- a/modules/legacy/modules/settings/lib/src/features/app_store/presentation/app_store_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/app_store/presentation/app_store_screen.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -9,10 +8,8 @@ class AppStoreScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.appStore), body: const Center(child: Text('Coming soon')), ); diff --git a/modules/legacy/modules/settings/lib/src/features/appearance/appearance_builder.dart b/modules/legacy/modules/settings/lib/src/features/appearance/appearance_builder.dart new file mode 100644 index 00000000..feca0992 --- /dev/null +++ b/modules/legacy/modules/settings/lib/src/features/appearance/appearance_builder.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'package:go_router/go_router.dart'; +import 'package:navigation/navigation.dart'; +import 'package:settings/src/features/appearance/presentation/appearance_screen.dart'; + +class AppearanceBuilder { + const AppearanceBuilder(); + + Page buildPage(BuildContext context, GoRouterState state) { + final NavigationContract navigationContract = GetIt.I(); + + return MaterialPage( + key: state.pageKey, + child: AppearanceScreen(navigationContract: navigationContract), + ); + } +} diff --git a/modules/legacy/modules/settings/lib/src/features/appearance/presentation/appearance_screen.dart b/modules/legacy/modules/settings/lib/src/features/appearance/presentation/appearance_screen.dart new file mode 100644 index 00000000..04fc4ead --- /dev/null +++ b/modules/legacy/modules/settings/lib/src/features/appearance/presentation/appearance_screen.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_shared/legacy_shared.dart'; +import 'package:legacy_theme/legacy_theme.dart'; +import 'package:navigation/navigation.dart'; +import 'package:sf_localizations/sf_localizations.dart'; +import 'package:utils/utils.dart'; + +/// Appearance settings — light / dark / system theme selector for legacy mode. +class AppearanceScreen extends ConsumerWidget { + const AppearanceScreen({super.key, required this.navigationContract}); + + final NavigationContract navigationContract; + + @override + Widget build(BuildContext context, WidgetRef ref) { + + return LegacyPageLayout( + title: context.translate(I18n.appearance), + body: Padding( + padding: SizeUtils.getByScreen( + small: const EdgeInsets.symmetric(horizontal: 22, vertical: 16), + big: const EdgeInsets.symmetric(horizontal: 21, vertical: 20), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.translate(I18n.appearanceDescription), + style: const TextStyle(fontSize: 14, height: 1.4), + ), + const SizedBox(height: 24), + const Center(child: LegacyThemeSelector()), + ], + ), + ), + ); + } +} diff --git a/modules/legacy/modules/settings/lib/src/features/battery/presentation/battery_screen.dart b/modules/legacy/modules/settings/lib/src/features/battery/presentation/battery_screen.dart index 9b345ad3..e5ce5990 100644 --- a/modules/legacy/modules/settings/lib/src/features/battery/presentation/battery_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/battery/presentation/battery_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,8 +13,7 @@ class BatteryScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final state = ref.watch(batteryViewModelProvider); final vm = ref.read(batteryViewModelProvider.notifier); @@ -44,7 +44,6 @@ class BatteryScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.batteryNightSaving), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -64,7 +63,7 @@ class BatteryScreen extends ConsumerWidget { Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( - color: Colors.grey.shade100, + color: Theme.of(context).colorScheme.outlineVariant, borderRadius: BorderRadius.circular(16), ), child: Row( @@ -87,7 +86,7 @@ class BatteryScreen extends ConsumerWidget { ), style: TextStyle( fontSize: 13, - color: Colors.grey.shade600, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/block_phone_screen.dart b/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/block_phone_screen.dart index 0e554836..a75f3bca 100644 --- a/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/block_phone_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/block_phone_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -17,9 +18,8 @@ class BlockPhoneScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(blockPhoneViewModelProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; ref.listen(blockPhoneViewModelProvider.select((s) => s.errorMessage), ( _, @@ -49,9 +49,9 @@ class BlockPhoneScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -161,11 +161,10 @@ class _ContactList extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final contacts = ref.watch( blockPhoneViewModelProvider.select((s) => s.contacts), ); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return SingleChildScrollView( child: Padding( @@ -184,8 +183,7 @@ class _ContactList extends ConsumerWidget { context.translate(I18n.whitelistDescription), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 15), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), ), ), @@ -196,7 +194,6 @@ class _ContactList extends ConsumerWidget { contact: contact, onDelete: () => _confirmDelete(context, ref, index, contact.name), - theme: theme, ); }), SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), @@ -225,8 +222,7 @@ class _ContactList extends ConsumerWidget { ) async { if (!await guardDeviceCommand(context, ref)) return; if (!context.mounted) return; - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; showDialog( context: context, @@ -255,7 +251,7 @@ class _ContactList extends ConsumerWidget { }, child: Text( context.translate(I18n.delete), - style: TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/widgets/add_contact_sheet.dart b/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/widgets/add_contact_sheet.dart index e6b8c3de..1419ed55 100644 --- a/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/widgets/add_contact_sheet.dart +++ b/modules/legacy/modules/settings/lib/src/features/block_phone/presentation/widgets/add_contact_sheet.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -20,7 +21,6 @@ class _AddContactSheet extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(newBlockPhoneContactViewModelProvider.notifier); final state = ref.watch(newBlockPhoneContactViewModelProvider); @@ -39,7 +39,7 @@ class _AddContactSheet extends ConsumerWidget { return ContactFormSheet( title: context.translate(I18n.addAllowedNumber), - primaryColor: theme.getColorFor(ThemeCode.legacyPrimary), + primaryColor: context.sfColors.legacyPrimary, nameController: vm.nameController, phoneController: vm.phoneController, isoCode: state.isoCode, diff --git a/modules/legacy/modules/settings/lib/src/features/disable_functions/presentation/disable_functions_screen.dart b/modules/legacy/modules/settings/lib/src/features/disable_functions/presentation/disable_functions_screen.dart index 08c42299..68456eb2 100644 --- a/modules/legacy/modules/settings/lib/src/features/disable_functions/presentation/disable_functions_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/disable_functions/presentation/disable_functions_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,8 +13,7 @@ class DisableFunctionsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final state = ref.watch(disableFunctionsViewModelProvider); final vm = ref.read(disableFunctionsViewModelProvider.notifier); @@ -44,7 +44,6 @@ class DisableFunctionsScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.disableFunctions), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -110,7 +109,7 @@ class _FunctionCard extends StatelessWidget { return Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), decoration: BoxDecoration( - color: Colors.grey.shade100, + color: Theme.of(context).colorScheme.outlineVariant, borderRadius: BorderRadius.circular(12), ), child: Row( diff --git a/modules/legacy/modules/settings/lib/src/features/language/presentation/language_screen.dart b/modules/legacy/modules/settings/lib/src/features/language/presentation/language_screen.dart index ecb481d3..769a7310 100644 --- a/modules/legacy/modules/settings/lib/src/features/language/presentation/language_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/language/presentation/language_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -13,7 +14,6 @@ class LanguageScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(languageViewModelProvider.notifier); final language = ref.watch( @@ -52,7 +52,6 @@ class LanguageScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.languageTitle), body: SingleChildScrollView( child: RadioGroup( @@ -83,12 +82,11 @@ class _Option extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return RadioListTile( title: Text(label), value: value, - activeColor: theme.getColorFor(ThemeCode.legacyPrimary), + activeColor: context.sfColors.legacyPrimary, controlAffinity: ListTileControlAffinity.trailing, ); } @@ -99,7 +97,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(languageViewModelProvider.notifier); final isLoading = ref.watch( languageViewModelProvider.select((s) => s.isLoading), @@ -115,7 +112,7 @@ class _SaveSection extends ConsumerWidget { vm.submit(); }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/settings/lib/src/features/legacy_notifications/presentation/legacy_notifications_screen.dart b/modules/legacy/modules/settings/lib/src/features/legacy_notifications/presentation/legacy_notifications_screen.dart index 6116ef58..eafd7df8 100644 --- a/modules/legacy/modules/settings/lib/src/features/legacy_notifications/presentation/legacy_notifications_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/legacy_notifications/presentation/legacy_notifications_screen.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -9,10 +8,8 @@ class LegacyNotificationsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.notificationsLegacyTitle), body: const Center(child: Text('Coming soon')), ); diff --git a/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/remote_management_screen.dart b/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/remote_management_screen.dart index 9df5e9fe..13e61bd9 100644 --- a/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/remote_management_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/remote_management_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -15,17 +16,15 @@ class RemoteManagementScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.remoteManagement), body: Column( children: [ Center( child: Icon( Icons.settings_remote_outlined, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 180, ), ), @@ -158,13 +157,12 @@ class _SectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return SectionButton( onPressed: onPressed, icon: Icon( icon, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 48, ), body: Column( @@ -179,7 +177,7 @@ class _SectionButton extends ConsumerWidget { subtitle, style: TextStyle( fontSize: 12, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, ), ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/widgets/confirm_dialog.dart b/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/widgets/confirm_dialog.dart index 0ed19015..f8b6d0bb 100644 --- a/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/widgets/confirm_dialog.dart +++ b/modules/legacy/modules/settings/lib/src/features/remote_management/presentation/widgets/confirm_dialog.dart @@ -2,6 +2,7 @@ import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; +import 'package:legacy_theme/legacy_theme.dart'; class ConfirmDialog extends ConsumerWidget { final String title; @@ -17,11 +18,10 @@ class ConfirmDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return Container( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundPrimary), + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.all(Radius.circular(10)), ), padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12), @@ -44,7 +44,7 @@ class ConfirmDialog extends ConsumerWidget { Navigator.pop(context); }, text: context.translate(I18n.cancel), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), SizedBox(width: 14), @@ -52,7 +52,7 @@ class ConfirmDialog extends ConsumerWidget { child: PrimaryButton( onPressed: onConfirm, text: context.translate(I18n.accept), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/remote_on_off/presentation/remote_on_off_screen.dart b/modules/legacy/modules/settings/lib/src/features/remote_on_off/presentation/remote_on_off_screen.dart index 767048cb..881115c4 100644 --- a/modules/legacy/modules/settings/lib/src/features/remote_on_off/presentation/remote_on_off_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/remote_on_off/presentation/remote_on_off_screen.dart @@ -1,4 +1,3 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -9,10 +8,8 @@ class RemoteOnOffScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.remoteOnOff), body: const Center(child: Text('Coming soon')), ); diff --git a/modules/legacy/modules/settings/lib/src/features/settings/presentation/settings_screen.dart b/modules/legacy/modules/settings/lib/src/features/settings/presentation/settings_screen.dart index bc9e78b6..4d4cb6f0 100644 --- a/modules/legacy/modules/settings/lib/src/features/settings/presentation/settings_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/settings/presentation/settings_screen.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -13,8 +13,7 @@ class SettingsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final color = theme.getColorFor(ThemeCode.legacyPrimary); + final color = context.sfColors.legacyPrimary; // final hasWifi = ref.watch( // selectedDeviceProvider.select((d) { // final types = d.value?.capabilities?.commands; @@ -23,7 +22,6 @@ class SettingsScreen extends ConsumerWidget { // ); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.deviceSettingsTitle), body: SingleChildScrollView( child: Padding( @@ -33,6 +31,14 @@ class SettingsScreen extends ConsumerWidget { ), child: Column( children: [ + _item( + context, + onPressed: () => + navigationContract.pushTo(AppRoutes.appearance), + icon: Icons.palette_outlined, + text: I18n.appearance, + color: color, + ), _item( context, onPressed: () => navigationContract.pushTo(AppRoutes.alarm), diff --git a/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/sos_contacts_screen.dart b/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/sos_contacts_screen.dart index ccbb224b..3942dae7 100644 --- a/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/sos_contacts_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/sos_contacts_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:navigation/navigation.dart'; @@ -16,9 +17,8 @@ class SosContactsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(sosContactsViewModelProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; ref.listen(sosContactsViewModelProvider.select((s) => s.errorMessage), ( _, @@ -48,9 +48,9 @@ class SosContactsScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -166,11 +166,10 @@ class _ContactList extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final contacts = ref.watch( sosContactsViewModelProvider.select((s) => s.contacts), ); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return SingleChildScrollView( child: Padding( @@ -189,8 +188,7 @@ class _ContactList extends ConsumerWidget { context.translate(I18n.sosDescription), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 15), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), ), ), @@ -201,7 +199,6 @@ class _ContactList extends ConsumerWidget { contact: contact, onDelete: () => _confirmDelete(context, ref, index, contact.name), - theme: theme, ); }), SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)), @@ -228,8 +225,7 @@ class _ContactList extends ConsumerWidget { int index, String name, ) { - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; showDialog( context: context, @@ -255,7 +251,7 @@ class _ContactList extends ConsumerWidget { }, child: Text( context.translate(I18n.delete), - style: TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], diff --git a/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/widgets/add_sos_contact_sheet.dart b/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/widgets/add_sos_contact_sheet.dart index 2f0c43fd..2d6175c0 100644 --- a/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/widgets/add_sos_contact_sheet.dart +++ b/modules/legacy/modules/settings/lib/src/features/sos_contacts/presentation/widgets/add_sos_contact_sheet.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -20,7 +21,6 @@ class _AddSosContactSheet extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final vm = ref.read(newSosContactViewModelProvider.notifier); final state = ref.watch(newSosContactViewModelProvider); @@ -39,7 +39,7 @@ class _AddSosContactSheet extends ConsumerWidget { return ContactFormSheet( title: context.translate(I18n.addSosContact), - primaryColor: theme.getColorFor(ThemeCode.legacyPrimary), + primaryColor: context.sfColors.legacyPrimary, nameController: vm.nameController, phoneController: vm.phoneController, isoCode: state.isoCode, diff --git a/modules/legacy/modules/settings/lib/src/features/sound/presentation/sound_screen.dart b/modules/legacy/modules/settings/lib/src/features/sound/presentation/sound_screen.dart index ac6c394a..c16fb586 100644 --- a/modules/legacy/modules/settings/lib/src/features/sound/presentation/sound_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/sound/presentation/sound_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -14,7 +15,6 @@ class SoundScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); ref.listen(soundViewModelProvider.select((s) => s.errorMessage), ( _, @@ -37,7 +37,6 @@ class SoundScreen extends ConsumerWidget { }); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.sound), body: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 12), @@ -46,7 +45,7 @@ class SoundScreen extends ConsumerWidget { Center( child: Icon( Icons.volume_up, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 180, ), ), @@ -130,13 +129,12 @@ class _SectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return SectionButton( onPressed: onPressed, icon: Icon( icon, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 36, ), iconPadding: 8, @@ -149,8 +147,8 @@ class _SectionButton extends ConsumerWidget { fontWeight: FontWeight.w500, fontSize: 14, color: active - ? theme.getColorFor(ThemeCode.textPrimary) - : theme.getColorFor(ThemeCode.textTertiary), + ? Theme.of(context).colorScheme.onSurface + : Theme.of(context).colorScheme.outline, ), ), Switch( @@ -170,7 +168,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(soundViewModelProvider.notifier); @@ -182,7 +179,7 @@ class _SaveSection extends ConsumerWidget { vm.submit(); }, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/settings/lib/src/features/sync_clock/presentation/sync_clock_screen.dart b/modules/legacy/modules/settings/lib/src/features/sync_clock/presentation/sync_clock_screen.dart index 5b848953..f1477f13 100644 --- a/modules/legacy/modules/settings/lib/src/features/sync_clock/presentation/sync_clock_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/sync_clock/presentation/sync_clock_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -14,10 +15,8 @@ class SyncClockScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.syncClock), body: Padding( padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12), @@ -104,13 +103,12 @@ class _SectionButton extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); return SectionButton( onPressed: onPressed, icon: Icon( icon, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: 36, ), iconPadding: 8, @@ -123,8 +121,8 @@ class _SectionButton extends ConsumerWidget { fontWeight: FontWeight.w500, fontSize: 14, color: active - ? theme.getColorFor(ThemeCode.textPrimary) - : theme.getColorFor(ThemeCode.textTertiary), + ? Theme.of(context).colorScheme.onSurface + : Theme.of(context).colorScheme.outline, ), ), Switch( @@ -144,7 +142,6 @@ class _SaveSection extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.read(themePortProvider); final vm = ref.read(soundViewModelProvider.notifier); @@ -153,7 +150,7 @@ class _SaveSection extends ConsumerWidget { child: PrimaryButton( onPressed: vm.submit, text: context.translate(I18n.save), - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, ), ); } diff --git a/modules/legacy/modules/settings/lib/src/features/timezone/presentation/timezone_screen.dart b/modules/legacy/modules/settings/lib/src/features/timezone/presentation/timezone_screen.dart index c751efb5..918d0caa 100644 --- a/modules/legacy/modules/settings/lib/src/features/timezone/presentation/timezone_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/timezone/presentation/timezone_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -12,8 +13,7 @@ class TimezoneScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final state = ref.watch(timezoneViewModelProvider); final vm = ref.read(timezoneViewModelProvider.notifier); @@ -51,7 +51,6 @@ class TimezoneScreen extends ConsumerWidget { .toList(); return LegacyPageLayout( - theme: theme, title: context.translate(I18n.timezone), body: state.isLoading ? const Center(child: CircularProgressIndicator()) @@ -74,7 +73,7 @@ class TimezoneScreen extends ConsumerWidget { style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), @@ -207,13 +206,13 @@ class _TimezoneItem extends StatelessWidget { width: 40, height: 40, decoration: BoxDecoration( - color: Colors.grey.shade100, + color: Theme.of(context).colorScheme.outlineVariant, shape: BoxShape.circle, ), child: Center( child: Icon( Icons.public, - color: Colors.grey.shade500, + color: Theme.of(context).colorScheme.onSurfaceVariant, size: 20, ), ), @@ -230,7 +229,7 @@ class _TimezoneItem extends StatelessWidget { const SizedBox(height: 2), Text( continent, - style: TextStyle(fontSize: 12, color: Colors.grey.shade500), + style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), diff --git a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/add_wifi_network_sheet.dart b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/add_wifi_network_sheet.dart index c668f109..a5121064 100644 --- a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/add_wifi_network_sheet.dart +++ b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/add_wifi_network_sheet.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:sf_localizations/sf_localizations.dart'; @@ -69,8 +69,7 @@ class _ConnectWifiSheetState extends ConsumerState<_ConnectWifiSheet> { @override Widget build(BuildContext context) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; final isConnecting = ref.watch( wifiSettingsViewModelProvider.select((s) => s.isConnecting), ); @@ -81,7 +80,7 @@ class _ConnectWifiSheetState extends ConsumerState<_ConnectWifiSheet> { padding: EdgeInsets.only(bottom: bottomInset), child: Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), child: SafeArea( @@ -100,7 +99,7 @@ class _ConnectWifiSheetState extends ConsumerState<_ConnectWifiSheet> { width: 40, height: 4, decoration: BoxDecoration( - color: Colors.grey.shade300, + color: Theme.of(context).colorScheme.outline, borderRadius: BorderRadius.circular(2), ), ), @@ -228,11 +227,11 @@ class _ConnectWifiSheetState extends ConsumerState<_ConnectWifiSheet> { hintText: hintText, border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12)), - borderSide: BorderSide(color: Colors.grey.shade300), + borderSide: BorderSide(color: Theme.of(context).colorScheme.outline), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12)), - borderSide: BorderSide(color: Colors.grey.shade300), + borderSide: BorderSide(color: Theme.of(context).colorScheme.outline), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12)), diff --git a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/available_wifi_network_card.dart b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/available_wifi_network_card.dart index 330e95d6..e9cbe799 100644 --- a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/available_wifi_network_card.dart +++ b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/available_wifi_network_card.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:utils/utils.dart'; @@ -17,8 +17,7 @@ class AvailableWifiNetworkCard extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return Padding( padding: EdgeInsets.only( @@ -32,7 +31,7 @@ class AvailableWifiNetworkCard extends ConsumerWidget { vertical: SizeUtils.getByScreen(small: 14, big: 12), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all(Radius.circular(16)), ), child: Row( @@ -51,7 +50,7 @@ class AvailableWifiNetworkCard extends ConsumerWidget { network.ssid, style: TextStyle( fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, fontSize: SizeUtils.getByScreen(small: 15, big: 16), ), ), @@ -59,8 +58,7 @@ class AvailableWifiNetworkCard extends ConsumerWidget { Text( network.bssid, style: TextStyle( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), fontSize: SizeUtils.getByScreen(small: 13, big: 14), ), @@ -70,8 +68,7 @@ class AvailableWifiNetworkCard extends ConsumerWidget { ), Icon( Icons.chevron_right, - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), size: SizeUtils.getByScreen(small: 24, big: 26), ), diff --git a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/wifi_network_card.dart b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/wifi_network_card.dart index 50a8ff00..df3dbb06 100644 --- a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/wifi_network_card.dart +++ b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/widgets/wifi_network_card.dart @@ -1,4 +1,4 @@ -import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:utils/utils.dart'; @@ -8,14 +8,12 @@ class WifiNetworkCard extends StatelessWidget { final WifiNetworkEntity network; final VoidCallback onTap; final VoidCallback onDelete; - final ThemePort theme; const WifiNetworkCard({ super.key, required this.network, required this.onTap, required this.onDelete, - required this.theme, }); @override @@ -32,14 +30,14 @@ class WifiNetworkCard extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 14, big: 12), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all(Radius.circular(16)), ), child: Row( children: [ Icon( Icons.wifi, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: SizeUtils.getByScreen(small: 28, big: 30), ), SizedBox(width: SizeUtils.getByScreen(small: 12, big: 14)), @@ -51,7 +49,7 @@ class WifiNetworkCard extends StatelessWidget { network.ssid, style: TextStyle( fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, fontSize: SizeUtils.getByScreen(small: 15, big: 16), ), ), @@ -59,8 +57,7 @@ class WifiNetworkCard extends StatelessWidget { Text( network.bssid, style: TextStyle( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), fontSize: SizeUtils.getByScreen(small: 13, big: 14), ), @@ -77,7 +74,7 @@ class WifiNetworkCard extends StatelessWidget { ), child: Icon( Icons.delete_outline, - color: Colors.red, + color: Theme.of(context).colorScheme.error, size: SizeUtils.getByScreen(small: 22, big: 24), ), ), diff --git a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/wifi_settings_screen.dart b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/wifi_settings_screen.dart index 5d7e591a..6b4b51e1 100644 --- a/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/wifi_settings_screen.dart +++ b/modules/legacy/modules/settings/lib/src/features/wifi_settings/presentation/wifi_settings_screen.dart @@ -1,4 +1,5 @@ import 'package:design_system/design_system.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:legacy_shared/legacy_shared.dart'; @@ -19,10 +20,9 @@ class WifiSettingsScreen extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(wifiSettingsViewModelProvider); final vm = ref.read(wifiSettingsViewModelProvider.notifier); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; ref.listen(wifiSettingsViewModelProvider.select((s) => s.error), ( _, @@ -63,9 +63,9 @@ class WifiSettingsScreen extends ConsumerWidget { }); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -127,9 +127,8 @@ class _Body extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); final state = ref.watch(wifiSettingsViewModelProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; return SingleChildScrollView( child: Padding( @@ -164,7 +163,6 @@ class _Body extends ConsumerWidget { _CurrentNetworkCard( ssid: state.currentNetwork!.ssid, bssid: state.currentNetwork!.bssid, - theme: theme, ) else if (!state.isLoadingCurrentNetwork) Padding( @@ -175,8 +173,7 @@ class _Body extends ConsumerWidget { context.translate(I18n.wifiNoCurrentNetwork), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 15), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), ), ), @@ -247,8 +244,7 @@ class _Body extends ConsumerWidget { context.translate(I18n.noWifiNetworks), style: TextStyle( fontSize: SizeUtils.getByScreen(small: 14, big: 15), - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), ), ), @@ -264,7 +260,6 @@ class _Body extends ConsumerWidget { .setNetwork(network); }, onDelete: () => _confirmDelete(context, ref, network), - theme: theme, ), ), ], @@ -292,8 +287,7 @@ class _Body extends ConsumerWidget { ) async { if (!await guardDeviceCommand(context, ref)) return; if (!context.mounted) return; - final theme = ref.read(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; showDialog( context: context, @@ -322,7 +316,7 @@ class _Body extends ConsumerWidget { }, child: Text( context.translate(I18n.delete), - style: TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -334,12 +328,10 @@ class _Body extends ConsumerWidget { class _CurrentNetworkCard extends StatelessWidget { final String ssid; final String bssid; - final ThemePort theme; const _CurrentNetworkCard({ required this.ssid, required this.bssid, - required this.theme, }); @override @@ -354,14 +346,14 @@ class _CurrentNetworkCard extends StatelessWidget { vertical: SizeUtils.getByScreen(small: 14, big: 12), ), decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.backgroundSecondary), + color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.all(Radius.circular(16)), ), child: Row( children: [ Icon( Icons.wifi, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: context.sfColors.legacyPrimary, size: SizeUtils.getByScreen(small: 28, big: 30), ), SizedBox(width: SizeUtils.getByScreen(small: 12, big: 14)), @@ -373,7 +365,7 @@ class _CurrentNetworkCard extends StatelessWidget { ssid, style: TextStyle( fontWeight: FontWeight.w600, - color: theme.getColorFor(ThemeCode.textPrimary), + color: Theme.of(context).colorScheme.onSurface, fontSize: SizeUtils.getByScreen(small: 15, big: 16), ), ), @@ -381,8 +373,7 @@ class _CurrentNetworkCard extends StatelessWidget { Text( bssid, style: TextStyle( - color: theme - .getColorFor(ThemeCode.textPrimary) + color: Theme.of(context).colorScheme.onSurface .withAlpha(178), fontSize: SizeUtils.getByScreen(small: 13, big: 14), ), diff --git a/modules/legacy/modules/settings/pubspec.yaml b/modules/legacy/modules/settings/pubspec.yaml index d73c8680..037d654f 100644 --- a/modules/legacy/modules/settings/pubspec.yaml +++ b/modules/legacy/modules/settings/pubspec.yaml @@ -28,6 +28,8 @@ dependencies: #modules dependencies go here #packages dependencies go here + legacy_theme: + path: ../../packages/legacy_theme sf_tracking: path: ../../../../packages/sf_tracking design_system: diff --git a/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart b/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart index f8670925..c725c7b9 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/components/menu_button.dart @@ -24,7 +24,7 @@ class AppMenuButton extends StatelessWidget { return TextButton( onPressed: onPressed, style: ButtonStyle( - overlayColor: WidgetStatePropertyAll(Color(0xFFF7F7F7)), + overlayColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.surfaceContainer), ), child: Row( children: [ @@ -49,7 +49,7 @@ class AppMenuButton extends StatelessWidget { style: TextStyle( fontSize: SizeUtils.getByScreen(small: 18, big: 19), fontWeight: FontWeight.w500, - color: Color(0xFF4B4B4B), + color: Theme.of(context).colorScheme.onSurface, ), ), ), diff --git a/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart b/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart index 93a41bb8..6730cea7 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/components/section_button.dart @@ -26,8 +26,8 @@ class SectionButton extends StatelessWidget { big: EdgeInsets.symmetric(horizontal: 21, vertical: 12), ), ), - backgroundColor: WidgetStatePropertyAll(Color(0xFFF7F7F7)), - foregroundColor: WidgetStatePropertyAll(Color(0xFF4B4B4B)), + backgroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.surfaceContainer), + foregroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.onSurface), shape: WidgetStatePropertyAll( RoundedRectangleBorder( borderRadius: BorderRadius.all( diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart index 905562e8..35b4af2a 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/layouts/page_layout.dart @@ -1,6 +1,6 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:navigation/navigation.dart'; import 'package:utils/utils.dart'; @@ -11,7 +11,6 @@ class LegacyPageLayout extends StatelessWidget { final bool showBack; final bool showEdit; final VoidCallback? onEditChange; - final ThemePort theme; const LegacyPageLayout({ super.key, @@ -21,15 +20,17 @@ class LegacyPageLayout extends StatelessWidget { this.showBack = true, this.showEdit = false, this.onEditChange, - required this.theme, }); @override Widget build(BuildContext context) { + final legacyPrimary = context.sfColors.legacyPrimary; + final colorScheme = Theme.of(context).colorScheme; + return Scaffold( - backgroundColor: Colors.white, + backgroundColor: colorScheme.surface, appBar: AppBar( - backgroundColor: Colors.white, + backgroundColor: colorScheme.surface, surfaceTintColor: Colors.transparent, elevation: 0, centerTitle: true, @@ -39,7 +40,7 @@ class LegacyPageLayout extends StatelessWidget { onPressed: () => GetIt.I().goBack(), icon: Icon( Icons.adaptive.arrow_back, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: legacyPrimary, size: SizeUtils.getByScreen(small: 32, big: 28), ), ) @@ -50,7 +51,7 @@ class LegacyPageLayout extends StatelessWidget { fontSize: SizeUtils.getByScreen(small: 20, big: 19), fontWeight: FontWeight.w500, letterSpacing: 0, - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: legacyPrimary, ), ), actions: [ @@ -61,14 +62,14 @@ class LegacyPageLayout extends StatelessWidget { ), child: DecoratedBox( decoration: BoxDecoration( - color: theme.getColorFor(ThemeCode.legacyPrimary), + color: legacyPrimary, shape: BoxShape.circle, ), child: IconButton( onPressed: onEditChange, icon: Icon( Icons.edit_outlined, - color: Colors.white, + color: colorScheme.onPrimary, size: SizeUtils.getByScreen(small: 24, big: 22), ), ), diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/pulsing_location_marker.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/pulsing_location_marker.dart index 42e6e617..f7873ab7 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/pulsing_location_marker.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/pulsing_location_marker.dart @@ -39,7 +39,7 @@ class _PulsingLocationMarkerState extends State @override Widget build(BuildContext context) { - final c = widget.color ?? const Color(0xFF329E95); + final c = widget.color ?? Theme.of(context).colorScheme.primary; return Stack( alignment: Alignment.center, children: [ diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/refreshable_error_state.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/refreshable_error_state.dart index 6743af65..fdebfac0 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/refreshable_error_state.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/refreshable_error_state.dart @@ -1,9 +1,8 @@ -import 'package:design_system/design_system.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:sf_localizations/sf_localizations.dart'; -class RefreshableErrorState extends ConsumerWidget { +class RefreshableErrorState extends StatelessWidget { const RefreshableErrorState({ super.key, required this.onRefresh, @@ -14,10 +13,9 @@ class RefreshableErrorState extends ConsumerWidget { final String? message; @override - Widget build(BuildContext context, WidgetRef ref) { - final theme = ref.watch(themePortProvider); - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); - final textColor = theme.getColorFor(ThemeCode.textPrimary); + Widget build(BuildContext context) { + final primaryColor = context.sfColors.legacyPrimary; + final textColor = Theme.of(context).colorScheme.onSurface; final errorMessage = message ?? context.translate(I18n.errorGeneric); return RefreshIndicator( diff --git a/modules/legacy/packages/legacy_shared/lib/src/widgets/week_day_chips.dart b/modules/legacy/packages/legacy_shared/lib/src/widgets/week_day_chips.dart index c52314af..083446a8 100644 --- a/modules/legacy/packages/legacy_shared/lib/src/widgets/week_day_chips.dart +++ b/modules/legacy/packages/legacy_shared/lib/src/widgets/week_day_chips.dart @@ -1,5 +1,5 @@ -import 'package:design_system/design_system.dart'; -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:legacy_theme/legacy_theme.dart'; import 'package:sf_localizations/sf_localizations.dart'; import 'package:utils/utils.dart'; @@ -25,7 +25,6 @@ String weekDayShortLabel(BuildContext context, String i18nKey) { /// WeekDayChips.single( /// selectedWeekDay: 1, /// onChanged: (day) => ..., -/// theme: theme, /// ) /// ``` /// @@ -34,7 +33,6 @@ String weekDayShortLabel(BuildContext context, String i18nKey) { /// WeekDayChips.multi( /// selectedDays: [true, false, true, ...], /// onToggle: (index) => ..., -/// theme: theme, /// ) /// ``` class WeekDayChips extends StatelessWidget { @@ -51,13 +49,11 @@ class WeekDayChips extends StatelessWidget { final ValueChanged? onToggle; final bool enabled; - final ThemePort theme; const WeekDayChips.single({ super.key, required int this.selectedWeekDay, required ValueChanged this.onChanged, - required this.theme, this.enabled = true, }) : selectedDays = null, onToggle = null; @@ -66,7 +62,6 @@ class WeekDayChips extends StatelessWidget { super.key, required List this.selectedDays, required ValueChanged this.onToggle, - required this.theme, this.enabled = true, }) : selectedWeekDay = null, onChanged = null; @@ -75,7 +70,8 @@ class WeekDayChips extends StatelessWidget { @override Widget build(BuildContext context) { - final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary); + final primaryColor = context.sfColors.legacyPrimary; + final textPrimary = Theme.of(context).colorScheme.onSurface; return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -109,8 +105,8 @@ class WeekDayChips extends StatelessWidget { color: isSelected ? primaryColor : enabled - ? const Color(0xFFBDBDBD) - : const Color(0xFFE0E0E0), + ? Theme.of(context).colorScheme.onSurfaceVariant + : Theme.of(context).colorScheme.outline, ), ), child: Text( @@ -121,10 +117,8 @@ class WeekDayChips extends StatelessWidget { color: isSelected ? const Color(0xFFFFFFFF) : enabled - ? theme.getColorFor(ThemeCode.textPrimary) - : theme - .getColorFor(ThemeCode.textPrimary) - .withValues(alpha: 0.4), + ? textPrimary + : textPrimary.withValues(alpha: 0.4), ), ), ), diff --git a/modules/legacy/packages/legacy_shared/pubspec.yaml b/modules/legacy/packages/legacy_shared/pubspec.yaml index 5d1e0112..654b71d9 100644 --- a/modules/legacy/packages/legacy_shared/pubspec.yaml +++ b/modules/legacy/packages/legacy_shared/pubspec.yaml @@ -24,6 +24,8 @@ dependencies: sf_shared: path: ../../../../packages/sf_shared #dependencies go here + legacy_theme: + path: ../legacy_theme dio: ^5.9.2 get_it: ^9.0.5 flutter_riverpod: ^3.0.3 diff --git a/modules/legacy/packages/legacy_theme/lib/legacy_theme.dart b/modules/legacy/packages/legacy_theme/lib/legacy_theme.dart new file mode 100644 index 00000000..22a4254e --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/legacy_theme.dart @@ -0,0 +1,51 @@ +/// Theming package for legacy app mode. +/// +/// Material 3 based, supports light/dark/system modes, with a [ThemeExtension] +/// for custom SF brand colors that don't map cleanly to `ColorScheme`. +/// +/// ## Quick start +/// +/// 1. Override `sharedPreferencesProvider` in `main/init_app.dart`: +/// ```dart +/// final prefs = await SharedPreferences.getInstance(); +/// runApp(ProviderScope( +/// overrides: [sharedPreferencesProvider.overrideWithValue(prefs)], +/// child: const MyApp(), +/// )); +/// ``` +/// +/// 2. Wire into `MaterialApp.router`: +/// ```dart +/// final state = ref.watch(legacyThemeNotifierProvider); +/// return MaterialApp.router( +/// theme: LegacyAppTheme.light, +/// darkTheme: LegacyAppTheme.dark, +/// themeMode: state.themeMode, +/// ... +/// ); +/// ``` +/// +/// 3. Expose the selector in a settings screen: +/// ```dart +/// const LegacyThemeSelector() +/// ``` +/// +/// 4. Consume colors in widgets: +/// ```dart +/// // Material 3 standard +/// Theme.of(context).colorScheme.primary +/// // Custom SF tokens +/// context.sfColors.legacyPrimary +/// ``` +library; + +export 'src/data/enums/legacy_theme_enum.dart'; +export 'src/data/themes/legacy_app_theme.dart'; +export 'src/data/themes/legacy_color_schemes.dart'; +export 'src/data/extensions/sf_colors.dart'; +export 'src/data/preferences/legacy_theme_preferences.dart'; +export 'src/data/theme_utils.dart'; +export 'src/presentation/state/legacy_theme_notifier.dart'; +export 'src/presentation/state/legacy_theme_state.dart'; +export 'src/presentation/providers/legacy_theme_providers.dart'; +export 'src/presentation/widgets/legacy_theme_selector.dart'; diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/enums/legacy_theme_enum.dart b/modules/legacy/packages/legacy_theme/lib/src/data/enums/legacy_theme_enum.dart new file mode 100644 index 00000000..734e8a17 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/enums/legacy_theme_enum.dart @@ -0,0 +1,24 @@ +/// Identifies the concrete theme variant currently applied. +/// +/// Today there are only two variants (`light` and `dark`). The `light1/2/3` +/// values are reserved for the future timeframe-based dynamic light theming +/// (see `timeframe_enum.dart`). To activate it: +/// 1. Uncomment the three `light1/2/3` entries below. +/// 2. Uncomment the matching `ThemeData` definitions in `legacy_app_theme.dart`. +/// 3. Uncomment the `TimeframeEnum` and `getThemeFromTimeframe()` helpers. +/// 4. Subscribe `LegacyThemeNotifier` to a timeframe stream. +enum LegacyThemeEnum { + light, + // light1, // morning variant (reserved) + // light2, // afternoon variant (reserved) + // light3, // evening/night variant (reserved) + dark; + + bool get isLight { + return this == LegacyThemeEnum.light; + // return this == LegacyThemeEnum.light || + // this == LegacyThemeEnum.light1 || + // this == LegacyThemeEnum.light2 || + // this == LegacyThemeEnum.light3; + } +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/enums/timeframe_enum.dart b/modules/legacy/packages/legacy_theme/lib/src/data/enums/timeframe_enum.dart new file mode 100644 index 00000000..5f92dd94 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/enums/timeframe_enum.dart @@ -0,0 +1,23 @@ +// ============================================================================ +// TIMEFRAME-BASED DYNAMIC THEMING (RESERVED — currently disabled) +// ============================================================================ +// +// Inspired by onelife_app, this enum lets the light theme morph across +// variants according to the user's local time of day. +// +// To enable: +// 1. Uncomment the enum below. +// 2. Uncomment the `light1/2/3` entries in `legacy_theme_enum.dart`. +// 3. Uncomment the matching `ThemeData` definitions in `legacy_app_theme.dart`. +// 4. Uncomment `getThemeFromTimeframe()` in `theme_utils.dart`. +// 5. In `LegacyThemeNotifier`, wire a subscription to a timeframe stream/event +// and call `_setThemeFromTimeframe(currentTimeframe)` on each change. +// +// ---------------------------------------------------------------------------- +// enum TimeframeEnum { +// morning, // 06:00-12:00 → light1 +// afternoon, // 12:00-18:00 → light2 +// evening, // 18:00-22:00 → light3 +// night, // 22:00-06:00 → light3 (reuse evening or define light4) +// } +// ============================================================================ diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/extensions/sf_colors.dart b/modules/legacy/packages/legacy_theme/lib/src/data/extensions/sf_colors.dart new file mode 100644 index 00000000..f5ccd6aa --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/extensions/sf_colors.dart @@ -0,0 +1,99 @@ +import 'package:flutter/material.dart'; + +/// [ThemeExtension] holding custom SF brand colors that don't map cleanly +/// to Material 3 [ColorScheme] semantics. +/// +/// Access from widgets: +/// ```dart +/// final sfColors = Theme.of(context).extension()!; +/// Container(color: sfColors.legacyPrimary); +/// ``` +/// +/// For convenience, use the extension helper: +/// ```dart +/// context.sfColors.legacyPrimary +/// ``` +@immutable +class SfColors extends ThemeExtension { + const SfColors({ + required this.legacyPrimary, + required this.cardColorSet1, + required this.cardColorSet2, + required this.disabledCardColors, + }); + + /// Brand secondary color. Also mirrored in [ColorScheme.tertiary]. + final Color legacyPrimary; + + /// First set of card gradient colors (pink). + final List cardColorSet1; + + /// Second set of card gradient colors (cyan/blue). + final List cardColorSet2; + + /// Gradient applied to disabled cards. + final List disabledCardColors; + + @override + SfColors copyWith({ + Color? legacyPrimary, + List? cardColorSet1, + List? cardColorSet2, + List? disabledCardColors, + }) { + return SfColors( + legacyPrimary: legacyPrimary ?? this.legacyPrimary, + cardColorSet1: cardColorSet1 ?? this.cardColorSet1, + cardColorSet2: cardColorSet2 ?? this.cardColorSet2, + disabledCardColors: disabledCardColors ?? this.disabledCardColors, + ); + } + + @override + SfColors lerp(ThemeExtension? other, double t) { + if (other is! SfColors) return this; + return SfColors( + legacyPrimary: Color.lerp(legacyPrimary, other.legacyPrimary, t)!, + cardColorSet1: _lerpList(cardColorSet1, other.cardColorSet1, t), + cardColorSet2: _lerpList(cardColorSet2, other.cardColorSet2, t), + disabledCardColors: _lerpList(disabledCardColors, other.disabledCardColors, t), + ); + } + + static List _lerpList(List a, List b, double t) { + final int length = a.length < b.length ? a.length : b.length; + return List.generate( + length, + (i) => Color.lerp(a[i], b[i], t)!, + ); + } + + /// Light variant — identical to legacy `ThemeSfAdapter` palette. + static const SfColors light = SfColors( + legacyPrimary: Color(0xFF588EA5), + cardColorSet1: [Color(0xFFFA5C9F), Color(0xFFEB2579), Color(0xFFE60866)], + cardColorSet2: [Color(0xFF00A1C6), Color(0xFF00819E)], + disabledCardColors: [ + Color(0xFF989797), + Color(0xFF797676), + Color(0xFF5F5A5A), + ], + ); + + /// Dark variant — cards kept visually consistent; brand tone lightened. + static const SfColors dark = SfColors( + legacyPrimary: Color(0xFF7BA9BD), + cardColorSet1: [Color(0xFFFA5C9F), Color(0xFFEB2579), Color(0xFFE60866)], + cardColorSet2: [Color(0xFF00A1C6), Color(0xFF00819E)], + disabledCardColors: [ + Color(0xFF5F5F5F), + Color(0xFF494949), + Color(0xFF363636), + ], + ); +} + +/// Convenience extension: `context.sfColors.legacyPrimary` +extension SfColorsContext on BuildContext { + SfColors get sfColors => Theme.of(this).extension()!; +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/preferences/legacy_theme_preferences.dart b/modules/legacy/packages/legacy_theme/lib/src/data/preferences/legacy_theme_preferences.dart new file mode 100644 index 00000000..62608855 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/preferences/legacy_theme_preferences.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +/// Lightweight wrapper around [SharedPreferences] for persisting the user's +/// selected [ThemeMode] across sessions. +class LegacyThemePreferences { + LegacyThemePreferences(this._prefs); + + final SharedPreferences _prefs; + + static const _kThemeModeKey = 'legacy_theme_mode'; + + /// Returns the persisted mode, or `null` if none has been stored yet. + ThemeMode? readThemeMode() { + final raw = _prefs.getString(_kThemeModeKey); + if (raw == null) return null; + switch (raw) { + case 'light': + return ThemeMode.light; + case 'dark': + return ThemeMode.dark; + case 'system': + return ThemeMode.system; + default: + return null; + } + } + + /// Persists the given mode. + Future writeThemeMode(ThemeMode mode) { + return _prefs.setString(_kThemeModeKey, mode.name); + } + + /// Clears any persisted preference (next read returns `null`). + Future clear() => _prefs.remove(_kThemeModeKey); +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/theme_utils.dart b/modules/legacy/packages/legacy_theme/lib/src/data/theme_utils.dart new file mode 100644 index 00000000..1e6805c2 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/theme_utils.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'enums/legacy_theme_enum.dart'; +// import 'enums/timeframe_enum.dart'; // reserved — see file + +/// Utilities for mapping between [ThemeMode], [Brightness], and +/// [LegacyThemeEnum]. +class LegacyThemeUtils { + const LegacyThemeUtils._(); + + /// Maps the system brightness to a [ThemeMode] (helper for `ThemeMode.system`). + static ThemeMode brightnessToThemeMode(Brightness brightness) { + return brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark; + } + + /// Resolves the concrete [LegacyThemeEnum] variant for a given mode. + /// + /// When the timeframe feature is active, `timeframe` is honored to pick + /// `light1/2/3`. For now only `light` and `dark` are returned. + static LegacyThemeEnum resolveTheme(ThemeMode mode, Brightness platformBrightness) { + final effective = mode == ThemeMode.system + ? brightnessToThemeMode(platformBrightness) + : mode; + return effective == ThemeMode.dark ? LegacyThemeEnum.dark : LegacyThemeEnum.light; + } + + // ========================================================================== + // TIMEFRAME MAPPING (RESERVED — see timeframe_enum.dart) + // ========================================================================== + // static LegacyThemeEnum getThemeFromTimeframe( + // TimeframeEnum timeframe, + // ThemeMode mode, + // ) { + // final effectiveMode = mode == ThemeMode.system + // ? brightnessToThemeMode( + // SchedulerBinding.instance.platformDispatcher.platformBrightness, + // ) + // : mode; + // if (effectiveMode == ThemeMode.dark) return LegacyThemeEnum.dark; + // switch (timeframe) { + // case TimeframeEnum.morning: + // return LegacyThemeEnum.light1; + // case TimeframeEnum.afternoon: + // return LegacyThemeEnum.light2; + // case TimeframeEnum.evening: + // case TimeframeEnum.night: + // return LegacyThemeEnum.light3; + // } + // } +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_app_theme.dart b/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_app_theme.dart new file mode 100644 index 00000000..84da2a78 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_app_theme.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import '../extensions/sf_colors.dart'; +import 'legacy_color_schemes.dart'; + +/// Material 3 [ThemeData]s for legacy app mode. +/// +/// [SfColors] (custom brand tokens) are registered as a [ThemeExtension], +/// accessible via `Theme.of(context).extension()` or +/// `context.sfColors`. +class LegacyAppTheme { + const LegacyAppTheme._(); + + static ThemeData get light => ThemeData( + useMaterial3: true, + colorScheme: LegacyColorSchemes.light, + fontFamily: 'Stolzl', + extensions: const >[ + SfColors.light, + ], + ); + + static ThemeData get dark => ThemeData( + useMaterial3: true, + colorScheme: LegacyColorSchemes.dark, + fontFamily: 'Stolzl', + extensions: const >[ + SfColors.dark, + ], + ); + + // ========================================================================== + // TIMEFRAME-BASED LIGHT VARIANTS (RESERVED — see timeframe_enum.dart) + // ========================================================================== + // static ThemeData get light1 => light.copyWith( + // colorScheme: LegacyColorSchemes.light, // TODO: variant for morning + // ); + // static ThemeData get light2 => light.copyWith( + // colorScheme: LegacyColorSchemes.light, // TODO: variant for afternoon + // ); + // static ThemeData get light3 => light.copyWith( + // colorScheme: LegacyColorSchemes.light, // TODO: variant for evening/night + // ); +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_color_schemes.dart b/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_color_schemes.dart new file mode 100644 index 00000000..1e15c35a --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/data/themes/legacy_color_schemes.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; + +/// Material 3 [ColorScheme]s for legacy app mode. +/// +/// Mapping from legacy `ThemeCode` values: +/// - buttonPrimary → primary +/// - buttonSecondary → secondary +/// - textPrimary → onSurface +/// - textSecondary → onPrimary +/// - textTertiary → outline +/// - backgroundPrimary → surface +/// - backgroundSecondary → surfaceContainer +/// - backgroundTertiary → primaryContainer +/// - legacyPrimary → tertiary (also kept in SfColors extension) +class LegacyColorSchemes { + const LegacyColorSchemes._(); + + static const ColorScheme light = ColorScheme( + brightness: Brightness.light, + primary: Color(0xFF329E95), + onPrimary: Color(0xFFFFFFFF), + primaryContainer: Color(0xFFE5F3F1), + onPrimaryContainer: Color(0xFF003D3A), + secondary: Color(0xFF4B4B4B), + onSecondary: Color(0xFFFFFFFF), + secondaryContainer: Color(0xFFE0E0E0), + onSecondaryContainer: Color(0xFF1C1C1C), + tertiary: Color(0xFF588EA5), + onTertiary: Color(0xFFFFFFFF), + tertiaryContainer: Color(0xFFD7E5EC), + onTertiaryContainer: Color(0xFF12303D), + error: Color(0xFFB3261E), + onError: Color(0xFFFFFFFF), + errorContainer: Color(0xFFF9DEDC), + onErrorContainer: Color(0xFF410E0B), + surface: Color(0xFFFFFFFF), + onSurface: Color(0xFF4B4B4B), + surfaceContainerLowest: Color(0xFFFFFFFF), + surfaceContainerLow: Color(0xFFFAFAFA), + surfaceContainer: Color(0xFFF7F7F7), + surfaceContainerHigh: Color(0xFFF0F0F0), + surfaceContainerHighest: Color(0xFFE8E8E8), + onSurfaceVariant: Color(0xFF6B6B6B), + outline: Color(0xFFE0E0E0), + outlineVariant: Color(0xFFEAEAEA), + shadow: Color(0xFF000000), + scrim: Color(0xFF000000), + inverseSurface: Color(0xFF0E0E0E), + onInverseSurface: Color(0xFFEAEAEA), + inversePrimary: Color(0xFF7FC4BD), + surfaceTint: Color(0xFF329E95), + ); + + static const ColorScheme dark = ColorScheme( + brightness: Brightness.dark, + primary: Color(0xFF329E95), + onPrimary: Color(0xFFFFFFFF), + primaryContainer: Color(0xFF1F3A37), + onPrimaryContainer: Color(0xFF7FC4BD), + secondary: Color(0xFFEAEAEA), + onSecondary: Color(0xFF1C1C1C), + secondaryContainer: Color(0xFF2C2C2C), + onSecondaryContainer: Color(0xFFEAEAEA), + tertiary: Color(0xFF7BA9BD), + onTertiary: Color(0xFF0E1F27), + tertiaryContainer: Color(0xFF1F3A44), + onTertiaryContainer: Color(0xFFB0CDD7), + error: Color(0xFFF2B8B5), + onError: Color(0xFF601410), + errorContainer: Color(0xFF8C1D18), + onErrorContainer: Color(0xFFF9DEDC), + surface: Color(0xFF0E0E0E), + onSurface: Color(0xFFEAEAEA), + surfaceContainerLowest: Color(0xFF090909), + surfaceContainerLow: Color(0xFF151515), + surfaceContainer: Color(0xFF1A1A1A), + surfaceContainerHigh: Color(0xFF222222), + surfaceContainerHighest: Color(0xFFE8E8E8), + onSurfaceVariant: Color(0xFFBDBDBD), + outline: Color(0xFF555555), + outlineVariant: Color(0xFF333333), + shadow: Color(0xFF000000), + scrim: Color(0xFF000000), + inverseSurface: Color(0xFFEAEAEA), + onInverseSurface: Color(0xFF0E0E0E), + inversePrimary: Color(0xFF1F3A37), + surfaceTint: Color(0xFF329E95), + ); +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/presentation/providers/legacy_theme_providers.dart b/modules/legacy/packages/legacy_theme/lib/src/presentation/providers/legacy_theme_providers.dart new file mode 100644 index 00000000..2edab6dd --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/presentation/providers/legacy_theme_providers.dart @@ -0,0 +1,39 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../../data/preferences/legacy_theme_preferences.dart'; +import '../state/legacy_theme_notifier.dart'; +import '../state/legacy_theme_state.dart'; + +/// Provides a configured [SharedPreferences] instance. +/// +/// Override this in bootstrap (usually in `init_app.dart`) so the first-frame +/// render already has preferences available: +/// ```dart +/// final prefs = await SharedPreferences.getInstance(); +/// runApp( +/// ProviderScope( +/// overrides: [ +/// sharedPreferencesProvider.overrideWithValue(prefs), +/// ], +/// child: const SaveFamilyApp(), +/// ), +/// ); +/// ``` +final sharedPreferencesProvider = Provider((ref) { + throw UnimplementedError( + 'sharedPreferencesProvider must be overridden in main/init before runApp.', + ); +}); + +/// Repository-level provider for the theme preferences wrapper. +final legacyThemePreferencesProvider = Provider((ref) { + return LegacyThemePreferences(ref.watch(sharedPreferencesProvider)); +}); + +/// Main notifier provider — consume from `MaterialApp.router` and the +/// theme selector widget. +final legacyThemeNotifierProvider = + NotifierProvider( + LegacyThemeNotifier.new, +); diff --git a/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_notifier.dart b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_notifier.dart new file mode 100644 index 00000000..64d32388 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_notifier.dart @@ -0,0 +1,87 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../data/enums/legacy_theme_enum.dart'; +// import '../../data/enums/timeframe_enum.dart'; // reserved — see file +import '../../data/preferences/legacy_theme_preferences.dart'; +import '../../data/theme_utils.dart'; +import '../providers/legacy_theme_providers.dart'; +import 'legacy_theme_state.dart'; + +/// [LegacyThemeEnum] currently applied. +class LegacyThemeNotifier extends Notifier { + // StreamSubscription? _timeframeSub; + + LegacyThemePreferences get _preferences => + ref.read(legacyThemePreferencesProvider); + + @override + LegacyThemeState build() { + final persistedMode = _preferences.readThemeMode(); + final initialMode = persistedMode ?? ThemeMode.system; + final currentTheme = LegacyThemeUtils.resolveTheme( + initialMode, + _platformBrightness, + ); + + PlatformDispatcher.instance.onPlatformBrightnessChanged = () { + if (state.themeMode == ThemeMode.system) { + final next = LegacyThemeUtils.resolveTheme( + ThemeMode.system, + _platformBrightness, + ); + if (next != state.currentTheme) { + state = state.copyWith(currentTheme: next); + } + } + }; + + // ======================================================================== + // TIMEFRAME SUBSCRIPTION (RESERVED) + // ======================================================================== + // _timeframeSub = timeframeStream.listen((timeframe) { + // final variant = LegacyThemeUtils.getThemeFromTimeframe( + // timeframe, + // state.themeMode, + // ); + // if (variant != state.currentTheme) { + // state = state.copyWith(currentTheme: variant); + // } + // }); + // ref.onDispose(() => _timeframeSub?.cancel()); + + return LegacyThemeState(themeMode: initialMode, currentTheme: currentTheme); + } + + Future setThemeMode(ThemeMode mode) async { + final resolved = LegacyThemeUtils.resolveTheme(mode, _platformBrightness); + state = state.copyWith( + themeMode: mode, + currentTheme: resolved, + tempSelectionMode: null, + ); + await _preferences.writeThemeMode(mode); + } + + /// Stages a temporary selection without applying it. + /// Useful for confirmation popups: call [commitTempSelection] to apply, + /// or [clearTempSelection] to discard. + void stageTempSelection(ThemeMode mode) { + state = state.copyWith(tempSelectionMode: mode); + } + + void clearTempSelection() { + state = state.copyWith(tempSelectionMode: null); + } + + Future commitTempSelection() async { + final staged = state.tempSelectionMode; + if (staged == null) return; + await setThemeMode(staged); + } + + Brightness get _platformBrightness => + PlatformDispatcher.instance.platformBrightness; +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.dart b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.dart new file mode 100644 index 00000000..9cd5551b --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +import '../../data/enums/legacy_theme_enum.dart'; + +part 'legacy_theme_state.freezed.dart'; + +@freezed +abstract class LegacyThemeState with _$LegacyThemeState { + const factory LegacyThemeState({ + @Default(ThemeMode.system) ThemeMode themeMode, + @Default(LegacyThemeEnum.light) LegacyThemeEnum currentTheme, + ThemeMode? tempSelectionMode, + }) = _LegacyThemeState; +} diff --git a/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.freezed.dart b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.freezed.dart new file mode 100644 index 00000000..95fcc5ea --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/presentation/state/legacy_theme_state.freezed.dart @@ -0,0 +1,277 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'legacy_theme_state.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$LegacyThemeState { + + ThemeMode get themeMode; LegacyThemeEnum get currentTheme; ThemeMode? get tempSelectionMode; +/// Create a copy of LegacyThemeState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$LegacyThemeStateCopyWith get copyWith => _$LegacyThemeStateCopyWithImpl(this as LegacyThemeState, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is LegacyThemeState&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.currentTheme, currentTheme) || other.currentTheme == currentTheme)&&(identical(other.tempSelectionMode, tempSelectionMode) || other.tempSelectionMode == tempSelectionMode)); +} + + +@override +int get hashCode => Object.hash(runtimeType,themeMode,currentTheme,tempSelectionMode); + +@override +String toString() { + return 'LegacyThemeState(themeMode: $themeMode, currentTheme: $currentTheme, tempSelectionMode: $tempSelectionMode)'; +} + + +} + +/// @nodoc +abstract mixin class $LegacyThemeStateCopyWith<$Res> { + factory $LegacyThemeStateCopyWith(LegacyThemeState value, $Res Function(LegacyThemeState) _then) = _$LegacyThemeStateCopyWithImpl; +@useResult +$Res call({ + ThemeMode themeMode, LegacyThemeEnum currentTheme, ThemeMode? tempSelectionMode +}); + + + + +} +/// @nodoc +class _$LegacyThemeStateCopyWithImpl<$Res> + implements $LegacyThemeStateCopyWith<$Res> { + _$LegacyThemeStateCopyWithImpl(this._self, this._then); + + final LegacyThemeState _self; + final $Res Function(LegacyThemeState) _then; + +/// Create a copy of LegacyThemeState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? themeMode = null,Object? currentTheme = null,Object? tempSelectionMode = freezed,}) { + return _then(_self.copyWith( +themeMode: null == themeMode ? _self.themeMode : themeMode // ignore: cast_nullable_to_non_nullable +as ThemeMode,currentTheme: null == currentTheme ? _self.currentTheme : currentTheme // ignore: cast_nullable_to_non_nullable +as LegacyThemeEnum,tempSelectionMode: freezed == tempSelectionMode ? _self.tempSelectionMode : tempSelectionMode // ignore: cast_nullable_to_non_nullable +as ThemeMode?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [LegacyThemeState]. +extension LegacyThemeStatePatterns on LegacyThemeState { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _LegacyThemeState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _LegacyThemeState() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _LegacyThemeState value) $default,){ +final _that = this; +switch (_that) { +case _LegacyThemeState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _LegacyThemeState value)? $default,){ +final _that = this; +switch (_that) { +case _LegacyThemeState() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( ThemeMode themeMode, LegacyThemeEnum currentTheme, ThemeMode? tempSelectionMode)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _LegacyThemeState() when $default != null: +return $default(_that.themeMode,_that.currentTheme,_that.tempSelectionMode);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( ThemeMode themeMode, LegacyThemeEnum currentTheme, ThemeMode? tempSelectionMode) $default,) {final _that = this; +switch (_that) { +case _LegacyThemeState(): +return $default(_that.themeMode,_that.currentTheme,_that.tempSelectionMode);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( ThemeMode themeMode, LegacyThemeEnum currentTheme, ThemeMode? tempSelectionMode)? $default,) {final _that = this; +switch (_that) { +case _LegacyThemeState() when $default != null: +return $default(_that.themeMode,_that.currentTheme,_that.tempSelectionMode);case _: + return null; + +} +} + +} + +/// @nodoc + + +class _LegacyThemeState implements LegacyThemeState { + const _LegacyThemeState({this.themeMode = ThemeMode.system, this.currentTheme = LegacyThemeEnum.light, this.tempSelectionMode}); + + +@override@JsonKey() final ThemeMode themeMode; +@override@JsonKey() final LegacyThemeEnum currentTheme; +@override final ThemeMode? tempSelectionMode; + +/// Create a copy of LegacyThemeState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$LegacyThemeStateCopyWith<_LegacyThemeState> get copyWith => __$LegacyThemeStateCopyWithImpl<_LegacyThemeState>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _LegacyThemeState&&(identical(other.themeMode, themeMode) || other.themeMode == themeMode)&&(identical(other.currentTheme, currentTheme) || other.currentTheme == currentTheme)&&(identical(other.tempSelectionMode, tempSelectionMode) || other.tempSelectionMode == tempSelectionMode)); +} + + +@override +int get hashCode => Object.hash(runtimeType,themeMode,currentTheme,tempSelectionMode); + +@override +String toString() { + return 'LegacyThemeState(themeMode: $themeMode, currentTheme: $currentTheme, tempSelectionMode: $tempSelectionMode)'; +} + + +} + +/// @nodoc +abstract mixin class _$LegacyThemeStateCopyWith<$Res> implements $LegacyThemeStateCopyWith<$Res> { + factory _$LegacyThemeStateCopyWith(_LegacyThemeState value, $Res Function(_LegacyThemeState) _then) = __$LegacyThemeStateCopyWithImpl; +@override @useResult +$Res call({ + ThemeMode themeMode, LegacyThemeEnum currentTheme, ThemeMode? tempSelectionMode +}); + + + + +} +/// @nodoc +class __$LegacyThemeStateCopyWithImpl<$Res> + implements _$LegacyThemeStateCopyWith<$Res> { + __$LegacyThemeStateCopyWithImpl(this._self, this._then); + + final _LegacyThemeState _self; + final $Res Function(_LegacyThemeState) _then; + +/// Create a copy of LegacyThemeState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? themeMode = null,Object? currentTheme = null,Object? tempSelectionMode = freezed,}) { + return _then(_LegacyThemeState( +themeMode: null == themeMode ? _self.themeMode : themeMode // ignore: cast_nullable_to_non_nullable +as ThemeMode,currentTheme: null == currentTheme ? _self.currentTheme : currentTheme // ignore: cast_nullable_to_non_nullable +as LegacyThemeEnum,tempSelectionMode: freezed == tempSelectionMode ? _self.tempSelectionMode : tempSelectionMode // ignore: cast_nullable_to_non_nullable +as ThemeMode?, + )); +} + + +} + +// dart format on diff --git a/modules/legacy/packages/legacy_theme/lib/src/presentation/widgets/legacy_theme_selector.dart b/modules/legacy/packages/legacy_theme/lib/src/presentation/widgets/legacy_theme_selector.dart new file mode 100644 index 00000000..39a7f683 --- /dev/null +++ b/modules/legacy/packages/legacy_theme/lib/src/presentation/widgets/legacy_theme_selector.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../providers/legacy_theme_providers.dart'; + +/// Horizontal 3-option selector for light / dark / system theme modes. +/// +/// Applies the choice immediately on tap (via `setThemeMode`), so the +/// enclosing screen sees the theme change without any extra wiring. +/// +/// Drop into any settings screen: +/// ```dart +/// const LegacyThemeSelector() +/// ``` +class LegacyThemeSelector extends ConsumerWidget { + const LegacyThemeSelector({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final themeMode = ref.watch( + legacyThemeNotifierProvider.select((s) => s.themeMode), + ); + final notifier = ref.read(legacyThemeNotifierProvider.notifier); + + return SegmentedButton( + segments: const >[ + ButtonSegment( + value: ThemeMode.light, + label: Text('Light'), + icon: Icon(Icons.light_mode_outlined), + ), + ButtonSegment( + value: ThemeMode.dark, + label: Text('Dark'), + icon: Icon(Icons.dark_mode_outlined), + ), + ButtonSegment( + value: ThemeMode.system, + label: Text('System'), + icon: Icon(Icons.brightness_auto_outlined), + ), + ], + selected: {themeMode}, + onSelectionChanged: (Set selection) { + notifier.setThemeMode(selection.first); + }, + ); + } +} diff --git a/modules/legacy/packages/legacy_theme/pubspec.yaml b/modules/legacy/packages/legacy_theme/pubspec.yaml new file mode 100644 index 00000000..6dd5d5ff --- /dev/null +++ b/modules/legacy/packages/legacy_theme/pubspec.yaml @@ -0,0 +1,28 @@ +name: legacy_theme +description: "Theming for legacy app mode — Material 3 based, supports light/dark modes with ThemeExtension for custom SF colors." +publish_to: 'none' +resolution: workspace +version: 1.0.0+1 + +environment: + sdk: ^3.9.2 + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + flutter_riverpod: ^3.0.3 + freezed_annotation: ^3.1.0 + json_annotation: ^4.9.0 + shared_preferences: ^2.5.5 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + build_runner: ^2.7.1 + freezed: ^3.2.3 + json_serializable: ^6.11.2 + +flutter: + uses-material-design: true diff --git a/packages/navigation/lib/app_routes.dart b/packages/navigation/lib/app_routes.dart index 342dd058..65624c50 100644 --- a/packages/navigation/lib/app_routes.dart +++ b/packages/navigation/lib/app_routes.dart @@ -91,6 +91,7 @@ class AppRoutes { static const deleteAccount = '$accountSettings/delete_account'; static const settings = '$controlPanel/settings'; + static const appearance = '$settings/appearance'; static const alarm = '$settings/alarm'; static const appStore = '$settings/app_store'; static const battery = '$settings/battery'; diff --git a/packages/sf_localizations/assets/l10n/de.json b/packages/sf_localizations/assets/l10n/de.json index 1efebea1..927a826e 100644 --- a/packages/sf_localizations/assets/l10n/de.json +++ b/packages/sf_localizations/assets/l10n/de.json @@ -1,5 +1,7 @@ { "example": "Beispiel", + "appearance": "Erscheinungsbild", + "appearanceDescription": "Wählen Sie das Erscheinungsbild, das Ihren Vorlieben am besten entspricht. System folgt automatisch dem Thema Ihres Geräts.", "start": "Starten", "next": "Weiter", "skip": "Überspringen", diff --git a/packages/sf_localizations/assets/l10n/en.json b/packages/sf_localizations/assets/l10n/en.json index 81499486..04c83769 100755 --- a/packages/sf_localizations/assets/l10n/en.json +++ b/packages/sf_localizations/assets/l10n/en.json @@ -1,5 +1,7 @@ { "example": "example", + "appearance": "Appearance", + "appearanceDescription": "Choose the appearance that best matches your preference. System follows your device theme automatically.", "onboardingTitle1": "Real-time device location", "onboardingSubtitle1": "Don't miss a thing.\nAccess your device's location in real time wherever you are.", "onboardingTitle2": "Safety Zone", diff --git a/packages/sf_localizations/assets/l10n/es.json b/packages/sf_localizations/assets/l10n/es.json index 2f2d493f..8af11a54 100644 --- a/packages/sf_localizations/assets/l10n/es.json +++ b/packages/sf_localizations/assets/l10n/es.json @@ -1,5 +1,7 @@ { "example": "ejemplo", + "appearance": "Apariencia", + "appearanceDescription": "Elige la apariencia que mejor se adapte a tu preferencia. Sistema sigue automáticamente el tema de tu dispositivo.", "onboardingTitle1": "Ubicación del dispositivo en tiempo real", "onboardingSubtitle1": "No te pierdas nada.\nAccede a la ubicación de tu dispositivo en tiempo real estés donde estés.", "onboardingTitle2": "Zona segura", diff --git a/packages/sf_localizations/assets/l10n/fr.json b/packages/sf_localizations/assets/l10n/fr.json index 8cccba34..f3168cdf 100644 --- a/packages/sf_localizations/assets/l10n/fr.json +++ b/packages/sf_localizations/assets/l10n/fr.json @@ -1,5 +1,7 @@ { "example": "exemple", + "appearance": "Apparence", + "appearanceDescription": "Choisissez l'apparence qui correspond le mieux à vos préférences. Système suit automatiquement le thème de votre appareil.", "start": "Commencer", "next": "Suivant", "skip": "Passer", diff --git a/packages/sf_localizations/assets/l10n/it.json b/packages/sf_localizations/assets/l10n/it.json index 2254ee23..191aacd4 100644 --- a/packages/sf_localizations/assets/l10n/it.json +++ b/packages/sf_localizations/assets/l10n/it.json @@ -1,5 +1,7 @@ { "example": "esempio", + "appearance": "Aspetto", + "appearanceDescription": "Scegli l'aspetto che meglio corrisponde alle tue preferenze. Sistema segue automaticamente il tema del tuo dispositivo.", "start": "Inizia", "next": "Avanti", "skip": "Salta", diff --git a/packages/sf_localizations/assets/l10n/pt.json b/packages/sf_localizations/assets/l10n/pt.json index 22275ba8..6643c3bd 100644 --- a/packages/sf_localizations/assets/l10n/pt.json +++ b/packages/sf_localizations/assets/l10n/pt.json @@ -1,5 +1,7 @@ { "example": "exemplo", + "appearance": "Aparência", + "appearanceDescription": "Escolha a aparência que melhor se adapta à sua preferência. Sistema segue automaticamente o tema do seu dispositivo.", "start": "Começar", "next": "Próximo", "skip": "Pular", diff --git a/packages/sf_localizations/lib/src/generated/i18n.dart b/packages/sf_localizations/lib/src/generated/i18n.dart index bb8374a0..1c3127be 100755 --- a/packages/sf_localizations/lib/src/generated/i18n.dart +++ b/packages/sf_localizations/lib/src/generated/i18n.dart @@ -33,6 +33,8 @@ class I18n { static const String addNewSaveFamilyDevice = 'addNewSaveFamilyDevice'; static const String addressCountryHint = 'addressCountryHint'; static const String addressCountryLabel = 'addressCountryLabel'; + static const String appearance = 'appearance'; + static const String appearanceDescription = 'appearanceDescription'; static const String addSosContact = 'addSosContact'; static const String addWifiNetwork = 'addWifiNetwork'; static const String alarm = 'alarm'; diff --git a/pubspec.yaml b/pubspec.yaml index af1d669d..24ec0f36 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,6 +25,7 @@ workspace: - modules/legacy/modules/settings - modules/legacy/packages/legacy_shared - modules/legacy/packages/legacy_device_state + - modules/legacy/packages/legacy_theme - packages/design_system - packages/flutter_treezor_entrust_sdk_bridge - packages/flutter_treezor_entrust_sdk_bridge/example