leaks: overlay entry review, change notifier mixin creation event
This commit is contained in:
parent
3a63533dd9
commit
5985a89f85
12 changed files with 49 additions and 24 deletions
|
@ -12,7 +12,9 @@ final Favourites favourites = Favourites._private();
|
||||||
class Favourites with ChangeNotifier {
|
class Favourites with ChangeNotifier {
|
||||||
Set<FavouriteRow> _rows = {};
|
Set<FavouriteRow> _rows = {};
|
||||||
|
|
||||||
Favourites._private();
|
Favourites._private() {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
_rows = await localMediaDb.loadAllFavourites();
|
_rows = await localMediaDb.loadAllFavourites();
|
||||||
|
|
|
@ -5,6 +5,10 @@ import 'package:flutter/painting.dart';
|
||||||
class HighlightInfo extends ChangeNotifier {
|
class HighlightInfo extends ChangeNotifier {
|
||||||
final EventBus eventBus = EventBus();
|
final EventBus eventBus = EventBus();
|
||||||
|
|
||||||
|
HighlightInfo() {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
|
}
|
||||||
|
|
||||||
void trackItem<T>(
|
void trackItem<T>(
|
||||||
T? item, {
|
T? item, {
|
||||||
TrackPredicate? predicate,
|
TrackPredicate? predicate,
|
||||||
|
|
|
@ -9,6 +9,7 @@ class Query extends ChangeNotifier {
|
||||||
final StreamController<bool> _enabledStreamController = StreamController.broadcast();
|
final StreamController<bool> _enabledStreamController = StreamController.broadcast();
|
||||||
|
|
||||||
Query({required bool enabled, required String? initialValue}) {
|
Query({required bool enabled, required String? initialValue}) {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
_enabled = enabled;
|
_enabled = enabled;
|
||||||
if (initialValue != null && initialValue.isNotEmpty) {
|
if (initialValue != null && initialValue.isNotEmpty) {
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
|
|
|
@ -9,6 +9,10 @@ class Selection<T> extends ChangeNotifier {
|
||||||
|
|
||||||
Set<T> get selectedItems => _selectedItems;
|
Set<T> get selectedItems => _selectedItems;
|
||||||
|
|
||||||
|
Selection() {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
|
}
|
||||||
|
|
||||||
void browse() {
|
void browse() {
|
||||||
if (!_isSelecting) return;
|
if (!_isSelecting) return;
|
||||||
_isSelecting = false;
|
_isSelecting = false;
|
||||||
|
|
|
@ -33,8 +33,8 @@ import 'package:aves_utils/aves_utils.dart';
|
||||||
import 'package:aves_video/aves_video.dart';
|
import 'package:aves_video/aves_video.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
|
|
||||||
final Settings settings = Settings._private();
|
final Settings settings = Settings._private();
|
||||||
|
@ -56,7 +56,9 @@ class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings
|
||||||
@override
|
@override
|
||||||
SettingsStore get store => settingsStore;
|
SettingsStore get store => settingsStore;
|
||||||
|
|
||||||
Settings._private();
|
Settings._private() {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> init({required bool monitorPlatformSettings}) async {
|
Future<void> init({required bool monitorPlatformSettings}) async {
|
||||||
await store.init();
|
await store.init();
|
||||||
|
|
|
@ -59,6 +59,7 @@ class CollectionLens with ChangeNotifier {
|
||||||
sectionFactor = settings.collectionSectionFactor,
|
sectionFactor = settings.collectionSectionFactor,
|
||||||
sortFactor = settings.collectionSortFactor,
|
sortFactor = settings.collectionSortFactor,
|
||||||
sortReverse = settings.collectionSortReverse {
|
sortReverse = settings.collectionSortReverse {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
id ??= hashCode;
|
id ??= hashCode;
|
||||||
if (listenToSource) {
|
if (listenToSource) {
|
||||||
final sourceEvents = source.eventBus;
|
final sourceEvents = source.eventBus;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import 'package:aves/model/vaults/details.dart';
|
||||||
import 'package:aves/services/common/services.dart';
|
import 'package:aves/services/common/services.dart';
|
||||||
import 'package:aves_screen_state/aves_screen_state.dart';
|
import 'package:aves_screen_state/aves_screen_state.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -20,7 +21,9 @@ class Vaults extends ChangeNotifier {
|
||||||
|
|
||||||
static const _fileScheme = 'file';
|
static const _fileScheme = 'file';
|
||||||
|
|
||||||
Vaults._private();
|
Vaults._private() {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
_rows = await localMediaDb.loadAllVaults();
|
_rows = await localMediaDb.loadAllVaults();
|
||||||
|
|
|
@ -99,12 +99,10 @@ abstract class ChooserQuickButtonState<T extends ChooserQuickButton<U>, U> exten
|
||||||
}
|
}
|
||||||
|
|
||||||
void _clearChooserOverlayEntry() {
|
void _clearChooserOverlayEntry() {
|
||||||
final overlayEntry = _chooserOverlayEntry;
|
_chooserOverlayEntry
|
||||||
|
?..remove()
|
||||||
|
..dispose();
|
||||||
_chooserOverlayEntry = null;
|
_chooserOverlayEntry = null;
|
||||||
if (overlayEntry != null) {
|
|
||||||
overlayEntry.remove();
|
|
||||||
overlayEntry.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showChooser(LongPressStartDetails details) {
|
void _showChooser(LongPressStartDetails details) {
|
||||||
|
|
|
@ -7,6 +7,8 @@ final _filter = ImageFilter.blur(sigmaX: 4, sigmaY: 4);
|
||||||
// as it yields performance issues when there are other layers on top
|
// as it yields performance issues when there are other layers on top
|
||||||
final _identity = ImageFilter.matrix(Matrix4.identity().storage);
|
final _identity = ImageFilter.matrix(Matrix4.identity().storage);
|
||||||
|
|
||||||
|
// TODO TLAD [impeller] use `BackdropKey`
|
||||||
|
|
||||||
class BlurredRect extends StatelessWidget {
|
class BlurredRect extends StatelessWidget {
|
||||||
final bool enabled;
|
final bool enabled;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
|
@ -196,12 +196,10 @@ class _GridScaleGestureDetectorState<T> extends State<GridScaleGestureDetector<T
|
||||||
_scaledSizeNotifier!.dispose();
|
_scaledSizeNotifier!.dispose();
|
||||||
_scaledSizeNotifier = null;
|
_scaledSizeNotifier = null;
|
||||||
|
|
||||||
final overlayEntry = _overlayEntry;
|
_overlayEntry
|
||||||
|
?..remove()
|
||||||
|
..dispose();
|
||||||
_overlayEntry = null;
|
_overlayEntry = null;
|
||||||
if (overlayEntry != null) {
|
|
||||||
overlayEntry.remove();
|
|
||||||
overlayEntry.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
_applyingScale = true;
|
_applyingScale = true;
|
||||||
final tileExtentController = context.read<TileExtentController>();
|
final tileExtentController = context.read<TileExtentController>();
|
||||||
|
|
|
@ -47,12 +47,10 @@ class _DebugGeneralSectionState extends State<DebugGeneralSection> with Automati
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
value: _taskQueueOverlayEntry != null,
|
value: _taskQueueOverlayEntry != null,
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
final overlayEntry = _taskQueueOverlayEntry;
|
_taskQueueOverlayEntry
|
||||||
|
?..remove()
|
||||||
|
..dispose();
|
||||||
_taskQueueOverlayEntry = null;
|
_taskQueueOverlayEntry = null;
|
||||||
if (overlayEntry != null) {
|
|
||||||
overlayEntry.remove();
|
|
||||||
overlayEntry.dispose();
|
|
||||||
}
|
|
||||||
if (v) {
|
if (v) {
|
||||||
_taskQueueOverlayEntry = OverlayEntry(
|
_taskQueueOverlayEntry = OverlayEntry(
|
||||||
builder: (context) => const DebugTaskQueueOverlay(),
|
builder: (context) => const DebugTaskQueueOverlay(),
|
||||||
|
@ -63,6 +61,20 @@ class _DebugGeneralSectionState extends State<DebugGeneralSection> with Automati
|
||||||
},
|
},
|
||||||
title: const Text('Show tasks overlay'),
|
title: const Text('Show tasks overlay'),
|
||||||
),
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
||||||
|
const config = LeakDiagnosticConfig(
|
||||||
|
collectRetainingPathForNotGCed: true,
|
||||||
|
collectStackTraceOnStart: true,
|
||||||
|
collectStackTraceOnDisposal: true,
|
||||||
|
);
|
||||||
|
LeakTracking.phase = const PhaseSettings(
|
||||||
|
leakDiagnosticConfig: config,
|
||||||
|
);
|
||||||
|
debugPrint('Setup leak tracking phase with config=$config');
|
||||||
|
}),
|
||||||
|
child: const Text('Setup leak tracking phase'),
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
||||||
leaks.byType.forEach((type, reports) {
|
leaks.byType.forEach((type, reports) {
|
||||||
|
|
|
@ -310,12 +310,10 @@ class _EntryPageViewState extends State<EntryPageView> with TickerProviderStateM
|
||||||
onScaleEnd = (details) {
|
onScaleEnd = (details) {
|
||||||
valueNotifier?.dispose();
|
valueNotifier?.dispose();
|
||||||
|
|
||||||
final overlayEntry = _actionFeedbackOverlayEntry;
|
_actionFeedbackOverlayEntry
|
||||||
|
?..remove()
|
||||||
|
..dispose();
|
||||||
_actionFeedbackOverlayEntry = null;
|
_actionFeedbackOverlayEntry = null;
|
||||||
if (overlayEntry != null) {
|
|
||||||
overlayEntry.remove();
|
|
||||||
overlayEntry.dispose();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue