limit external Qr code lib import to a single file and change colors of all qr codes

This commit is contained in:
julian 2024-06-27 13:18:26 -06:00
parent 0ef1726a00
commit 6690581b51
20 changed files with 86 additions and 143 deletions

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../../frost_route_generator.dart'; import '../../../../../frost_route_generator.dart';
import '../../../../wallet_view/transaction_views/transaction_details_view.dart';
import '../../../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../../../providers/frost_wallet/frost_wallet_providers.dart';
import '../../../../../services/frost.dart'; import '../../../../../services/frost.dart';
import '../../../../../themes/stack_colors.dart'; import '../../../../../themes/stack_colors.dart';
@ -17,6 +16,8 @@ import '../../../../../widgets/desktop/secondary_button.dart';
import '../../../../../widgets/detail_item.dart'; import '../../../../../widgets/detail_item.dart';
import '../../../../../widgets/dialogs/simple_mobile_dialog.dart'; import '../../../../../widgets/dialogs/simple_mobile_dialog.dart';
import '../../../../../widgets/frost_step_user_steps.dart'; import '../../../../../widgets/frost_step_user_steps.dart';
import '../../../../../widgets/qr.dart';
import '../../../../wallet_view/transaction_views/transaction_details_view.dart';
class FrostCreateStep1a extends ConsumerStatefulWidget { class FrostCreateStep1a extends ConsumerStatefulWidget {
const FrostCreateStep1a({super.key}); const FrostCreateStep1a({super.key});
@ -162,14 +163,9 @@ class _FrostCreateStep1aState extends ConsumerState<FrostCreateStep1a> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
QrImageView( QR(
data: ref.watch(pFrostMultisigConfig.state).state ?? "Error", data: ref.watch(pFrostMultisigConfig.state).state ?? "Error",
size: 220, size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
], ],
), ),

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../frost_route_generator.dart'; import '../../../../frost_route_generator.dart';
import '../../../../providers/db/main_db_provider.dart'; import '../../../../providers/db/main_db_provider.dart';
@ -23,6 +22,7 @@ import '../../../../widgets/detail_item.dart';
import '../../../../widgets/dialogs/frost/frost_error_dialog.dart'; import '../../../../widgets/dialogs/frost/frost_error_dialog.dart';
import '../../../../widgets/dialogs/simple_mobile_dialog.dart'; import '../../../../widgets/dialogs/simple_mobile_dialog.dart';
import '../../../../widgets/frost_step_user_steps.dart'; import '../../../../widgets/frost_step_user_steps.dart';
import '../../../../widgets/qr.dart';
import '../../../wallet_view/transaction_views/transaction_details_view.dart'; import '../../../wallet_view/transaction_views/transaction_details_view.dart';
class FrostReshareStep1a extends ConsumerStatefulWidget { class FrostReshareStep1a extends ConsumerStatefulWidget {
@ -239,14 +239,9 @@ class _FrostReshareStep1aState extends ConsumerState<FrostReshareStep1a> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
QrImageView( QR(
data: ref.watch(pFrostResharingData).resharerRConfig!, data: ref.watch(pFrostResharingData).resharerRConfig!,
size: 220, size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
], ],
), ),

View file

