Drop the count badge from the background tasks gear
The caption beside the gear already says how many tasks run.
This commit is contained in:
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
/// Background-task glyph for the composer: an outlined settings gear. While
|
||||
/// [running] is above zero the gear turns slowly and steadily (linear, one
|
||||
/// turn per [turnDuration]) and a small Material [Badge] shows the count.
|
||||
/// With no running task the gear is static and carries no badge. With reduced
|
||||
/// motion the gear never rotates but the badge still shows. Always [size]
|
||||
/// square so the button keeps the same dimensions in every state.
|
||||
/// turn per [turnDuration]). The running count is already written beside it
|
||||
/// ("1 task"), so the gear carries no count of its own. With no running task,
|
||||
/// or with reduced motion, the gear is static. Always [size] square so the
|
||||
/// button keeps the same dimensions in every state.
|
||||
class ChatTaskGear extends StatefulWidget {
|
||||
const ChatTaskGear({super.key, required this.running, this.size = 16});
|
||||
|
||||
@@ -62,25 +62,13 @@ class _ChatTaskGearState extends State<ChatTaskGear>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final running = widget.running;
|
||||
return SizedBox.square(
|
||||
key: const Key('chat-background-tasks-gear'),
|
||||
dimension: widget.size,
|
||||
child: Badge(
|
||||
key: const Key('chat-background-tasks-badge'),
|
||||
isLabelVisible: running > 0,
|
||||
backgroundColor: theme.colorScheme.primary,
|
||||
textColor: theme.colorScheme.onPrimary,
|
||||
label: Text(
|
||||
'$running',
|
||||
key: const Key('chat-background-tasks-count'),
|
||||
),
|
||||
child: RotationTransition(
|
||||
key: const Key('chat-background-tasks-rotation'),
|
||||
turns: _spin,
|
||||
child: Icon(Icons.settings_outlined, size: widget.size),
|
||||
),
|
||||
child: RotationTransition(
|
||||
key: const Key('chat-background-tasks-rotation'),
|
||||
turns: _spin,
|
||||
child: Icon(Icons.settings_outlined, size: widget.size),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user