Skip to content

High performance self-hosted photo and video management solution.

fix: ios map settings sheet (#31060)

shenlong22a56a79f21b
diff --git a/mobile/lib/presentation/widgets/map/map_settings_sheet.dart b/mobile/lib/presentation/widgets/map/map_settings_sheet.dart
index 43860ec61d..e845dda435 100644
--- a/mobile/lib/presentation/widgets/map/map_settings_sheet.dart
+++ b/mobile/lib/presentation/widgets/map/map_settings_sheet.dart
@@ -6,7 +6,6 @@ import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
import 'package:immich_mobile/widgets/map/map_settings/map_custom_time_range.dart';
import 'package:immich_mobile/widgets/map/map_settings/map_settings_list_tile.dart';
import 'package:immich_mobile/widgets/map/map_settings/map_settings_time_dropdown.dart';
-import 'package:immich_mobile/widgets/map/map_settings/map_theme_picker.dart';
class MapSettingsSheet extends ConsumerStatefulWidget {
const MapSettingsSheet({super.key});
@@ -43,10 +42,17 @@ class _MapSettingsSheetState extends ConsumerState<MapSettingsSheet> {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
- MapThemePicker(
- themeMode: mapState.themeMode,
- onThemeChange: (mode) => ref.read(mapStateProvider.notifier).switchTheme(mode),
+ MapSettingsListTile(
+ title: context.t.theme_setting_system_theme_switch,
+ selected: mapState.themeMode == .system,
+ onChanged: (isSystem) => ref.read(mapStateProvider.notifier).switchTheme(isSystem ? .system : .light),
),
+ if (mapState.themeMode != .system)
+ MapSettingsListTile(
+ title: context.t.map_settings_dark_mode,
+ selected: mapState.themeMode == .dark,
+ onChanged: (isDark) => ref.read(mapStateProvider.notifier).switchTheme(isDark ? .dark : .light),
+ ),
const Divider(height: 30, thickness: 1),
MapSettingsListTile(
title: context.t.map_settings_only_show_favorites,
diff --git a/mobile/lib/widgets/map/map_settings/map_theme_picker.dart b/mobile/lib/widgets/map/map_settings/map_theme_picker.dart
deleted file mode 100644
index 6b53a273a0..0000000000
--- a/mobile/lib/widgets/map/map_settings/map_theme_picker.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:immich_mobile/extensions/build_context_extensions.dart';
-import 'package:immich_mobile/generated/translations.g.dart';
-import 'package:immich_mobile/widgets/map/map_thumbnail.dart';
-import 'package:maplibre_gl/maplibre_gl.dart';
-
-class MapThemePicker extends StatelessWidget {
- final ThemeMode themeMode;
- final Function(ThemeMode) onThemeChange;
-
- const MapThemePicker({super.key, required this.themeMode, required this.onThemeChange});
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: [
- Padding(
- padding: const EdgeInsets.only(bottom: 20),
- child: Center(
- child: Text(
- context.t.map_settings_theme_settings,
- style: context.textTheme.bodyLarge!.copyWith(fontWeight: FontWeight.w500, height: 1.5),
- ),
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _BorderedMapThumbnail(
- name: "Light",
- mode: ThemeMode.light,
- shouldHighlight: themeMode == ThemeMode.light,
- onThemeChange: onThemeChange,
- ),
- _BorderedMapThumbnail(
- name: "Dark",
- mode: ThemeMode.dark,
- shouldHighlight: themeMode == ThemeMode.dark,
- onThemeChange: onThemeChange,
- ),
- _BorderedMapThumbnail(
- name: "System",
- mode: ThemeMode.system,
- shouldHighlight: themeMode == ThemeMode.system,
- onThemeChange: onThemeChange,
- ),
- ],
- ),
- ],
- );
- }
-}
-
-class _BorderedMapThumbnail extends StatelessWidget {
- final ThemeMode mode;
- final String name;
- final bool shouldHighlight;
- final Function(ThemeMode) onThemeChange;
-
- const _BorderedMapThumbnail({
- required this.mode,
- required this.name,
- required this.shouldHighlight,
- required this.onThemeChange,
- });
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: [
- DecoratedBox(
- decoration: BoxDecoration(
- border: Border.fromBorderSide(
- BorderSide(width: 4, color: shouldHighlight ? context.colorScheme.onSurface : Colors.transparent),
- ),
- borderRadius: const BorderRadius.all(Radius.circular(20)),
- ),
- child: MapThumbnail(
- zoom: 2,
- centre: const LatLng(47, 5),
- onTap: (_, _) => onThemeChange(mode),
- themeMode: mode,
- showAttribution: false,
- ),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 10),
- child: Text(
- name,
- style: context.textTheme.bodyMedium?.copyWith(fontWeight: shouldHighlight ? FontWeight.bold : null),
- ),
- ),
- ],
- );
- }
-}