diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 8919e6a7a..02d219e3d 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -386,6 +386,7 @@ class Message extends StatelessWidget { (eventID) => eventID == event.eventId, ), depressed: !isButton, + enabled: isButton, borderRadius: borderRadius, onPressed: () { showToolbar(pangeaMessageEvent); diff --git a/lib/pangea/widgets/pressable_button.dart b/lib/pangea/widgets/pressable_button.dart index 9a5921e1f..bfdeeb873 100644 --- a/lib/pangea/widgets/pressable_button.dart +++ b/lib/pangea/widgets/pressable_button.dart @@ -45,7 +45,7 @@ class PressableButtonState extends State vsync: this, ); _tweenAnimation = - Tween(begin: widget.buttonHeight, end: 0).animate(_controller); + Tween(begin: 0, end: widget.buttonHeight).animate(_controller); if (widget.enabled) { _triggerAnimationSubscription = widget.triggerAnimation?.listen((_) { _animationCompleter = Completer(); @@ -63,7 +63,7 @@ class PressableButtonState extends State } void _animateUp() { - if (!mounted) return; + if (!widget.enabled || !mounted) return; _controller.forward().then((_) { _animationCompleter?.complete(); _animationCompleter = null; @@ -104,37 +104,32 @@ class PressableButtonState extends State onTapDown: _onTapDown, onTapUp: _onTapUp, onTapCancel: _onTapCancel, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - AnimatedBuilder( - animation: _tweenAnimation, - builder: (context, _) { - return Container( - padding: EdgeInsets.only( - bottom: widget.enabled && !widget.depressed - ? _tweenAnimation.value - : 0, - ), - decoration: BoxDecoration( - color: Color.alphaBlend( - Colors.black.withOpacity(0.25), - widget.color, - ), - borderRadius: widget.borderRadius, - ), - child: widget.child, - ); - }, + child: AnimatedBuilder( + animation: _tweenAnimation, + builder: (context, child) { + return Container( + decoration: BoxDecoration( + color: Color.alphaBlend( + Colors.black.withOpacity(0.25), + widget.color, ), - ], + borderRadius: widget.borderRadius, + ), + padding: EdgeInsets.only( + bottom: widget.enabled && !widget.depressed + ? widget.buttonHeight - _tweenAnimation.value + : 0, + ), + child: child, + ); + }, + child: Container( + decoration: BoxDecoration( + color: widget.color, + borderRadius: widget.borderRadius, ), - ], + child: widget.child, + ), ), ); }