Skip to content
Snippets Groups Projects
Commit abb69645 authored by vjrj's avatar vjrj
Browse files

More work with the cards drawer

parent 74147712
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import '../../data/models/cesium_card.dart';
import '../../shared_prefs.dart';
import '../screens/sandbox.dart';
import '../ui_helpers.dart';
import 'first_screen/card_stack.dart';
class CardDrawer extends StatelessWidget {
const CardDrawer({super.key});
......@@ -52,17 +53,11 @@ class CardDrawer extends StatelessWidget {
const SizedBox(
height: 200,
child: Center(
child: Text(
'Cards',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
child: CardStack(),
),
),
if (kReleaseMode) Expanded(child: Container()),
if (!kReleaseMode)
Expanded(child: Container()),
/* if (!kReleaseMode)
Expanded(
child: Container(
decoration: const BoxDecoration(
......@@ -86,7 +81,7 @@ class CardDrawer extends StatelessWidget {
},
),
),
),
), */
if (inDevelopment)
ListTile(
leading: const Icon(Icons.build),
......
import 'package:durt/durt.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../../../shared_prefs.dart';
import '../../ui_helpers.dart';
import 'card_name_editable.dart';
import 'card_text_style.dart';
class CreditCardMini extends StatelessWidget {
const CreditCardMini({super.key, required this.wallet});
const CreditCardMini({super.key, required this.pubKey});
final CesiumWallet wallet;
final String pubKey;
@override
Widget build(BuildContext context) {
final String pubKey = wallet.pubkey;
const double cardRadius = 10.0;
final bool bigDevice = bigScreen(context);
final double cardPadding = bigDevice ? 26.0 : 16.0;
return Card(
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(cardRadius),
),
child: AspectRatio(
aspectRatio: 1.58, // Credit cart aspect ratio
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(cardRadius),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey[400]!,
blurRadius: 10.0,
spreadRadius: 1.0,
)
],
gradient: LinearGradient(
begin: Alignment.bottomLeft,
end: Alignment.topRight,
colors: <Color>[
Color(int.parse("${dotenv.env['CARD_COLOR_LEFT']}")),
Color(int.parse("${dotenv.env['CARD_COLOR_RIGHT']}")),
],
),
),
child: Stack(children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(160, 10, 0, 0),
child: Opacity(
opacity: 0.1,
child: Image.asset('assets/img/gbrevedot_alt.png'))),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: EdgeInsets.all(cardPadding),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
dotenv.env['CARD_TEXT'] ?? tr('g1_wallet'),
style: TextStyle(
color: Colors.white,
fontSize:
MediaQuery.of(context).size.width * 0.07,
fontWeight: FontWeight.bold,
),
)),
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: 1.58, // 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>[
Color(int.parse("${dotenv.env['CARD_COLOR_LEFT']}")),
Color(int.parse("${dotenv.env['CARD_COLOR_RIGHT']}")),
],
),
const SizedBox(height: 6.0),
Padding(
padding:
EdgeInsets.symmetric(horizontal: cardPadding),
child: Row(children: <Widget>[
GestureDetector(
onTap: () => showTooltip(
context, '', tr('keys_tooltip')),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text('**** **** ',
style: cardTextStyle(context)))),
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'${pubKey.substring(0, 4)} ${pubKey.substring(4, 8)}',
style: cardTextStyle(context),
))
])),
if (bigDevice) const SizedBox(height: 6.0),
const SizedBox(height: 18.0),
]),
]),
)));
),
child: Padding(
padding: const EdgeInsets.all(10),
child: Stack(children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(120, 10, 0, 0),
child: Opacity(
opacity: 0.1,
child: Image.asset('assets/img/gbrevedot_alt.png',
width: 100, height: 100),
)),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(
horizontal: cardInternalElPadding,
vertical: cardInternalElPadding),
child: Row(children: <Widget>[
Expanded(
child: CardNameText(
currentText:
SharedPreferencesHelper().getName(),
onTap: () {},
)),
])),
Padding(
padding: EdgeInsets.symmetric(
horizontal: cardInternalElPadding,
vertical: cardInternalElPadding),
child: Row(children: <Widget>[
GestureDetector(
onTap: () => showQrDialog(
context: context,
publicKey: pubKey),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'${pubKey.substring(0, 4)} ${pubKey.substring(4, 8)}',
style: cardTextStyle(context,
fontSize: 16),
))),
])),
if (bigDevice) const SizedBox(height: 6.0),
const SizedBox(height: 8.0),
]),
]),
)))));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment