From 247fdd87f00ddfd5990de05d7330ead90f226b6b Mon Sep 17 00:00:00 2001 From: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Date: Sat, 4 Jul 2026 17:15:33 +0530 Subject: [PATCH] fix: blank timeline --- .../widgets/timeline/timeline.widget.dart | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart index bb56473e3b..289920dfe6 100644 --- a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart +++ b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart @@ -85,35 +85,40 @@ class _TimelineState extends State { @override Widget build(BuildContext context) { return LayoutBuilder( - builder: (_, constraints) => ProviderScope( - key: ValueKey(_rebuildTrigger), - overrides: [ - timelineArgsProvider.overrideWith( - (ref) => TimelineArgs( - maxWidth: constraints.maxWidth, - maxHeight: constraints.maxHeight, - columnCount: ref.watch(appConfigProvider.select((config) => config.timeline.tilesPerRow)), - showStorageIndicator: widget.showStorageIndicator, - withStack: widget.withStack, - groupBy: widget.groupBy, + builder: (_, constraints) { + if (constraints.maxWidth <= 0) { + return widget.loadingWidget ?? const SizedBox.shrink(); + } + return ProviderScope( + key: ValueKey(_rebuildTrigger), + overrides: [ + timelineArgsProvider.overrideWith( + (ref) => TimelineArgs( + maxWidth: constraints.maxWidth, + maxHeight: constraints.maxHeight, + columnCount: ref.watch(appConfigProvider.select((config) => config.timeline.tilesPerRow)), + showStorageIndicator: widget.showStorageIndicator, + withStack: widget.withStack, + groupBy: widget.groupBy, + ), ), + if (widget.readOnly) readonlyModeProvider.overrideWith(() => _AlwaysReadOnlyNotifier()), + ], + child: _SliverTimeline( + topSliverWidget: widget.topSliverWidget, + topSliverWidgetHeight: widget.topSliverWidgetHeight, + bottomSliverWidget: widget.bottomSliverWidget, + appBar: widget.appBar, + bottomSheet: widget.bottomSheet, + withScrubber: widget.withScrubber, + persistentBottomBar: widget.persistentBottomBar, + snapToMonth: widget.snapToMonth, + maxWidth: constraints.maxWidth, + loadingWidget: widget.loadingWidget, + onRefresh: widget.onRefresh == null ? null : _handleRefresh, ), - if (widget.readOnly) readonlyModeProvider.overrideWith(() => _AlwaysReadOnlyNotifier()), - ], - child: _SliverTimeline( - topSliverWidget: widget.topSliverWidget, - topSliverWidgetHeight: widget.topSliverWidgetHeight, - bottomSliverWidget: widget.bottomSliverWidget, - appBar: widget.appBar, - bottomSheet: widget.bottomSheet, - withScrubber: widget.withScrubber, - persistentBottomBar: widget.persistentBottomBar, - snapToMonth: widget.snapToMonth, - maxWidth: constraints.maxWidth, - loadingWidget: widget.loadingWidget, - onRefresh: widget.onRefresh == null ? null : _handleRefresh, - ), - ), + ); + }, ); } }