From 328a9c818ff974c66db0a737f6109ec1ddd1eb84 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Mon, 18 Apr 2022 11:08:10 +0900 Subject: [PATCH] minor fixes --- .../common/action_mixins/feedback.dart | 2 +- .../common/covered_filter_chip.dart | 33 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/widgets/common/action_mixins/feedback.dart b/lib/widgets/common/action_mixins/feedback.dart index 8ac7c3587..966096f1e 100644 --- a/lib/widgets/common/action_mixins/feedback.dart +++ b/lib/widgets/common/action_mixins/feedback.dart @@ -193,7 +193,7 @@ class _ReportOverlayState extends State> with SingleTickerPr builder: (context, snapshot) { final processedCount = processed.length.toDouble(); final total = widget.itemCount; - final percent = min(1.0, processedCount / total); + final percent = total != 0 ? min(1.0, processedCount / total) : 1.0; return FadeTransition( opacity: _animation, child: Stack( diff --git a/lib/widgets/filter_grids/common/covered_filter_chip.dart b/lib/widgets/filter_grids/common/covered_filter_chip.dart index 42aae6ea3..c1b161dd0 100644 --- a/lib/widgets/filter_grids/common/covered_filter_chip.dart +++ b/lib/widgets/filter_grids/common/covered_filter_chip.dart @@ -129,20 +129,27 @@ class CoveredFilterChip extends StatelessWidget { ); }, child: entry == null - ? FutureBuilder( - future: filter.color(context), + ? StreamBuilder?>( + stream: covers.colorChangeStream.where((event) => event == null || event.contains(filter)), builder: (context, snapshot) { - return Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - Colors.white, - snapshot.data ?? Colors.white, - ], - ), - ), + return FutureBuilder( + future: filter.color(context), + builder: (context, snapshot) { + final color = snapshot.data; + const neutral = Colors.white; + return Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + neutral, + color ?? neutral, + ], + ), + ), + ); + }, ); }, )