From f1f85e1f05396e21e03ab763bb647f11c1b1335e Mon Sep 17 00:00:00 2001 From: Ricardo Dalarme Date: Sun, 15 Jan 2023 22:57:51 -0300 Subject: [PATCH] refactor: general improvements --- lib/card_swiper.dart | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/card_swiper.dart b/lib/card_swiper.dart index 6843417..b073523 100644 --- a/lib/card_swiper.dart +++ b/lib/card_swiper.dart @@ -191,7 +191,7 @@ class _CardSwiperState extends State Widget build(BuildContext context) { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - return Container( + return Padding( padding: widget.padding, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { @@ -216,7 +216,7 @@ class _CardSwiperState extends State child: GestureDetector( child: Transform.rotate( angle: _angle, - child: Container( + child: ConstrainedBox( constraints: constraints, child: widget.cards[index], ), @@ -263,14 +263,11 @@ class _CardSwiperState extends State child: Positioned( top: _difference, left: 0, - child: Container( - color: Colors.transparent, - child: Transform.scale( - scale: _scale, - child: Container( - constraints: constraints, - child: widget.cards[index], - ), + child: Transform.scale( + scale: _scale, + child: ConstrainedBox( + constraints: constraints, + child: widget.cards[index], ), ), ), @@ -279,7 +276,7 @@ class _CardSwiperState extends State void _calculateAngle() { if (_angle <= _maxAngle && _angle >= -_maxAngle) { - (_tapOnTop == true) + (_tapOnTop) ? _angle = (_maxAngle / 100) * (_left / 10) : _angle = (_maxAngle / 100) * (_left / 10) * -1; }