From f771b515ccbb6c47f0c5f8eda53fb441cbf09208 Mon Sep 17 00:00:00 2001 From: Bo Lopker Date: Sun, 3 Nov 2024 13:33:38 +0700 Subject: [PATCH] Pulse compression --- lib/log.dart | 2 +- lib/table.dart | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/log.dart b/lib/log.dart index dea991a..23d7fae 100644 --- a/lib/log.dart +++ b/lib/log.dart @@ -1,3 +1,3 @@ import 'package:logger/logger.dart'; -final log = Logger(); +final log = Logger(printer: SimplePrinter()); diff --git a/lib/table.dart b/lib/table.dart index 8de337a..8df97d7 100644 --- a/lib/table.dart +++ b/lib/table.dart @@ -18,10 +18,12 @@ class _FilesTableState extends State with SignalsMixin { int? _currentSortColumn; bool _isSortAsc = true; List rows = []; + ColorTween compressIconTween = + ColorTween(begin: Colors.blue, end: Colors.amber); @override void initState() { - log.d('initState'); + log.d('FilesTable initState'); super.initState(); createEffect(() { setState(() { @@ -51,12 +53,25 @@ class _FilesTableState extends State with SignalsMixin { child: Icon(Icons.pending, color: theme.disabledColor), ), ), - _ => Tooltip( + ImageFileStatus.compressing => Tooltip( message: file.status.value, child: SizedBox( height: 20, width: 20, - child: Icon(Icons.compress, color: theme.hintColor), + child: TweenAnimationBuilder( + tween: compressIconTween, + duration: const Duration(seconds: 1), + onEnd: () { + setState(() { + compressIconTween = ColorTween( + begin: compressIconTween.end, + end: compressIconTween.begin, + ); + }); // Trigger rebuild to restart animation + }, + builder: (context, color, child) => + Icon(Icons.compress, color: color), + ), ), ), };