refactor: general improvements
This commit is contained in:
parent
bc14c3f747
commit
f1f85e1f05
|
|
@ -191,7 +191,7 @@ class _CardSwiperState extends State<CardSwiper>
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: widget.padding,
|
padding: widget.padding,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
|
|
@ -216,7 +216,7 @@ class _CardSwiperState extends State<CardSwiper>
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Transform.rotate(
|
child: Transform.rotate(
|
||||||
angle: _angle,
|
angle: _angle,
|
||||||
child: Container(
|
child: ConstrainedBox(
|
||||||
constraints: constraints,
|
constraints: constraints,
|
||||||
child: widget.cards[index],
|
child: widget.cards[index],
|
||||||
),
|
),
|
||||||
|
|
@ -263,14 +263,11 @@ class _CardSwiperState extends State<CardSwiper>
|
||||||
child: Positioned(
|
child: Positioned(
|
||||||
top: _difference,
|
top: _difference,
|
||||||
left: 0,
|
left: 0,
|
||||||
child: Container(
|
child: Transform.scale(
|
||||||
color: Colors.transparent,
|
scale: _scale,
|
||||||
child: Transform.scale(
|
child: ConstrainedBox(
|
||||||
scale: _scale,
|
constraints: constraints,
|
||||||
child: Container(
|
child: widget.cards[index],
|
||||||
constraints: constraints,
|
|
||||||
child: widget.cards[index],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -279,7 +276,7 @@ class _CardSwiperState extends State<CardSwiper>
|
||||||
|
|
||||||
void _calculateAngle() {
|
void _calculateAngle() {
|
||||||
if (_angle <= _maxAngle && _angle >= -_maxAngle) {
|
if (_angle <= _maxAngle && _angle >= -_maxAngle) {
|
||||||
(_tapOnTop == true)
|
(_tapOnTop)
|
||||||
? _angle = (_maxAngle / 100) * (_left / 10)
|
? _angle = (_maxAngle / 100) * (_left / 10)
|
||||||
: _angle = (_maxAngle / 100) * (_left / 10) * -1;
|
: _angle = (_maxAngle / 100) * (_left / 10) * -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue