minor fixes

This commit is contained in:
Thibault Deckers 2022-04-18 11:08:10 +09:00
parent 2ec0baed09
commit 328a9c818f
2 changed files with 21 additions and 14 deletions

View file

@ -193,7 +193,7 @@ class _ReportOverlayState<T> extends State<ReportOverlay<T>> 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(

View file

@ -129,20 +129,27 @@ class CoveredFilterChip<T extends CollectionFilter> extends StatelessWidget {
);
},
child: entry == null
? FutureBuilder<Color>(
future: filter.color(context),
? StreamBuilder<Set<CollectionFilter>?>(
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<Color>(
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,
],
),
),
);
},
);
},
)