debug: viewer tile display flag
This commit is contained in:
parent
0575a6cce6
commit
b282d0a250
5 changed files with 42 additions and 1 deletions
7
lib/model/settings/modules/debug.dart
Normal file
7
lib/model/settings/modules/debug.dart
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import 'package:aves_model/aves_model.dart';
|
||||||
|
|
||||||
|
mixin DebugSettings on SettingsAccess {
|
||||||
|
bool get debugShowViewerTiles => getBool(SettingKeys.debugShowViewerTilesKey) ?? false;
|
||||||
|
|
||||||
|
set debugShowViewerTiles(bool newValue) => set(SettingKeys.debugShowViewerTilesKey, newValue);
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import 'package:aves/model/settings/enums/accessibility_animations.dart';
|
||||||
import 'package:aves/model/settings/enums/map_style.dart';
|
import 'package:aves/model/settings/enums/map_style.dart';
|
||||||
import 'package:aves/model/settings/modules/app.dart';
|
import 'package:aves/model/settings/modules/app.dart';
|
||||||
import 'package:aves/model/settings/modules/collection.dart';
|
import 'package:aves/model/settings/modules/collection.dart';
|
||||||
|
import 'package:aves/model/settings/modules/debug.dart';
|
||||||
import 'package:aves/model/settings/modules/display.dart';
|
import 'package:aves/model/settings/modules/display.dart';
|
||||||
import 'package:aves/model/settings/modules/filter_grids.dart';
|
import 'package:aves/model/settings/modules/filter_grids.dart';
|
||||||
import 'package:aves/model/settings/modules/info.dart';
|
import 'package:aves/model/settings/modules/info.dart';
|
||||||
|
@ -40,7 +41,7 @@ import 'package:latlong2/latlong.dart';
|
||||||
|
|
||||||
final Settings settings = Settings._private();
|
final Settings settings = Settings._private();
|
||||||
|
|
||||||
class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings, NavigationSettings, SearchSettings, CollectionSettings, FilterGridsSettings, PrivacySettings, ViewerSettings, VideoSettings, SubtitlesSettings, InfoSettings {
|
class Settings with ChangeNotifier, SettingsAccess, DebugSettings, AppSettings, DisplaySettings, NavigationSettings, SearchSettings, CollectionSettings, FilterGridsSettings, PrivacySettings, ViewerSettings, VideoSettings, SubtitlesSettings, InfoSettings {
|
||||||
final List<StreamSubscription> _subscriptions = [];
|
final List<StreamSubscription> _subscriptions = [];
|
||||||
final EventChannel _platformSettingsChangeChannel = const OptionalEventChannel('deckers.thibault/aves/settings_change');
|
final EventChannel _platformSettingsChangeChannel = const OptionalEventChannel('deckers.thibault/aves/settings_change');
|
||||||
final StreamController<SettingsChangedEvent> _updateStreamController = StreamController.broadcast();
|
final StreamController<SettingsChangedEvent> _updateStreamController = StreamController.broadcast();
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/model/source/collection_source.dart';
|
import 'package:aves/model/source/collection_source.dart';
|
||||||
import 'package:aves/services/analysis_service.dart';
|
import 'package:aves/services/analysis_service.dart';
|
||||||
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
||||||
import 'package:aves/widgets/debug/overlay.dart';
|
import 'package:aves/widgets/debug/overlay.dart';
|
||||||
|
import 'package:aves/widgets/settings/common/tiles.dart';
|
||||||
import 'package:aves/widgets/viewer/info/common.dart';
|
import 'package:aves/widgets/viewer/info/common.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -61,6 +63,11 @@ class _DebugGeneralSectionState extends State<DebugGeneralSection> with Automati
|
||||||
},
|
},
|
||||||
title: const Text('Show tasks overlay'),
|
title: const Text('Show tasks overlay'),
|
||||||
),
|
),
|
||||||
|
SettingsSwitchListTile(
|
||||||
|
selector: (context, s) => s.debugShowViewerTiles,
|
||||||
|
onChanged: (v) => settings.debugShowViewerTiles = v,
|
||||||
|
title: 'Show viewer tiles',
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
||||||
const config = LeakDiagnosticConfig(
|
const config = LeakDiagnosticConfig(
|
||||||
|
|
|
@ -429,6 +429,28 @@ class _RegionTileState extends State<_RegionTile> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.debugShowViewerTiles) {
|
||||||
|
final regionRect = widget.regionRect;
|
||||||
|
child = Stack(
|
||||||
|
children: [
|
||||||
|
Positioned.fill(child: child),
|
||||||
|
Text(
|
||||||
|
'\ntile=(${tileRect.left.round()}, ${tileRect.top.round()}) ${tileRect.width.round()} x ${tileRect.height.round()}'
|
||||||
|
'\nregion=(${regionRect.left.round()}, ${regionRect.top.round()}) ${regionRect.width.round()} x ${regionRect.height.round()}'
|
||||||
|
'\nsampleSize=${widget.sampleSize}',
|
||||||
|
style: const TextStyle(backgroundColor: Colors.black87),
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.red, width: 1),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Positioned.fromRect(
|
return Positioned.fromRect(
|
||||||
rect: tileRect,
|
rect: tileRect,
|
||||||
child: child,
|
child: child,
|
||||||
|
|
|
@ -10,6 +10,7 @@ class SettingKeys {
|
||||||
topEntryIdsKey,
|
topEntryIdsKey,
|
||||||
recentDestinationAlbumsKey,
|
recentDestinationAlbumsKey,
|
||||||
recentTagsKey,
|
recentTagsKey,
|
||||||
|
debugShowViewerTilesKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const _widgetKeyPrefix = 'widget_';
|
static const _widgetKeyPrefix = 'widget_';
|
||||||
|
@ -29,6 +30,9 @@ class SettingKeys {
|
||||||
static const recentDestinationAlbumsKey = 'recent_destination_albums';
|
static const recentDestinationAlbumsKey = 'recent_destination_albums';
|
||||||
static const recentTagsKey = 'recent_tags';
|
static const recentTagsKey = 'recent_tags';
|
||||||
|
|
||||||
|
// debug
|
||||||
|
static const debugShowViewerTilesKey = 'debug_show_viewer_tiles';
|
||||||
|
|
||||||
// display
|
// display
|
||||||
static const displayRefreshRateModeKey = 'display_refresh_rate_mode';
|
static const displayRefreshRateModeKey = 'display_refresh_rate_mode';
|
||||||
static const themeBrightnessKey = 'theme_brightness';
|
static const themeBrightnessKey = 'theme_brightness';
|
||||||
|
|
Loading…
Reference in a new issue