mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
fix bottom sheet
This commit is contained in:
parent
e416c971e7
commit
41506a00bf
@ -78,25 +78,21 @@ class _BaseDraggableScrollableSheetState extends ConsumerState<BaseBottomSheet>
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
const SliverPersistentHeader(delegate: _DragHandleDelegate(), pinned: true),
|
||||||
child: Column(
|
if (widget.actions.isNotEmpty)
|
||||||
children: [
|
SliverToBoxAdapter(
|
||||||
const SizedBox(height: 10),
|
child: Column(
|
||||||
const _DragHandle(),
|
children: [
|
||||||
const SizedBox(height: 14),
|
|
||||||
if (widget.actions.isNotEmpty)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 115,
|
height: 115,
|
||||||
child: ListView(shrinkWrap: true, scrollDirection: Axis.horizontal, children: widget.actions),
|
child: ListView(shrinkWrap: true, scrollDirection: Axis.horizontal, children: widget.actions),
|
||||||
),
|
),
|
||||||
if (widget.actions.isNotEmpty) ...[
|
|
||||||
const Divider(indent: 16, endIndent: 16),
|
const Divider(indent: 16, endIndent: 16),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
if (widget.slivers != null) ...widget.slivers!,
|
||||||
...(widget.slivers ?? []),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -105,17 +101,42 @@ class _BaseDraggableScrollableSheetState extends ConsumerState<BaseBottomSheet>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _DragHandleDelegate extends SliverPersistentHeaderDelegate {
|
||||||
|
const _DragHandleDelegate();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||||
|
return const _DragHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRebuild(_DragHandleDelegate oldDelegate) => false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
double get minExtent => 50.0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
double get maxExtent => 50.0;
|
||||||
|
}
|
||||||
|
|
||||||
class _DragHandle extends StatelessWidget {
|
class _DragHandle extends StatelessWidget {
|
||||||
const _DragHandle();
|
const _DragHandle();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
height: 6,
|
height: 50,
|
||||||
width: 32,
|
child: Center(
|
||||||
decoration: BoxDecoration(
|
child: SizedBox(
|
||||||
color: context.themeData.dividerColor.lighten(amount: 0.6),
|
width: 32,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
height: 6,
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||||
|
color: context.themeData.dividerColor.lighten(amount: 0.6),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';
|
import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
|
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
|
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
|
||||||
@ -16,9 +17,13 @@ class MapBottomSheet extends ConsumerWidget {
|
|||||||
return BaseBottomSheet(
|
return BaseBottomSheet(
|
||||||
initialChildSize: 0.25,
|
initialChildSize: 0.25,
|
||||||
shouldCloseOnMinExtent: false,
|
shouldCloseOnMinExtent: false,
|
||||||
|
resizeOnScroll: false,
|
||||||
actions: const [],
|
actions: const [],
|
||||||
|
backgroundColor: context.themeData.colorScheme.surface,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
|
hasScrollBody: false,
|
||||||
|
// TODO: rebuilding the entire timeline from scratch on bounds change is very inefficient
|
||||||
child: ProviderScope(
|
child: ProviderScope(
|
||||||
key: ObjectKey(bounds),
|
key: ObjectKey(bounds),
|
||||||
overrides: [
|
overrides: [
|
||||||
@ -28,7 +33,7 @@ class MapBottomSheet extends ConsumerWidget {
|
|||||||
return timelineService;
|
return timelineService;
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
child: const Timeline(),
|
child: const Timeline(appBar: null, bottomSheet: null),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user