mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-24 16:04:43 +01:00
Fix warnings on Binding.instance
This commit is contained in:
parent
3b537ec76d
commit
17838d0704
20 changed files with 30 additions and 32 deletions
|
@ -38,7 +38,7 @@ class ContentUriImage extends ImageProvider<ContentUriImage>
|
||||||
|
|
||||||
if (bytes.lengthInBytes == 0) {
|
if (bytes.lengthInBytes == 0) {
|
||||||
// The file may become available later.
|
// The file may become available later.
|
||||||
PaintingBinding.instance!.imageCache!.evict(key);
|
PaintingBinding.instance.imageCache.evict(key);
|
||||||
throw StateError("$uri is empty and cannot be loaded as an image.");
|
throw StateError("$uri is empty and cannot be loaded as an image.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ class _AlbumPickerState extends State<AlbumPicker>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,7 +93,7 @@ class _AlbumShareOutlierBrowserState extends State<AlbumShareOutlierBrowser> {
|
||||||
_log.info("[_initBloc] Initialize bloc");
|
_log.info("[_initBloc] Initialize bloc");
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,7 +101,7 @@ class _ArchiveBrowserState extends State<ArchiveBrowser>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -110,7 +110,7 @@ class _EnhancedPhotoBrowserState extends State<EnhancedPhotoBrowser>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -104,7 +104,7 @@ class _FavoriteBrowserState extends State<FavoriteBrowser>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,7 @@ class _HomeAlbumsState extends State<HomeAlbums>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -127,7 +127,7 @@ class _HomePhotosState extends State<HomePhotos>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,7 +53,7 @@ class _LocalImageViewerState extends State<LocalImageViewer> {
|
||||||
image: provider,
|
image: provider,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_onItemLoaded();
|
_onItemLoaded();
|
||||||
});
|
});
|
||||||
return child;
|
return child;
|
||||||
|
@ -126,7 +126,7 @@ class _RemoteImageViewerState extends State<RemoteImageViewer> {
|
||||||
filterQuality: FilterQuality.high,
|
filterQuality: FilterQuality.high,
|
||||||
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
||||||
imageBuilder: (context, child, imageProvider) {
|
imageBuilder: (context, child, imageProvider) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_onItemLoaded();
|
_onItemLoaded();
|
||||||
});
|
});
|
||||||
SizeChangedLayoutNotification().dispatch(context);
|
SizeChangedLayoutNotification().dispatch(context);
|
||||||
|
@ -185,7 +185,7 @@ class _ImageViewerState extends State<_ImageViewer>
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: NotificationListener<SizeChangedLayoutNotification>(
|
child: NotificationListener<SizeChangedLayoutNotification>(
|
||||||
onNotification: (_) {
|
onNotification: (_) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (_key.currentContext != null) {
|
if (_key.currentContext != null) {
|
||||||
widget.onHeightChanged?.call(_key.currentContext!.size!.height);
|
widget.onHeightChanged?.call(_key.currentContext!.size!.height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,21 +37,21 @@ class _MeasurableItemListState extends State<MeasurableItemList>
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_prevOrientation = MediaQuery.of(context).orientation;
|
_prevOrientation = MediaQuery.of(context).orientation;
|
||||||
WidgetsBinding.instance!.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
dispose() {
|
dispose() {
|
||||||
WidgetsBinding.instance!.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
didChangeMetrics() {
|
didChangeMetrics() {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final orientation = MediaQuery.of(context).orientation;
|
final orientation = MediaQuery.of(context).orientation;
|
||||||
if (orientation != _prevOrientation) {
|
if (orientation != _prevOrientation) {
|
||||||
_log.info(
|
_log.info(
|
||||||
|
@ -70,8 +70,7 @@ class _MeasurableItemListState extends State<MeasurableItemList>
|
||||||
_prevListWidth ??= constraints.crossAxisExtent;
|
_prevListWidth ??= constraints.crossAxisExtent;
|
||||||
if (constraints.crossAxisExtent != _prevListWidth) {
|
if (constraints.crossAxisExtent != _prevListWidth) {
|
||||||
_log.info("[build] updateListHeight: list viewport width changed");
|
_log.info("[build] updateListHeight: list viewport width changed");
|
||||||
WidgetsBinding.instance!
|
WidgetsBinding.instance.addPostFrameCallback((_) => updateListHeight());
|
||||||
.addPostFrameCallback((_) => updateListHeight());
|
|
||||||
_prevListWidth = constraints.crossAxisExtent;
|
_prevListWidth = constraints.crossAxisExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +79,7 @@ class _MeasurableItemListState extends State<MeasurableItemList>
|
||||||
_prevCellSize ??= cellSize;
|
_prevCellSize ??= cellSize;
|
||||||
if (cellSize != _prevCellSize) {
|
if (cellSize != _prevCellSize) {
|
||||||
_log.info("[build] updateListHeight: cell size changed");
|
_log.info("[build] updateListHeight: cell size changed");
|
||||||
WidgetsBinding.instance!
|
WidgetsBinding.instance.addPostFrameCallback((_) => updateListHeight());
|
||||||
.addPostFrameCallback((_) => updateListHeight());
|
|
||||||
_prevCellSize = cellSize;
|
_prevCellSize = cellSize;
|
||||||
}
|
}
|
||||||
_gridKey = _GridKey("$_uniqueToken $cellSize");
|
_gridKey = _GridKey("$_uniqueToken $cellSize");
|
||||||
|
|
|
@ -33,7 +33,7 @@ class _MeasureSizeRenderObject extends RenderProxyBox {
|
||||||
if (newSize == null || oldSize == newSize) return;
|
if (newSize == null || oldSize == newSize) return;
|
||||||
|
|
||||||
oldSize = newSize;
|
oldSize = newSize;
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
onChange(newSize);
|
onChange(newSize);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class _SliverMeasureExtentRenderObject extends RenderProxySliver {
|
||||||
}
|
}
|
||||||
|
|
||||||
_oldExtent = newExent;
|
_oldExtent = newExent;
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) => onChange(newExent));
|
WidgetsBinding.instance.addPostFrameCallback((_) => onChange(newExent));
|
||||||
}
|
}
|
||||||
|
|
||||||
final void Function(double) onChange;
|
final void Function(double) onChange;
|
||||||
|
|
|
@ -81,7 +81,7 @@ class _PeopleBrowserState extends State<PeopleBrowser> {
|
||||||
_log.info("[_initBloc] Initialize bloc");
|
_log.info("[_initBloc] Initialize bloc");
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -186,7 +186,7 @@ class _RootPickerState extends State<RootPicker> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_isInitDialogShown = true;
|
_isInitDialogShown = true;
|
||||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
showDialog(
|
showDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -130,7 +130,7 @@ mixin SelectableItemStreamListMixin<T extends StatefulWidget> on State<T> {
|
||||||
_lastSelectPosition = newLastSelectPosition;
|
_lastSelectPosition = newLastSelectPosition;
|
||||||
|
|
||||||
_log.info("[itemStreamListItems] updateListHeight: list item changed");
|
_log.info("[itemStreamListItems] updateListHeight: list item changed");
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) =>
|
WidgetsBinding.instance.addPostFrameCallback((_) =>
|
||||||
(_listKey.currentState as MeasurableItemListState?)
|
(_listKey.currentState as MeasurableItemListState?)
|
||||||
?.updateListHeight());
|
?.updateListHeight());
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
||||||
|
|
||||||
Future<void> _initBloc() async {
|
Future<void> _initBloc() async {
|
||||||
if (_shareeBloc.state is ListShareeBlocSuccess) {
|
if (_shareeBloc.state is ListShareeBlocSuccess) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onShareeStateChange(context, _shareeBloc.state);
|
_onShareeStateChange(context, _shareeBloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -100,7 +100,7 @@ class _SharingBrowserState extends State<SharingBrowser> {
|
||||||
_log.info("[_initBloc] Initialize bloc");
|
_log.info("[_initBloc] Initialize bloc");
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,7 @@ class _SplashState extends State<Splash> {
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_doWork();
|
_doWork();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class _TrashbinBrowserState extends State<TrashbinBrowser>
|
||||||
_reqQuery();
|
_reqQuery();
|
||||||
} else {
|
} else {
|
||||||
// process the current state
|
// process the current state
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onStateChange(context, _bloc.state);
|
_onStateChange(context, _bloc.state);
|
||||||
});
|
});
|
||||||
|
|
|
@ -103,7 +103,7 @@ class _VideoViewerState extends State<VideoViewer>
|
||||||
);
|
);
|
||||||
await _controller.initialize();
|
await _controller.initialize();
|
||||||
widget.onLoaded?.call();
|
widget.onLoaded?.call();
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (_key.currentContext != null) {
|
if (_key.currentContext != null) {
|
||||||
widget.onHeightChanged?.call(_key.currentContext!.size!.height);
|
widget.onHeightChanged?.call(_key.currentContext!.size!.height);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ class _VideoViewerState extends State<VideoViewer>
|
||||||
|
|
||||||
Widget _buildPlayer(BuildContext context) {
|
Widget _buildPlayer(BuildContext context) {
|
||||||
if (_controller.value.isPlaying && !widget.canPlay) {
|
if (_controller.value.isPlaying && !widget.canPlay) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_pause();
|
_pause();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,7 +475,7 @@ class _ViewerState extends State<Viewer>
|
||||||
/// Called when the page is being built after previously moved out of view
|
/// Called when the page is being built after previously moved out of view
|
||||||
void _onRecreatePageAfterMovedOut(BuildContext context, int index) {
|
void _onRecreatePageAfterMovedOut(BuildContext context, int index) {
|
||||||
if (_isShowDetailPane && !_isClosingDetailPane) {
|
if (_isShowDetailPane && !_isClosingDetailPane) {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (_pageStates[index]!.itemHeight != null) {
|
if (_pageStates[index]!.itemHeight != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_openDetailPane(index);
|
_openDetailPane(index);
|
||||||
|
@ -483,7 +483,7 @@ class _ViewerState extends State<Viewer>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_pageStates[index]!.scrollController.jumpTo(0);
|
_pageStates[index]!.scrollController.jumpTo(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue