-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathprovider_cart.dart
More file actions
96 lines (89 loc) · 2.94 KB
/
Copy pathprovider_cart.dart
File metadata and controls
96 lines (89 loc) · 2.94 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import 'package:bb_mobile/core/recoverbull/domain/entity/vault_provider.dart';
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/widgets/cards/tag_card.dart';
import 'package:bb_mobile/core/widgets/text/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:bull_ui/bull_ui.dart' show Gap;
class ProviderCard extends StatefulWidget {
final VaultProvider provider;
final VoidCallback onTap;
const ProviderCard({required this.provider, required this.onTap});
@override
State<ProviderCard> createState() => _ProviderCardState();
}
class _ProviderCardState extends State<ProviderCard>
with SingleTickerProviderStateMixin {
late final AnimationController _controller;
late final Animation<double> _scaleAnimation;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(milliseconds: 150),
vsync: this,
);
_scaleAnimation = Tween<double>(
begin: 1.0,
end: 0.98,
).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ScaleTransition(
scale: _scaleAnimation,
child: Material(
color: context.appColors.transparent,
child: InkWell(
onTapDown: (_) => _controller.forward(),
onTapUp: (_) => _controller.reverse(),
onTapCancel: () => _controller.reverse(),
onTap: () {
HapticFeedback.lightImpact();
widget.onTap();
},
borderRadius: BorderRadius.circular(8),
child: Ink(
decoration: BoxDecoration(
color: context.appColors.surface,
borderRadius: BorderRadius.circular(8),
),
child: Container(
padding: const EdgeInsets.all(16),
child: Row(
children: [
SizedBox(
width: 48,
height: 48,
child: Image.asset(widget.provider.iconPath, fit: .cover),
),
const Gap(12),
Expanded(
child: Column(
crossAxisAlignment: .start,
children: [
BBText(
widget.provider.displayName(context),
style: context.font.headlineMedium,
),
const Gap(10),
OptionsTag(text: widget.provider.description(context)),
],
),
),
const Gap(8),
Icon(Icons.arrow_forward, color: context.appColors.onSurface),
],
),
),
),
),
),
);
}
}