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 {
|
||||
Set<FavouriteRow> _rows = {};
|
||||
|
||||
Favourites._private();
|
||||
Favourites._private() {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
}
|
||||
|
||||
Future<void> init() async {
|
||||
_rows = await localMediaDb.loadAllFavourites();
|
||||
|
|
|
@ -5,6 +5,10 @@ import 'package:flutter/painting.dart';
|
|||
class HighlightInfo extends ChangeNotifier {
|
||||
final EventBus eventBus = EventBus();
|
||||
|
||||
HighlightInfo() {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
}
|
||||
|
||||
void trackItem<T>(
|
||||
T? item, {
|
||||
TrackPredicate? predicate,
|
||||
|
|
|
@ -9,6 +9,7 @@ class Query extends ChangeNotifier {
|
|||
final StreamController<bool> _enabledStreamController = StreamController.broadcast();
|
||||
|
||||
Query({required bool enabled, required String? initialValue}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
_enabled = enabled;
|
||||
if (initialValue != null && initialValue.isNotEmpty) {
|
||||
_enabled = true;
|
||||
|
|
|
@ -9,6 +9,10 @@ class Selection<T> extends ChangeNotifier {
|
|||
|
||||
Set<T> get selectedItems => _selectedItems;
|
||||
|
||||
Selection() {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
}
|
||||
|
||||
void browse() {
|
||||
if (!_isSelecting) return;
|
||||
_isSelecting = false;
|
||||
|
|
|
@ -33,8 +33,8 @@ import 'package:aves_utils/aves_utils.dart';
|
|||
import 'package:aves_video/aves_video.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
final Settings settings = Settings._private();
|
||||
|
@ -56,7 +56,9 @@ class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings
|
|||
@override
|
||||
SettingsStore get store => settingsStore;
|
||||
|
||||
Settings._private();
|
||||
Settings._private() {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
}
|
||||
|
||||
Future<void> init({required bool monitorPlatformSettings}) async {
|
||||
await store.init();
|
||||
|
|
|
@ -59,6 +59,7 @@ class CollectionLens with ChangeNotifier {
|
|||
sectionFactor = settings.collectionSectionFactor,
|
||||
sortFactor = settings.collectionSortFactor,
|
||||
sortReverse = settings.collectionSortReverse {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
id ??= hashCode;
|
||||
if (listenToSource) {
|
||||
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_screen_state/aves_screen_state.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -20,7 +21,9 @@ class Vaults extends ChangeNotifier {
|
|||
|
||||
static const _fileScheme = 'file';
|
||||
|
||||
Vaults._private();
|
||||
Vaults._private() {
|
||||
if (kFlutterMemoryAllocationsEnabled) ChangeNotifier.maybeDispatchObjectCreation(this);
|
||||
}
|
||||
|
||||
Future<void> init() async {
|
||||
_rows = await localMediaDb.loadAllVaults();
|
||||
|
|
|
@ -99,12 +99,10 @@ abstract class ChooserQuickButtonState<T extends ChooserQuickButton<U>, U> exten
|
|||
}
|
||||
|
||||
void _clearChooserOverlayEntry() {
|
||||
final overlayEntry = _chooserOverlayEntry;
|
||||
_chooserOverlayEntry
|
||||
?..remove()
|
||||
..dispose();
|
||||
_chooserOverlayEntry = null;
|
||||
if (overlayEntry != null) {
|
||||
overlayEntry.remove();
|
||||
overlayEntry.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
final _identity = ImageFilter.matrix(Matrix4.identity().storage);
|
||||
|
||||
// TODO TLAD [impeller] use `BackdropKey`
|
||||
|
||||
class BlurredRect extends StatelessWidget {
|
||||
final bool enabled;
|
||||
final Widget child;
|
||||
|
|
|
@ -196,12 +196,10 @@ class _GridScaleGestureDetectorState<T> extends State<GridScaleGestureDetector<T
|
|||
_scaledSizeNotifier!.dispose();
|
||||
_scaledSizeNotifier = null;
|
||||
|
||||
final overlayEntry = _overlayEntry;
|
||||
_overlayEntry
|
||||
?..remove()
|
||||
..dispose();
|
||||
_overlayEntry = null;
|
||||
if (overlayEntry != null) {
|
||||
overlayEntry.remove();
|
||||
overlayEntry.dispose();
|
||||
}
|
||||
|
||||
_applyingScale = true;
|
||||
final tileExtentController = context.read<TileExtentController>();
|
||||
|
|
|
@ -47,12 +47,10 @@ class _DebugGeneralSectionState extends State<DebugGeneralSection> with Automati
|
|||
SwitchListTile(
|
||||
value: _taskQueueOverlayEntry != null,
|
||||
onChanged: (v) {
|
||||
final overlayEntry = _taskQueueOverlayEntry;
|
||||
_taskQueueOverlayEntry
|
||||
?..remove()
|
||||
..dispose();
|
||||
_taskQueueOverlayEntry = null;
|
||||
if (overlayEntry != null) {
|
||||
overlayEntry.remove();
|
||||
overlayEntry.dispose();
|
||||
}
|
||||
if (v) {
|
||||
_taskQueueOverlayEntry = OverlayEntry(
|
||||
builder: (context) => const DebugTaskQueueOverlay(),
|
||||
|
@ -63,6 +61,20 @@ class _DebugGeneralSectionState extends State<DebugGeneralSection> with Automati
|
|||
},
|
||||
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(
|
||||
onPressed: () => LeakTracking.collectLeaks().then((leaks) {
|
||||
leaks.byType.forEach((type, reports) {
|
||||
|
|
|
@ -310,12 +310,10 @@ class _EntryPageViewState extends State<EntryPageView> with TickerProviderStateM
|
|||
onScaleEnd = (details) {
|
||||
valueNotifier?.dispose();
|
||||
|
||||
final overlayEntry = _actionFeedbackOverlayEntry;
|
||||
_actionFeedbackOverlayEntry
|
||||
?..remove()
|
||||
..dispose();
|
||||
_actionFeedbackOverlayEntry = null;
|
||||
if (overlayEntry != null) {
|
||||
overlayEntry.remove();
|
||||
overlayEntry.dispose();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue