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

Some work with small screens

parent a33cd4ff
No related branches found
No related tags found
No related merge requests found
......@@ -73,3 +73,5 @@ Color tileColor(int index, [bool inverse = false]) =>
String? humanizeTime(DateTime time, String locale) =>
timeago.format(time, locale: locale, clock: DateTime.now());
bool txDebugging = false;
......@@ -11,30 +11,32 @@ class CreditCard extends StatelessWidget {
CreditCard({super.key});
final String publicKey = SharedPreferencesHelper().getPubKey();
final TextStyle cardTextStyle = TextStyle(
fontFamily: 'SourceCodePro',
// decoration: TextDecoration.underline,
color: Colors.white,
fontSize: 22.0,
fontWeight: FontWeight.bold,
shadows: <Shadow>[
Shadow(
blurRadius: 1,
color: Colors.black.withOpacity(0.7),
offset: const Offset(0, 2),
),
Shadow(
blurRadius: 1,
color: Colors.white.withOpacity(0.5),
offset: const Offset(0, -1),
),
],
);
TextStyle cardTextStyle(BuildContext context) => TextStyle(
fontFamily: 'SourceCodePro',
// decoration: TextDecoration.underline,
color: Colors.white,
fontSize: MediaQuery.of(context).size.width * 0.06,
fontWeight: FontWeight.bold,
shadows: <Shadow>[
Shadow(
blurRadius: 1,
color: Colors.black.withOpacity(0.7),
offset: const Offset(0, 2),
),
Shadow(
blurRadius: 1,
color: Colors.white.withOpacity(0.5),
offset: const Offset(0, -1),
),
],
);
@override
Widget build(BuildContext context) {
const double cardRadius = 10.0;
const double cardPadding = 26.0;
final double cardPadding =
MediaQuery.of(context).size.width > 300 ? 26.0 : 16.0;
final String pubKey = SharedPreferencesHelper().getPubKey();
return Card(
......@@ -72,47 +74,56 @@ class CreditCard extends StatelessWidget {
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
Widget>[
Padding(
padding: const EdgeInsets.all(cardPadding),
child: Text(
dotenv.env['CARD_COLOR_TEXT'] ?? tr('g1_wallet'),
style: const TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
padding: EdgeInsets.all(cardPadding),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
dotenv.env['CARD_COLOR_TEXT'] ?? tr('g1_wallet'),
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context).size.width * 0.07,
fontWeight: FontWeight.bold,
),
)),
),
const SizedBox(height: 8.0),
if (MediaQuery.of(context).size.width > 300)
const SizedBox(height: 8.0),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: cardPadding),
padding: EdgeInsets.symmetric(horizontal: cardPadding),
child: GestureDetector(
onTap: () {
_showQrDialog(context);
},
child: SvgPicture.asset(
width: MediaQuery.of(context).size.width < 300
? 25
: 40,
'assets/img/chip.svg',
))),
const SizedBox(height: 8.0),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: cardPadding),
padding: EdgeInsets.symmetric(horizontal: cardPadding),
child: Row(children: <Widget>[
GestureDetector(
onTap: () =>
showTooltip(context, '', tr('keys_tooltip')),
child: Text('**** **** ', style: cardTextStyle)),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text('**** **** ',
style: cardTextStyle(context)))),
GestureDetector(
onTap: () => copyPublicKeyToClipboard(context),
child: Text(
'${pubKey.substring(0, 4)} ${pubKey.substring(4, 8)}',
style: cardTextStyle,
))
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'${pubKey.substring(0, 4)} ${pubKey.substring(4, 8)}',
style: cardTextStyle(context),
)))
])),
const SizedBox(height: 12.0),
if (MediaQuery.of(context).size.width > 300)
const SizedBox(height: 12.0),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: cardPadding),
padding: EdgeInsets.symmetric(horizontal: cardPadding),
child: GestureDetector(
onTap: () =>
showTooltip(context, '', tr('card_validity_tooltip')),
......
......@@ -30,7 +30,6 @@ class _TransactionsAndBalanceWidgetState
late NodeListCubit nodeListCubit;
late TransactionsCubit transCubit;
bool isLoading = false;
bool debugging = false;
@override
void initState() {
......@@ -64,7 +63,7 @@ class _TransactionsAndBalanceWidgetState
@override
Widget build(BuildContext context) {
final String myPubKey = debugging
final String myPubKey = !txDebugging
? SharedPreferencesHelper().getPubKey()
: '6DrGg8cftpkgffv4Y4Lse9HSjgc8coEQor3yvMPHAnVH';
return BlocBuilder<TransactionsCubit, TransactionsAndBalanceState>(builder:
......
......@@ -36,60 +36,61 @@ class _CardTerminalState extends State<CardTerminal> {
@override
Widget build(BuildContext context) {
_decimalSep = NumberFormat.decimalPattern(context.locale.toString())
_decimalSep = NumberFormat
.decimalPattern(context.locale.toString())
.symbols
.DECIMAL_SEP;
_numbers[9] = _decimalSep;
return Expanded(
child: Center(
child: Card(
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
),
child: Container(
width: 320.0,
height: 700,
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: <Color>[
Colors.grey[800]!,
Colors.grey[500]!,
],
),
),
child: Column(
//crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
CardTerminalScreen(amount: _currentValue),
const SizedBox(height: 8.0),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: GridView.count(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
crossAxisCount: 3,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
childAspectRatio: 1.75 / 1,
padding: EdgeInsets.zero,
children: <Widget>[
for (int i = 0; i < _numbers.length + 3; i++)
_buildKeyboardButton(i)
]))
]),
),
)));
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
),
child: Container(
width: 320.0,
height: 700,
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: <Color>[
Colors.grey[800]!,
Colors.grey[500]!,
],
),
),
child: ListView(
//crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
CardTerminalScreen(amount: _currentValue),
const SizedBox(height: 8.0),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: GridView.count(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
crossAxisCount: 3,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
childAspectRatio: 1.75 / 1,
padding: EdgeInsets.zero,
children: <Widget>[
for (int i = 0; i < _numbers.length + 3; i++)
_buildKeyboardButton(i)
]))
]),
),
)));
}
Widget _buildKeyboardButton(int index) {
if (index == _backspaceIndex) {
return RubberButton(
// Yellow, remove
// Yellow, remove
bgColor: const Color(0xFFF7E378),
icon: Icons.backspace,
onPressed: () {
......@@ -102,7 +103,7 @@ class _CardTerminalState extends State<CardTerminal> {
});
} else if (index == _submitIndex) {
return RubberButton(
// Green, send
// Green, send
bgColor: const Color(0xFF36B649),
icon: Icons.subdirectory_arrow_left,
onPressed: () {
......@@ -110,7 +111,7 @@ class _CardTerminalState extends State<CardTerminal> {
});
} else if (index == _cancelIndex) {
return RubberButton(
// Red, cancel
// Red, cancel
bgColor: const Color(0xFFCD303D),
icon: Icons.cancel,
onPressed: () {
......
......@@ -19,7 +19,7 @@ class CardTerminalScreen extends StatelessWidget {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: Container(
width: double.infinity,
height: 250,
height: MediaQuery.of(context).size.width < 300 ? 220 : 250,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
gradient: const LinearGradient(
......@@ -76,7 +76,7 @@ class CardTerminalScreen extends StatelessWidget {
child: Column(children: <Widget>[
QrImage(
data: getQrUri(SharedPreferencesHelper().getPubKey(), amount),
size: 160.0,
size: MediaQuery.of(context).size.width < 300 ? 120.0 : 160.0,
)
])),
Container(
......
......@@ -33,9 +33,11 @@ class RubberButton extends StatelessWidget {
child: label != null
? Text(label!.toUpperCase(),
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontFamily: 'Roboto Mono',
fontSize: 32,
fontSize: MediaQuery.of(context).size.width > 300
? 30
: MediaQuery.of(context).size.width * 0.08,
fontWeight: FontWeight.bold,
color: Colors.black,
))
......
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