-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdismissible_card.dart
45 lines (38 loc) · 1.11 KB
/
dismissible_card.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Flutter imports:
import 'package:flutter/material.dart';
class DismissibleCard extends StatelessWidget {
final Widget child;
final Function(DismissDirection) onDismissed;
final Color? cardColor;
final double elevation;
final bool isBusy;
const DismissibleCard(
{super.key,
required this.onDismissed,
required this.child,
this.elevation = 3,
this.cardColor,
this.isBusy = false});
@override
Widget build(BuildContext context) => Dismissible(
key: UniqueKey(),
onDismissed: onDismissed,
child: Card(
elevation: elevation,
color: cardColor,
margin: const EdgeInsets.fromLTRB(8, 4, 8, 4),
child: Stack(children: [
child,
if (isBusy)
const Align(
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.all(10),
child: SizedBox(
height: 15.0,
width: 15.0,
child: CircularProgressIndicator(strokeWidth: 3.0)),
))
]),
));
}