Skip to content
Snippets Groups Projects
card_terminal_screen.dart 4.79 KiB
Newer Older
vjrj's avatar
vjrj committed
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';

vjrj's avatar
vjrj committed
import '../../../g1/g1_helper.dart';
vjrj's avatar
vjrj committed
import '../../../shared_prefs.dart';
import 'card_terminal_status.dart';

class CardTerminalScreen extends StatelessWidget {
vjrj's avatar
vjrj committed
  const CardTerminalScreen({super.key, required this.amount});
vjrj's avatar
vjrj committed
  final String amount;
vjrj's avatar
vjrj committed

  @override
  Widget build(BuildContext context) {
    return Card(
      elevation: 8,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
      child: Container(
        width: double.infinity,
vjrj's avatar
vjrj committed
        height: MediaQuery.of(context).size.width < 300 ? 220 : 250,
vjrj's avatar
vjrj committed
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8),
          gradient: const LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: <Color>[
              Colors.blueGrey,
              Colors.white,
            ],
          ),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Container(
                decoration: const BoxDecoration(
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(8),
                    topRight: Radius.circular(8),
                  ),
                  gradient: LinearGradient(
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                    colors: <Color>[
                      Color(0xFF3B3B3B),
                      Color(0xFF232323),
                    ],
                  ),
                ),
                child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      const ConnectivityWidgetWrapper(
                          offlineWidget: CardTerminalStatus(online: false),
                          child: CardTerminalStatus(online: true)),
                      Padding(
                          padding: const EdgeInsets.symmetric(horizontal: 10),
vjrj's avatar
vjrj committed
                          child: Text(amount,
vjrj's avatar
vjrj committed
                              textAlign: TextAlign.right,
                              style: TextStyle(
                                fontFamily: 'LCDMono',
                                color: Colors.white,
                                fontSize: 28,
                                shadows: <Shadow>[
                                  Shadow(
                                    offset: const Offset(1, 1),
                                    blurRadius: 3,
                                    color: Colors.black.withOpacity(0.4),
                                  ),
                                ],
                              )))
                    ])),
            Expanded(
                child: Column(children: <Widget>[
              QrImage(
vjrj's avatar
vjrj committed
                data: getQrUri(SharedPreferencesHelper().getPubKey(), amount),
vjrj's avatar
vjrj committed
                size: MediaQuery.of(context).size.width < 300 ? 120.0 : 160.0,
vjrj's avatar
vjrj committed
              )
            ])),
            Container(
              decoration: const BoxDecoration(
                borderRadius: BorderRadius.only(
                  bottomLeft: Radius.circular(8),
                  bottomRight: Radius.circular(8),
                ),
                gradient: LinearGradient(
                  begin: Alignment.topLeft,
                  end: Alignment.bottomRight,
                  colors: <Color>[
                    Color(0xFF232323),
                    Color(0xFF3B3B3B),
                  ],
                ),
              ),
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      child: TextField(
                        style: const TextStyle(
                          fontFamily: 'Roboto Mono',
                          color: Colors.white,
                          fontSize: 14,
                        ),
                        decoration: InputDecoration(
                          border: InputBorder.none,
vjrj's avatar
vjrj committed
                          hintText: amount.isNotEmpty
vjrj's avatar
vjrj committed
                              ? tr('show_qr_to_client_amount')
                              : tr('show_qr_to_client'),
vjrj's avatar
vjrj committed
                          hintStyle: const TextStyle(
                            fontFamily: 'Roboto Mono',
                            color: Colors.grey,
                            fontSize: 14,
                          ),
                        ),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}