Skip to content

Commit 2b70533

Browse files
committed
Remove drop shadow from card
1 parent 302c1b9 commit 2b70533

File tree

1 file changed

+8
-37
lines changed

1 file changed

+8
-37
lines changed

veggieseasons/lib/widgets/veggie_card.dart

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ import '../styles.dart';
1010

1111
/// A Card-like Widget that responds to tap events by animating changes to its
1212
/// elevation and invoking an optional [onPressed] callback.
13-
class PressableCard extends StatefulWidget {
13+
class PressableCard extends StatelessWidget {
1414
const PressableCard({
1515
required this.child,
1616
this.borderRadius = const BorderRadius.all(Radius.circular(16)),
17-
this.upElevation = 2,
18-
this.downElevation = 0,
19-
this.shadowColor = CupertinoColors.black,
20-
this.duration = const Duration(milliseconds: 100),
2117
this.onPressed,
2218
super.key,
2319
});
@@ -28,42 +24,17 @@ class PressableCard extends StatefulWidget {
2824

2925
final BorderRadius borderRadius;
3026

31-
final double upElevation;
32-
33-
final double downElevation;
34-
35-
final Color shadowColor;
36-
37-
final Duration duration;
38-
39-
@override
40-
State<PressableCard> createState() => _PressableCardState();
41-
}
42-
43-
class _PressableCardState extends State<PressableCard> {
44-
bool cardIsDown = false;
45-
4627
@override
4728
Widget build(BuildContext context) {
4829
return GestureDetector(
49-
onTap: () {
50-
setState(() => cardIsDown = false);
51-
if (widget.onPressed != null) {
52-
widget.onPressed!();
53-
}
54-
},
55-
onTapDown: (details) => setState(() => cardIsDown = true),
56-
onTapCancel: () => setState(() => cardIsDown = false),
57-
child: AnimatedPhysicalModel(
58-
elevation: cardIsDown ? widget.downElevation : widget.upElevation,
59-
borderRadius: widget.borderRadius,
60-
shape: BoxShape.rectangle,
61-
shadowColor: widget.shadowColor,
62-
duration: widget.duration,
63-
color: CupertinoColors.lightBackgroundGray,
30+
onTap: onPressed,
31+
child: Container(
32+
decoration: BoxDecoration(
33+
borderRadius: borderRadius,
34+
),
6435
child: ClipRRect(
65-
borderRadius: widget.borderRadius,
66-
child: widget.child,
36+
borderRadius: borderRadius,
37+
child: child,
6738
),
6839
),
6940
);

0 commit comments

Comments
 (0)