Newer
Older
import 'package:easy_localization/easy_localization.dart';
import '../../../data/models/credit_card_theme_selector.dart';
class CreditCardMini extends StatelessWidget {
const CreditCardMini(
{super.key,
required this.card,
required this.cardIndex,
required this.settingsVisible});
void _showThemeSelector(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(tr('card_theme_select')),
content: SizedBox(
width: double.maxFinite,
child: CardThemeSelector(
card: card,
onTap: (CreditCardTheme theme) =>
SharedPreferencesHelper().setTheme(theme: theme))),
@override
Widget build(BuildContext context) {
const double cardRadius = 10.0;
final bool bigDevice = bigScreen(context);
final double cardInternalElPadding = bigDevice ? 5 : 6.0;
return Padding(
padding: const EdgeInsets.all(10),
child: Card(
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(cardRadius),
),
child: AspectRatio(
aspectRatio: cardAspectRatio, // Credit cart aspect ratio
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(cardRadius),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey[400]!,
blurRadius: 3.0,
spreadRadius: 1.0,
)
],
gradient: LinearGradient(
begin: Alignment.bottomLeft,
end: Alignment.topRight,
colors: <Color>[
card.theme.primaryColor,
card.theme.secondaryColor
],
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
child: Padding(
padding: const EdgeInsets.all(10),
child: Stack(children: <Widget>[
if (inDevelopment)
Positioned(
top: 30,
right: -10,
child: Visibility(
visible: settingsVisible,
child: FloatingActionButton(
backgroundColor: Colors.transparent,
elevation: 0,
onPressed: () {
SharedPreferencesHelper()
.selectCurrentWalletIndex(0);
SharedPreferencesHelper()
.removeCesiumCard(cardIndex);
},
child: const Icon(Icons.delete,
color: Colors.white),
),
),
),
Positioned(
top: -10,
right: -10,
child: Visibility(
visible: settingsVisible,
child: FloatingActionButton(
backgroundColor: Colors.transparent,
elevation: 0,
onPressed: () => _showThemeSelector(context),
child: const Icon(Icons.settings,
color: Colors.white),
),
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(120, 10, 0, 0),
child: Opacity(
opacity: 0.2,
child: Image.asset(
'assets/img/gbrevedot_alt.png',
width: 100,
height: 100),
)),
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
GestureDetector(
onTap: () => onCardTap(context),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
if (card.name.isNotEmpty)
Padding(
padding: EdgeInsets.symmetric(
horizontal:
cardInternalElPadding,
vertical:
cardInternalElPadding),
child: Row(children: <Widget>[
Expanded(
child: CardNameText(
currentText: card.name,
onTap: () {})),
])),
Padding(
padding: EdgeInsets.symmetric(
horizontal: cardInternalElPadding,
vertical: cardInternalElPadding),
child: Row(children: <Widget>[
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'${card.pubKey.substring(0, 4)} ${card.pubKey.substring(4, 8)}',
style: cardTextStyle(context,
fontSize: 16),
)),
])),
if (bigDevice)
const SizedBox(height: 6.0),
const SizedBox(height: 8.0),
])),
void onCardTap(BuildContext context) {
SharedPreferencesHelper().selectCurrentWallet(card);
Navigator.pop(context);
}