mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 01:29:04 +03:00
feat(mobile): timeline - add persistentBottomBar flag (#25634)
* feat(mobile): timeline - add selectable all-assets control * feature(mobile): introduce bottomWidgetBuilder in Timeline remove redundant code * fix(mobile): remove redundant code * refactor(mobile): refactor new code in Timeline * fix(mobile): fix format * refactor(mobile): replace unsupported Dart syntax for analyzer compatibility * refactor(mobile): remove Timeline.bottomSheet and migrate to bottomWidgetBuilder * refactor(mobile): restore Timeline.bottomSheet and remove bottomWidgetBuilder add withPersistentBottomBar param to Timeline class * refactor(mobile): refactor var name --------- Co-authored-by: Peter Ombodi <peter.ombodi@gmail.com>
This commit is contained in:
@@ -74,6 +74,7 @@ class Timeline extends StatefulWidget {
|
|||||||
this.snapToMonth = true,
|
this.snapToMonth = true,
|
||||||
this.initialScrollOffset,
|
this.initialScrollOffset,
|
||||||
this.readOnly = false,
|
this.readOnly = false,
|
||||||
|
this.persistentBottomBar = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Widget? topSliverWidget;
|
final Widget? topSliverWidget;
|
||||||
@@ -87,6 +88,7 @@ class Timeline extends StatefulWidget {
|
|||||||
final bool snapToMonth;
|
final bool snapToMonth;
|
||||||
final double? initialScrollOffset;
|
final double? initialScrollOffset;
|
||||||
final bool readOnly;
|
final bool readOnly;
|
||||||
|
final bool persistentBottomBar;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<Timeline> createState() => _TimelineState();
|
State<Timeline> createState() => _TimelineState();
|
||||||
@@ -143,6 +145,7 @@ class _TimelineState extends State<Timeline> {
|
|||||||
appBar: widget.appBar,
|
appBar: widget.appBar,
|
||||||
bottomSheet: widget.bottomSheet,
|
bottomSheet: widget.bottomSheet,
|
||||||
withScrubber: widget.withScrubber,
|
withScrubber: widget.withScrubber,
|
||||||
|
persistentBottomBar: widget.persistentBottomBar,
|
||||||
snapToMonth: widget.snapToMonth,
|
snapToMonth: widget.snapToMonth,
|
||||||
initialScrollOffset: widget.initialScrollOffset,
|
initialScrollOffset: widget.initialScrollOffset,
|
||||||
),
|
),
|
||||||
@@ -173,6 +176,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
|
|||||||
this.appBar,
|
this.appBar,
|
||||||
this.bottomSheet,
|
this.bottomSheet,
|
||||||
this.withScrubber = true,
|
this.withScrubber = true,
|
||||||
|
this.persistentBottomBar = false,
|
||||||
this.snapToMonth = true,
|
this.snapToMonth = true,
|
||||||
this.initialScrollOffset,
|
this.initialScrollOffset,
|
||||||
});
|
});
|
||||||
@@ -182,6 +186,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
|
|||||||
final Widget? appBar;
|
final Widget? appBar;
|
||||||
final Widget? bottomSheet;
|
final Widget? bottomSheet;
|
||||||
final bool withScrubber;
|
final bool withScrubber;
|
||||||
|
final bool persistentBottomBar;
|
||||||
final bool snapToMonth;
|
final bool snapToMonth;
|
||||||
final double? initialScrollOffset;
|
final double? initialScrollOffset;
|
||||||
|
|
||||||
@@ -404,6 +409,9 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||||||
final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));
|
final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));
|
||||||
final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));
|
final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));
|
||||||
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
|
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
|
||||||
|
final isMultiSelectStatusVisible = !isSelectionMode && isMultiSelectEnabled;
|
||||||
|
final isBottomWidgetVisible =
|
||||||
|
widget.bottomSheet != null && (isMultiSelectStatusVisible || widget.persistentBottomBar);
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: !isMultiSelectEnabled,
|
canPop: !isMultiSelectEnabled,
|
||||||
@@ -519,7 +527,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
timeline,
|
timeline,
|
||||||
if (!isSelectionMode && isMultiSelectEnabled) ...[
|
if (isMultiSelectStatusVisible)
|
||||||
Positioned(
|
Positioned(
|
||||||
top: MediaQuery.paddingOf(context).top,
|
top: MediaQuery.paddingOf(context).top,
|
||||||
left: 25,
|
left: 25,
|
||||||
@@ -528,8 +536,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
|
|||||||
child: Center(child: _MultiSelectStatusButton()),
|
child: Center(child: _MultiSelectStatusButton()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.bottomSheet != null) widget.bottomSheet!,
|
if (isBottomWidgetVisible) widget.bottomSheet!,
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user