chore(mobile): Flutter 3.24 (#11633)

* chore(mobile): Flutter 3.24

* fix lint

* fix rendering issues that lead to log get filled with error messages

* linting

* merge main

* fix isar prod build Android

* fix mismatch icon offset
This commit is contained in:
Alex
2024-08-15 14:53:37 -05:00
committed by GitHub
parent 00023e387f
commit ed6971222c
15 changed files with 86 additions and 66 deletions

View File

@@ -39,7 +39,6 @@ import 'package:path_provider/path_provider.dart';
void main() async {
ImmichWidgetsBinding();
final db = await loadDb();
await initApp();
await migrateDatabaseIfNeeded(db);
@@ -73,6 +72,7 @@ Future<void> initApp() async {
var log = Logger("ImmichErrorLogger");
FlutterError.onError = (details) {
debugPrint("FlutterError - Catch all: $details");
FlutterError.presentError(details);
log.severe(
'FlutterError - Catch all',

View File

@@ -264,7 +264,7 @@ class GalleryViewerPage extends HookConsumerWidget {
return PopScope(
// Change immersive mode back to normal "edgeToEdge" mode
onPopInvoked: (_) =>
onPopInvokedWithResult: (didPop, _) =>
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge),
child: Scaffold(
backgroundColor: Colors.black,

View File

@@ -74,7 +74,7 @@ class HeaderSettingsPage extends HookConsumerWidget {
],
),
body: PopScope(
onPopInvoked: (_) => saveHeaders(headers.value),
onPopInvokedWithResult: (didPop, _) => saveHeaders(headers.value),
child: ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
itemCount: list.length,

View File

@@ -177,7 +177,7 @@ class TabControllerPage extends HookConsumerWidget {
final tabsRouter = AutoTabsRouter.of(context);
return PopScope(
canPop: tabsRouter.activeIndex == 0,
onPopInvoked: (didPop) =>
onPopInvokedWithResult: (didPop, _) =>
!didPop ? tabsRouter.setActiveIndex(0) : null,
child: LayoutBuilder(
builder: (context, constraints) {

View File

@@ -123,7 +123,7 @@ class VideoViewerPage extends HookConsumerWidget {
final size = MediaQuery.sizeOf(context);
return PopScope(
onPopInvoked: (pop) {
onPopInvokedWithResult: (didPop, _) {
ref.read(videoPlaybackValueProvider.notifier).value =
VideoPlaybackValue.uninitialized();
},

View File

@@ -59,6 +59,8 @@ class DraggableScrollbar extends StatefulWidget {
final Function(bool scrolling) scrollStateListener;
final double viewPortHeight;
DraggableScrollbar.semicircle({
super.key,
Key? scrollThumbKey,
@@ -67,6 +69,7 @@ class DraggableScrollbar extends StatefulWidget {
required this.controller,
required this.itemPositionsListener,
required this.scrollStateListener,
required this.viewPortHeight,
this.heightScrollThumb = 48.0,
this.backgroundColor = Colors.white,
this.padding,
@@ -251,7 +254,7 @@ class DraggableScrollbarState extends State<DraggableScrollbar>
}
double get barMaxScrollExtent =>
(context.size?.height ?? 0) -
widget.viewPortHeight -
widget.heightScrollThumb -
(widget.heightOffset ?? 0);
@@ -316,37 +319,39 @@ class DraggableScrollbarState extends State<DraggableScrollbar>
}
setState(() {
int firstItemIndex =
widget.itemPositionsListener.itemPositions.value.first.index;
try {
int firstItemIndex =
widget.itemPositionsListener.itemPositions.value.first.index;
if (notification is ScrollUpdateNotification) {
_barOffset = (firstItemIndex / maxItemCount) * barMaxScrollExtent;
if (notification is ScrollUpdateNotification) {
_barOffset = (firstItemIndex / maxItemCount) * barMaxScrollExtent;
if (_barOffset < barMinScrollExtent) {
_barOffset = barMinScrollExtent;
}
if (_barOffset > barMaxScrollExtent) {
_barOffset = barMaxScrollExtent;
}
}
if (notification is ScrollUpdateNotification ||
notification is OverscrollNotification) {
if (_thumbAnimationController.status != AnimationStatus.forward) {
_thumbAnimationController.forward();
if (_barOffset < barMinScrollExtent) {
_barOffset = barMinScrollExtent;
}
if (_barOffset > barMaxScrollExtent) {
_barOffset = barMaxScrollExtent;
}
}
if (itemPos < maxItemCount) {
_currentItem = itemPos;
}
if (notification is ScrollUpdateNotification ||
notification is OverscrollNotification) {
if (_thumbAnimationController.status != AnimationStatus.forward) {
_thumbAnimationController.forward();
}
_fadeoutTimer?.cancel();
_fadeoutTimer = Timer(widget.scrollbarTimeToFade, () {
_thumbAnimationController.reverse();
_labelAnimationController.reverse();
_fadeoutTimer = null;
});
}
if (itemPos < maxItemCount) {
_currentItem = itemPos;
}
_fadeoutTimer?.cancel();
_fadeoutTimer = Timer(widget.scrollbarTimeToFade, () {
_thumbAnimationController.reverse();
_labelAnimationController.reverse();
_fadeoutTimer = null;
});
}
} catch (_) {}
});
}

View File

@@ -262,8 +262,9 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
shrinkWrap: widget.shrinkWrap,
);
final child = useDragScrolling
final child = (useDragScrolling && ModalRoute.of(context) != null)
? DraggableScrollbar.semicircle(
viewPortHeight: context.height,
scrollStateListener: dragScrolling,
itemPositionsListener: _itemPositionsListener,
controller: _itemScrollController,
@@ -281,6 +282,7 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
child: listWidget,
)
: listWidget;
return widget.onRefresh == null
? child
: appBarOffset()
@@ -528,7 +530,7 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
Widget build(BuildContext context) {
return PopScope(
canPop: !(widget.selectionActive && _selectedAssets.isNotEmpty),
onPopInvoked: (didPop) => !didPop ? _deselectAll() : null,
onPopInvokedWithResult: (didPop, _) => !didPop ? _deselectAll() : null,
child: Stack(
children: [
AssetDragRegion(

View File

@@ -58,7 +58,7 @@ class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
isLabelVisible: serverInfoState.isVersionMismatch ||
((user?.isAdmin ?? false) &&
serverInfoState.isNewReleaseAvailable),
offset: const Offset(2, 2),
offset: const Offset(-2, -12),
child: user == null
? const Icon(
Icons.face_outlined,
@@ -132,7 +132,7 @@ class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
backgroundColor: Colors.transparent,
alignment: Alignment.bottomRight,
isLabelVisible: indicatorIcon != null,
offset: const Offset(2, 2),
offset: const Offset(-2, -12),
child: Icon(
Icons.backup_rounded,
size: widgetSize,