@@ -497,6 +497,7 @@ class MarkAsReadWidgetState extends State<MarkAsReadWidget> {
497
497
padding: const EdgeInsets .symmetric (horizontal: 10 , vertical: 10 - ((48 - 38 ) / 2 )),
498
498
child: FilledButton .icon (
499
499
style: FilledButton .styleFrom (
500
+ splashFactory: NoSplash .splashFactory,
500
501
minimumSize: const Size .fromHeight (38 ),
501
502
textStyle:
502
503
// Restate [FilledButton]'s default, which inherits from
@@ -522,7 +523,7 @@ class MarkAsReadWidgetState extends State<MarkAsReadWidget> {
522
523
}
523
524
}
524
525
525
- class MarkAsReadAnimation extends StatelessWidget {
526
+ class MarkAsReadAnimation extends StatefulWidget {
526
527
final bool loading;
527
528
final bool hidden;
528
529
final Widget child;
@@ -534,13 +535,34 @@ class MarkAsReadAnimation extends StatelessWidget {
534
535
required this .child
535
536
});
536
537
538
+ @override
539
+ State <MarkAsReadAnimation > createState () => _MarkAsReadAnimationState ();
540
+ }
541
+
542
+ class _MarkAsReadAnimationState extends State <MarkAsReadAnimation > {
543
+ bool _isPressed = false ;
544
+
545
+ void _setScale (bool isPressed) {
546
+ setState (() {
547
+ _isPressed = isPressed;
548
+ });
549
+ }
550
+
537
551
@override
538
552
Widget build (BuildContext context) {
539
- return AnimatedOpacity (
540
- opacity: hidden ? 0 : loading ? 0.5 : 1 ,
541
- duration: const Duration (milliseconds: 500 ),
542
- curve: Curves .easeOut,
543
- child: child);
553
+ return GestureDetector (
554
+ onTapDown: (_) => _setScale (true ),
555
+ onTapUp: (_) => _setScale (false ),
556
+ onTapCancel: () => _setScale (false ),
557
+ child: AnimatedScale (
558
+ scale: _isPressed ? 0.95 : 1 ,
559
+ duration: const Duration (milliseconds: 100 ),
560
+ curve: Curves .easeOut,
561
+ child: AnimatedOpacity (
562
+ opacity: widget.hidden ? 0 : widget.loading ? 0.5 : 1 ,
563
+ duration: const Duration (milliseconds: 500 ),
564
+ curve: Curves .easeOut,
565
+ child: widget.child)));
544
566
}
545
567
}
546
568
0 commit comments