@ -14,7 +14,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import '../../../app_config.dart'; import '../../../app_config.dart';
@ -37,6 +36,7 @@ import '../../../wallets/wallet/impl/firo_wallet.dart';
import '../../../widgets/background.dart'; import '../../../widgets/background.dart';
import '../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_container.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
@ -751,7 +751,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
height: 24, height: 24,
), ),
Center( Center(
child: QrImageView( child: QR(
// TODO: grab coin uri scheme from somewhere // TODO: grab coin uri scheme from somewhere
// data: "${coin.uriScheme}:$receivingAddress", // data: "${coin.uriScheme}:$receivingAddress",
data: model.trade!.payInAddress, data: model.trade!.payInAddress,
@ -759,9 +759,6 @@ class _Step4ViewState extends ConsumerState<Step4View> {
.size .size
.width / .width /
2, 2,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
const SizedBox( const SizedBox(

View file

@ -16,7 +16,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -50,6 +49,7 @@ import '../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../widgets/custom_buttons/blue_text_button.dart'; import '../../widgets/custom_buttons/blue_text_button.dart';
import '../../widgets/desktop/desktop_dialog.dart'; import '../../widgets/desktop/desktop_dialog.dart';
import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/desktop/secondary_button.dart';
import '../../widgets/qr.dart';
import '../../widgets/rounded_container.dart'; import '../../widgets/rounded_container.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart'; import '../../widgets/stack_dialog.dart';
@ -808,15 +808,9 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImageView( child: QR(
data: trade.payInAddress, data: trade.payInAddress,
size: width, size: width,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),

View file

@ -14,15 +14,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:tuple/tuple.dart';
import '../../../exceptions/wallet/insufficient_balance_exception.dart'; import '../../../exceptions/wallet/insufficient_balance_exception.dart';
import '../../../models/paynym/paynym_account_lite.dart'; import '../../../models/paynym/paynym_account_lite.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import 'confirm_paynym_connect_dialog.dart';
import '../paynym_home_view.dart';
import '../subwidgets/paynym_bot.dart';
import '../../send_view/confirm_transaction_view.dart';
import '../../send_view/send_view.dart';
import '../../../providers/global/locale_provider.dart'; import '../../../providers/global/locale_provider.dart';
import '../../../providers/global/wallets_provider.dart'; import '../../../providers/global/wallets_provider.dart';
import '../../../route_generator.dart'; import '../../../route_generator.dart';
@ -37,9 +33,14 @@ import '../../../widgets/desktop/desktop_dialog.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/loading_indicator.dart'; import '../../../widgets/loading_indicator.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
import 'package:tuple/tuple.dart'; import '../../send_view/confirm_transaction_view.dart';
import '../../send_view/send_view.dart';
import '../paynym_home_view.dart';
import '../subwidgets/paynym_bot.dart';
import 'confirm_paynym_connect_dialog.dart';
class PaynymDetailsPopup extends ConsumerStatefulWidget { class PaynymDetailsPopup extends ConsumerStatefulWidget {
const PaynymDetailsPopup({ const PaynymDetailsPopup({
@ -365,12 +366,10 @@ class _PaynymDetailsPopupState extends ConsumerState<PaynymDetailsPopup> {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImageView( QR(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 100, size: 100,
data: widget.accountLite.code, data: widget.accountLite.code,
foregroundColor:
Theme.of(context).extension<StackColors>()!.textDark,
), ),
], ],
), ),

View file

@ -12,10 +12,9 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../models/paynym/paynym_account.dart'; import '../../../models/paynym/paynym_account.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import '../subwidgets/paynym_bot.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart'; import '../../../utilities/assets.dart';
import '../../../utilities/text_styles.dart'; import '../../../utilities/text_styles.dart';
@ -23,6 +22,8 @@ import '../../../utilities/util.dart';
import '../../../widgets/custom_buttons/blue_text_button.dart'; import '../../../widgets/custom_buttons/blue_text_button.dart';
import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog.dart';
import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../../widgets/qr.dart';
import '../subwidgets/paynym_bot.dart';
class PaynymQrPopup extends StatelessWidget { class PaynymQrPopup extends StatelessWidget {
const PaynymQrPopup({ const PaynymQrPopup({
@ -157,12 +158,10 @@ class PaynymQrPopup extends StatelessWidget {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImageView( QR(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 130, size: 130,
data: paynymAccount.nonSegwitPaymentCode.code, data: paynymAccount.nonSegwitPaymentCode.code,
foregroundColor:
Theme.of(context).extension<StackColors>()!.textDark,
), ),
], ],
), ),

View file

@ -14,19 +14,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../exceptions/wallet/insufficient_balance_exception.dart'; import '../../../exceptions/wallet/insufficient_balance_exception.dart';
import '../../../models/paynym/paynym_account_lite.dart'; import '../../../models/paynym/paynym_account_lite.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
import '../dialogs/confirm_paynym_connect_dialog.dart';
import 'paynym_bot.dart';
import '../../send_view/confirm_transaction_view.dart';
import '../../../pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart'; import '../../../pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart';
import '../../../providers/global/locale_provider.dart'; import '../../../providers/global/locale_provider.dart';
import '../../../providers/global/wallets_provider.dart'; import '../../../providers/global/wallets_provider.dart';
import '../../../themes/stack_colors.dart'; import '../../../themes/stack_colors.dart';
import '../../../utilities/assets.dart'; import '../../../utilities/assets.dart';
import '../../../utilities/text_styles.dart'; import '../../../utilities/text_styles.dart';
import '../../../wallets/isar/providers/wallet_info_provider.dart'; import '../../../wallets/isar/providers/wallet_info_provider.dart';
import '../../../wallets/models/tx_data.dart'; import '../../../wallets/models/tx_data.dart';
@ -36,8 +32,12 @@ import '../../../widgets/custom_buttons/paynym_follow_toggle_button.dart';
import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/loading_indicator.dart'; import '../../../widgets/loading_indicator.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/rounded_container.dart'; import '../../../widgets/rounded_container.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../send_view/confirm_transaction_view.dart';
import '../dialogs/confirm_paynym_connect_dialog.dart';
import 'paynym_bot.dart';
class DesktopPaynymDetails extends ConsumerStatefulWidget { class DesktopPaynymDetails extends ConsumerStatefulWidget {
const DesktopPaynymDetails({ const DesktopPaynymDetails({
@ -359,12 +359,10 @@ class _PaynymDetailsPopupState extends ConsumerState<DesktopPaynymDetails> {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImageView( QR(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 100, size: 100,
data: widget.accountLite.code, data: widget.accountLite.code,
foregroundColor:
Theme.of(context).extension<StackColors>()!.textDark,
), ),
], ],
), ),

View file

@ -20,7 +20,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import '../../../db/isar/main_db.dart'; import '../../../db/isar/main_db.dart';
@ -39,6 +38,7 @@ import '../../../widgets/custom_buttons/blue_text_button.dart';
import '../../../widgets/custom_buttons/simple_edit_button.dart'; import '../../../widgets/custom_buttons/simple_edit_button.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
@ -302,19 +302,13 @@ class _AddressCardState extends ConsumerState<AddressCard> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImageView( child: QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
widget.coin, widget.coin,
address.value, address.value,
{}, {},
), ),
size: 220, size: 220,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),

View file

@ -11,7 +11,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../db/isar/main_db.dart'; import '../../../db/isar/main_db.dart';
import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart'; import '../../../models/isar/models/blockchain_data/v2/transaction_v2.dart';
@ -31,6 +30,7 @@ import '../../../widgets/custom_buttons/simple_copy_button.dart';
import '../../../widgets/custom_buttons/simple_edit_button.dart'; import '../../../widgets/custom_buttons/simple_edit_button.dart';
import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog.dart';
import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/rounded_white_container.dart'; import '../../../widgets/rounded_white_container.dart';
import '../../../widgets/transaction_card.dart'; import '../../../widgets/transaction_card.dart';
import '../../wallet_view/sub_widgets/no_transactions_found.dart'; import '../../wallet_view/sub_widgets/no_transactions_found.dart';
@ -92,18 +92,13 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImageView( child: QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
ref.watch(pWalletCoin(widget.walletId)), ref.watch(pWalletCoin(widget.walletId)),
address.value, address.value,
{}, {},
), ),
size: 220, size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),
@ -289,19 +284,13 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImageView( child: QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
coin, coin,
address.value, address.value,
{}, {},
), ),
size: 220, size: 220,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),

View file

@ -18,7 +18,6 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
@ -31,6 +30,7 @@ import '../../../utilities/util.dart';
import '../../../wallets/crypto_currency/crypto_currency.dart'; import '../../../wallets/crypto_currency/crypto_currency.dart';
import '../../../widgets/desktop/primary_button.dart'; import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/qr.dart';
import '../../../widgets/stack_dialog.dart'; import '../../../widgets/stack_dialog.dart';
class AddressQrPopup extends StatefulWidget { class AddressQrPopup extends StatefulWidget {
@ -140,17 +140,13 @@ class _AddressQrPopupState extends State<AddressQrPopup> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImageView( child: QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
widget.coin, widget.coin,
widget.addressString, widget.addressString,
{}, {},
), ),
size: 220, size: 220,
backgroundColor:
Theme.of(context).extension<StackColors>()!.popupBG,
foregroundColor:
Theme.of(context).extension<StackColors>()!.accentColorDark,
), ),
), ),
), ),

View file

@ -20,7 +20,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import '../../notifications/show_flush_bar.dart'; import '../../notifications/show_flush_bar.dart';
@ -39,6 +38,7 @@ import '../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../widgets/desktop/primary_button.dart'; import '../../widgets/desktop/primary_button.dart';
import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/desktop/secondary_button.dart';
import '../../widgets/icon_widgets/x_icon.dart'; import '../../widgets/icon_widgets/x_icon.dart';
import '../../widgets/qr.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import '../../widgets/stack_dialog.dart'; import '../../widgets/stack_dialog.dart';
import '../../widgets/stack_text_field.dart'; import '../../widgets/stack_text_field.dart';
@ -215,14 +215,9 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImageView( child: QR(
data: uriString, data: uriString,
size: width, size: width,
backgroundColor:
Theme.of(context).extension<StackColors>()!.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),
@ -556,15 +551,9 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
child: SizedBox( child: SizedBox(
width: 234, width: 234,
height: 234, height: 234,
child: QrImageView( child: QR(
data: _uriString, data: _uriString,
size: 220, size: 220,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),

View file

@ -16,7 +16,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../models/isar/models/isar_models.dart'; import '../../models/isar/models/isar_models.dart';
import '../../notifications/show_flush_bar.dart'; import '../../notifications/show_flush_bar.dart';
@ -44,6 +43,7 @@ import '../../widgets/custom_buttons/blue_text_button.dart';
import '../../widgets/custom_loading_overlay.dart'; import '../../widgets/custom_loading_overlay.dart';
import '../../widgets/desktop/primary_button.dart'; import '../../widgets/desktop/primary_button.dart';
import '../../widgets/desktop/secondary_button.dart'; import '../../widgets/desktop/secondary_button.dart';
import '../../widgets/qr.dart';
import '../../widgets/rounded_white_container.dart'; import '../../widgets/rounded_white_container.dart';
import 'addresses/wallet_addresses_view.dart'; import 'addresses/wallet_addresses_view.dart';
import 'generate_receiving_uri_qr_code_view.dart'; import 'generate_receiving_uri_qr_code_view.dart';
@ -575,16 +575,13 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
QrImageView( QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
coin, coin,
address, address,
{}, {},
), ),
size: MediaQuery.of(context).size.width / 2, size: MediaQuery.of(context).size.width / 2,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
const SizedBox( const SizedBox(
height: 20, height: 20,

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../frost_route_generator.dart'; import '../../../../frost_route_generator.dart';
import '../../../wallet_view/transaction_views/transaction_details_view.dart';
import '../../../../providers/frost_wallet/frost_wallet_providers.dart'; import '../../../../providers/frost_wallet/frost_wallet_providers.dart';
import '../../../../providers/global/wallets_provider.dart'; import '../../../../providers/global/wallets_provider.dart';
import '../../../../themes/stack_colors.dart'; import '../../../../themes/stack_colors.dart';
@ -14,7 +13,9 @@ import '../../../../widgets/custom_buttons/checkbox_text_button.dart';
import '../../../../widgets/custom_buttons/simple_copy_button.dart'; import '../../../../widgets/custom_buttons/simple_copy_button.dart';
import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/detail_item.dart'; import '../../../../widgets/detail_item.dart';
import '../../../../widgets/qr.dart';
import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/rounded_white_container.dart';
import '../../../wallet_view/transaction_views/transaction_details_view.dart';
class FrostSendStep1a extends ConsumerStatefulWidget { class FrostSendStep1a extends ConsumerStatefulWidget {
const FrostSendStep1a({super.key}); const FrostSendStep1a({super.key});
@ -169,14 +170,9 @@ class _FrostSendStep1aState extends ConsumerState<FrostSendStep1a> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
QrImageView( QR(
data: ref.watch(pFrostTxData.state).state!.frostMSConfig!, data: ref.watch(pFrostTxData.state).state!.frostMSConfig!,
size: qrImageSize, size: qrImageSize,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
], ],
), ),

View file

@ -14,7 +14,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../app_config.dart'; import '../../../../app_config.dart';
import '../../../../notifications/show_flush_bar.dart'; import '../../../../notifications/show_flush_bar.dart';
@ -30,6 +29,7 @@ import '../../../../widgets/background.dart';
import '../../../../widgets/custom_buttons/app_bar_icon_button.dart'; import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../../widgets/custom_buttons/simple_copy_button.dart'; import '../../../../widgets/custom_buttons/simple_copy_button.dart';
import '../../../../widgets/detail_item.dart'; import '../../../../widgets/detail_item.dart';
import '../../../../widgets/qr.dart';
import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/rounded_white_container.dart';
import '../../../../widgets/stack_dialog.dart'; import '../../../../widgets/stack_dialog.dart';
import '../../../add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; import '../../../add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart';
@ -317,15 +317,9 @@ class WalletBackupView extends ConsumerWidget {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImageView( child: QR(
data: data, data: data,
size: width, size: width,
backgroundColor: Theme.of(context)
.extension<StackColors>()!
.popupBG,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
), ),

View file

@ -14,7 +14,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../notifications/show_flush_bar.dart'; import '../../../../notifications/show_flush_bar.dart';
import '../../../../providers/global/wallets_provider.dart'; import '../../../../providers/global/wallets_provider.dart';
@ -32,6 +31,7 @@ import '../../../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/primary_button.dart';
import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart';
import '../../../../widgets/loading_indicator.dart'; import '../../../../widgets/loading_indicator.dart';
import '../../../../widgets/qr.dart';
import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/rounded_white_container.dart';
class XPubView extends ConsumerStatefulWidget { class XPubView extends ConsumerStatefulWidget {
@ -256,11 +256,9 @@ class _XPub extends StatelessWidget {
builder: (child) => RoundedWhiteContainer( builder: (child) => RoundedWhiteContainer(
child: child, child: child,
), ),
child: QrImageView( child: QR(
data: xpub, data: xpub,
size: isDesktop ? 280 : MediaQuery.of(context).size.width / 1.5, size: isDesktop ? 280 : MediaQuery.of(context).size.width / 1.5,
foregroundColor:
Theme.of(context).extension<StackColors>()!.accentColorDark,
), ),
), ),
const SizedBox(height: 25), const SizedBox(height: 25),

View file

@ -13,7 +13,6 @@ import 'dart:async';
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../app_config.dart'; import '../../../app_config.dart';
import '../../../models/exchange/incomplete_exchange.dart'; import '../../../models/exchange/incomplete_exchange.dart';
@ -37,6 +36,7 @@ import '../../../widgets/desktop/primary_button.dart';
import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/desktop/secondary_button.dart';
import '../../../widgets/desktop/simple_desktop_dialog.dart'; import '../../../widgets/desktop/simple_desktop_dialog.dart';
import '../../../widgets/fade_stack.dart'; import '../../../widgets/fade_stack.dart';
import '../../../widgets/qr.dart';
import '../subwidgets/desktop_exchange_steps_indicator.dart'; import '../subwidgets/desktop_exchange_steps_indicator.dart';
import 'subwidgets/desktop_step_1.dart'; import 'subwidgets/desktop_step_1.dart';
import 'subwidgets/desktop_step_2.dart'; import 'subwidgets/desktop_step_2.dart';
@ -397,7 +397,7 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
height: 48, height: 48,
), ),
Center( Center(
child: QrImageView( child: QR(
// TODO: grab coin uri scheme from somewhere // TODO: grab coin uri scheme from somewhere
// data: "${coin.uriScheme}:$receivingAddress", // data: "${coin.uriScheme}:$receivingAddress",
data: ref.watch( data: ref.watch(
@ -406,9 +406,6 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
), ),
), ),
size: 290, size: 290,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
), ),
), ),
const SizedBox( const SizedBox(

View file

@ -16,7 +16,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import '../../../../models/isar/models/isar_models.dart'; import '../../../../models/isar/models/isar_models.dart';
@ -42,6 +41,7 @@ import '../../../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../../../widgets/custom_loading_overlay.dart'; import '../../../../widgets/custom_loading_overlay.dart';
import '../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../widgets/desktop/desktop_dialog.dart';
import '../../../../widgets/desktop/secondary_button.dart'; import '../../../../widgets/desktop/secondary_button.dart';
import '../../../../widgets/qr.dart';
import '../../../../widgets/rounded_white_container.dart'; import '../../../../widgets/rounded_white_container.dart';
class DesktopReceive extends ConsumerStatefulWidget { class DesktopReceive extends ConsumerStatefulWidget {
@ -476,15 +476,13 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
height: 32, height: 32,
), ),
Center( Center(
child: QrImageView( child: QR(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
coin, coin,
_qrcodeContent ?? "", _qrcodeContent ?? "",
{}, {},
), ),
size: 200, size: 200,
foregroundColor:
Theme.of(context).extension<StackColors>()!.accentColorDark,
), ),
), ),
const SizedBox( const SizedBox(

View file

@ -9,10 +9,10 @@
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
import '../../../../themes/stack_colors.dart';
import '../../../../widgets/desktop/desktop_dialog.dart'; import '../../../../widgets/desktop/desktop_dialog.dart';
import '../../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../../../widgets/qr.dart';
class QRCodeDesktopPopupContent extends StatelessWidget { class QRCodeDesktopPopupContent extends StatelessWidget {
const QRCodeDesktopPopupContent({ const QRCodeDesktopPopupContent({
@ -39,11 +39,9 @@ class QRCodeDesktopPopupContent extends StatelessWidget {
const SizedBox( const SizedBox(
height: 14, height: 14,
), ),
QrImageView( QR(
data: value, data: value,
size: 300, size: 300,
foregroundColor:
Theme.of(context).extension<StackColors>()!.accentColorDark,
), ),
], ],
), ),

View file

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import '../../../notifications/show_flush_bar.dart'; import '../../../notifications/show_flush_bar.dart';
@ -17,6 +17,7 @@ import '../../../utilities/text_styles.dart';
import '../../../utilities/util.dart'; import '../../../utilities/util.dart';
import '../../conditional_parent.dart'; import '../../conditional_parent.dart';
import '../../desktop/secondary_button.dart'; import '../../desktop/secondary_button.dart';
import '../../qr.dart';
import '../../rounded_container.dart'; import '../../rounded_container.dart';
import '../../rounded_white_container.dart'; import '../../rounded_white_container.dart';
import '../simple_mobile_dialog.dart'; import '../simple_mobile_dialog.dart';
@ -154,18 +155,9 @@ class _FrostStepQrDialogState extends State<FrostStepQrDialog> {
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: QrImageView( child: QR(
data: widget.data, data: widget.data,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
foregroundColor: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
// dataModuleStyle: QrDataModuleStyle(
// dataModuleShape: QrDataModuleShape.square,
// color: Theme.of(context)
// .extension<StackColors>()!
// .accentColorDark,
// ),
), ),
), ),
), ),

27
lib/widgets/qr.dart Normal file
View file

@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
/// Centralised Qr code image widget
class QR extends StatelessWidget {
const QR({super.key, required this.data, this.size, this.padding});
final String data;
final double? size;
final EdgeInsets? padding;
@override
Widget build(BuildContext context) {
return QrImageView(
data: data,
size: size,
padding: padding ?? const EdgeInsets.all(10),
backgroundColor: Colors.white,
foregroundColor: Colors.black,
// backgroundColor:
// Theme.of(context).extension<StackColors>()!.background,
// foregroundColor: Theme.of(context)
// .extension<StackColors>()!
// .accentColorDark,
);
}
}