From bdd0d3dee24e15a100bff2e89da1d7a145a22333 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 24 May 2026 11:55:50 +0200 Subject: [PATCH] make raster tile source scollable --- lib/screens/app_settings_screen.dart | 43 +++++++++-------- lib/services/map_tile_cache_service.dart | 59 +++++++++++++++++------- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index cf81be02..f062f128 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -626,24 +626,31 @@ class AppSettingsScreen extends StatelessWidget { title: const Text('Raster Tile Source'), content: SizedBox( width: 360, - child: RadioGroup( - groupValue: selectedId, - onChanged: (value) { - if (value == null) return; - setState(() { - selectedId = value; - }); - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - for (final option in MapRasterSourceCatalog.presets) - RadioListTile( - value: option.id, - title: Text(option.label), - subtitle: Text(option.description), - ), - ], + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(dialogContext).size.height * 0.6, + ), + child: SingleChildScrollView( + child: RadioGroup( + groupValue: selectedId, + onChanged: (value) { + if (value == null) return; + setState(() { + selectedId = value; + }); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + for (final option in MapRasterSourceCatalog.presets) + RadioListTile( + value: option.id, + title: Text(option.label), + subtitle: Text(option.description), + ), + ], + ), + ), ), ), ), diff --git a/lib/services/map_tile_cache_service.dart b/lib/services/map_tile_cache_service.dart index 6525106a..3db69c2a 100644 --- a/lib/services/map_tile_cache_service.dart +++ b/lib/services/map_tile_cache_service.dart @@ -288,9 +288,8 @@ class MapTileCacheService extends ChangeNotifier { String get urlTemplate => _buildUrlTemplate(appSettingsService.settings); - TileBuilder? get tileBuilder => isInvertedOsmDarkSource - ? _osmDarkTileBuilder - : null; + TileBuilder? get tileBuilder => + isInvertedOsmDarkSource ? _osmDarkTileBuilder : null; bool get isInvertedOsmDarkSource => source.id == MapRasterSourceCatalog.osmDark.id; @@ -638,24 +637,52 @@ class MapTileCacheService extends ChangeNotifier { } } -Widget _osmDarkTileBuilder( - BuildContext _, - Widget tileWidget, - TileImage __, -) { +Widget _osmDarkTileBuilder(BuildContext _, Widget tileWidget, TileImage tile) { return ColorFiltered( colorFilter: const ColorFilter.matrix([ - 1.33, 0, 0, 0, 0, - 0, 1.33, 0, 0, 0, - 0, 0, 1.33, 0, 0, - 0, 0, 0, 1, 0, + 1.33, + 0, + 0, + 0, + 0, + 0, + 1.33, + 0, + 0, + 0, + 0, + 0, + 1.33, + 0, + 0, + 0, + 0, + 0, + 1, + 0, ]), child: ColorFiltered( colorFilter: const ColorFilter.matrix([ - 0.5740000009536743, -1.4299999475479126, -0.14399999380111694, 0, 255, - -0.4259999990463257, -0.429999977350235, -0.14399999380111694, 0, 255, - -0.4259999990463257, -1.4299999475479126, 0.8559999465942383, 0, 255, - 0, 0, 0, 1, 0, + 0.5740000009536743, + -1.4299999475479126, + -0.14399999380111694, + 0, + 255, + -0.4259999990463257, + -0.429999977350235, + -0.14399999380111694, + 0, + 255, + -0.4259999990463257, + -1.4299999475479126, + 0.8559999465942383, + 0, + 255, + 0, + 0, + 0, + 1, + 0, ]), child: tileWidget, ),