From 411e82807b18a0ff7c05b3d621e8cd98878436ab Mon Sep 17 00:00:00 2001 From: Pete Gregory Date: Tue, 16 Dec 2025 12:47:52 +0000 Subject: [PATCH] attempt to add loco search indicator --- lib/components/pages/loco_timeline.dart | 3 +- lib/components/pages/traction.dart | 109 +++++++++++++----------- 2 files changed, 61 insertions(+), 51 deletions(-) diff --git a/lib/components/pages/loco_timeline.dart b/lib/components/pages/loco_timeline.dart index fe2cd50..84c46ee 100644 --- a/lib/components/pages/loco_timeline.dart +++ b/lib/components/pages/loco_timeline.dart @@ -628,8 +628,7 @@ class _TimelineModel { for (int i = 0; i < boundaries.length - 1; i++) { final start = boundaries[i]; final end = boundaries[i + 1]; - final days = end.difference(start).inDays; - final width = days >= 365 ? yearWidth : yearWidth / 2; + final width = yearWidth; final double offset = axisSegments.isEmpty ? 0.0 : axisSegments.last.offset + axisSegments.last.width; diff --git a/lib/components/pages/traction.dart b/lib/components/pages/traction.dart index fdc2b41..eed012b 100644 --- a/lib/components/pages/traction.dart +++ b/lib/components/pages/traction.dart @@ -423,57 +423,68 @@ class _TractionPageState extends State { ), ), const SizedBox(height: 12), - if (data.isTractionLoading && traction.isEmpty) - const Center( - child: Padding( - padding: EdgeInsets.symmetric(vertical: 24.0), - child: CircularProgressIndicator(), - ), - ) - else if (traction.isEmpty) - Card( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'No traction found', - style: Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w700, - ), - ), - const SizedBox(height: 8), - const Text('Try relaxing the filters or sync again.'), - ], - ), - ), - ) - else - Column( - children: [ - ...traction.map((loco) => _buildTractionCard(context, loco)), - if (data.tractionHasMore || data.isTractionLoading) - Padding( - padding: const EdgeInsets.only(top: 8.0), - child: OutlinedButton.icon( - onPressed: data.isTractionLoading - ? null - : () => _refreshTraction(append: true), - icon: data.isTractionLoading - ? const SizedBox( - height: 14, - width: 14, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.expand_more), - label: Text( - data.isTractionLoading ? 'Loading...' : 'Load more', - ), + Stack( + children: [ + if (data.isTractionLoading && traction.isEmpty) + const Padding( + padding: EdgeInsets.symmetric(vertical: 32.0), + child: Center(child: CircularProgressIndicator()), + ) + else if (traction.isEmpty) + Card( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'No traction found', + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 8), + const Text('Try relaxing the filters or sync again.'), + ], ), ), - ], - ), + ) + else + Column( + children: [ + ...traction.map((loco) => _buildTractionCard(context, loco)), + if (data.tractionHasMore || data.isTractionLoading) + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: OutlinedButton.icon( + onPressed: data.isTractionLoading + ? null + : () => _refreshTraction(append: true), + icon: data.isTractionLoading + ? const SizedBox( + height: 14, + width: 14, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.expand_more), + label: Text( + data.isTractionLoading ? 'Loading...' : 'Load more', + ), + ), + ), + ], + ), + if (data.isTractionLoading) + Positioned.fill( + child: IgnorePointer( + child: Container( + color: Theme.of(context).colorScheme.surface.withOpacity(0.6), + child: const Center(child: CircularProgressIndicator()), + ), + ), + ), + ], + ), ], ), );