Skip to content

Commit 82c6302

Browse files
PeterOmbodiPeter Ombodi
andauthored
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>
1 parent aae64b5 commit 82c6302

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mobile/lib/presentation/widgets/timeline/timeline.widget.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Timeline extends StatefulWidget {
7474
this.snapToMonth = true,
7575
this.initialScrollOffset,
7676
this.readOnly = false,
77+
this.persistentBottomBar = false,
7778
});
7879

7980
final Widget? topSliverWidget;
@@ -87,6 +88,7 @@ class Timeline extends StatefulWidget {
8788
final bool snapToMonth;
8889
final double? initialScrollOffset;
8990
final bool readOnly;
91+
final bool persistentBottomBar;
9092

9193
@override
9294
State<Timeline> createState() => _TimelineState();
@@ -143,6 +145,7 @@ class _TimelineState extends State<Timeline> {
143145
appBar: widget.appBar,
144146
bottomSheet: widget.bottomSheet,
145147
withScrubber: widget.withScrubber,
148+
persistentBottomBar: widget.persistentBottomBar,
146149
snapToMonth: widget.snapToMonth,
147150
initialScrollOffset: widget.initialScrollOffset,
148151
),
@@ -173,6 +176,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
173176
this.appBar,
174177
this.bottomSheet,
175178
this.withScrubber = true,
179+
this.persistentBottomBar = false,
176180
this.snapToMonth = true,
177181
this.initialScrollOffset,
178182
});
@@ -182,6 +186,7 @@ class _SliverTimeline extends ConsumerStatefulWidget {
182186
final Widget? appBar;
183187
final Widget? bottomSheet;
184188
final bool withScrubber;
189+
final bool persistentBottomBar;
185190
final bool snapToMonth;
186191
final double? initialScrollOffset;
187192

@@ -404,6 +409,9 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
404409
final isSelectionMode = ref.watch(multiSelectProvider.select((s) => s.forceEnable));
405410
final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));
406411
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
412+
final isMultiSelectStatusVisible = !isSelectionMode && isMultiSelectEnabled;
413+
final isBottomWidgetVisible =
414+
widget.bottomSheet != null && (isMultiSelectStatusVisible || widget.persistentBottomBar);
407415

408416
return PopScope(
409417
canPop: !isMultiSelectEnabled,
@@ -519,7 +527,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
519527
child: Stack(
520528
children: [
521529
timeline,
522-
if (!isSelectionMode && isMultiSelectEnabled) ...[
530+
if (isMultiSelectStatusVisible)
523531
Positioned(
524532
top: MediaQuery.paddingOf(context).top,
525533
left: 25,
@@ -528,8 +536,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {
528536
child: Center(child: _MultiSelectStatusButton()),
529537
),
530538
),
531-
if (widget.bottomSheet != null) widget.bottomSheet!,
532-
],
539+
if (isBottomWidgetVisible) widget.bottomSheet!,
533540
],
534541
),
535542
),

0 commit comments

Comments
 (0)