refactor dropdown2 and qr image

This commit is contained in:
julian 2023-06-05 07:40:56 -06:00
parent f61211d7b4
commit 044c957152
21 changed files with 202 additions and 227 deletions

View file

@ -420,32 +420,32 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
} }
}, },
isExpanded: true, isExpanded: true,
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 12, Assets.svg.chevronDown,
height: 6, width: 12,
color: Theme.of(context) height: 6,
.extension<StackColors>()! color: Theme.of(context)
.textFieldActiveSearchIconRight, .extension<StackColors>()!
), .textFieldActiveSearchIconRight,
buttonPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
dropdownDecoration: BoxDecoration( dropdownStyleData: DropdownStyleData(
color: Theme.of(context) offset: const Offset(0, -10),
.extension<StackColors>()! elevation: 0,
.textFieldDefaultBG, decoration: BoxDecoration(
borderRadius: BorderRadius.circular( color: Theme.of(context)
Constants.size.circularBorderRadius, .extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
), ),
), ),
), ),

View file

@ -99,9 +99,25 @@ class _NewContactAddressEntryFormState
"Select cryptocurrency", "Select cryptocurrency",
style: STextStyles.fieldLabel(context), style: STextStyles.fieldLabel(context),
), ),
offset: const Offset(0, -10), dropdownStyleData: DropdownStyleData(
offset: const Offset(0, -10),
elevation: 0,
decoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
),
isExpanded: true, isExpanded: true,
dropdownElevation: 0,
value: ref.watch(addressEntryDataProvider(widget.id) value: ref.watch(addressEntryDataProvider(widget.id)
.select((value) => value.coin)), .select((value) => value.coin)),
onChanged: (value) { onChanged: (value) {
@ -109,30 +125,12 @@ class _NewContactAddressEntryFormState
ref.read(addressEntryDataProvider(widget.id)).coin = value; ref.read(addressEntryDataProvider(widget.id)).coin = value;
} }
}, },
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 10, Assets.svg.chevronDown,
height: 5, width: 10,
color: Theme.of(context).extension<StackColors>()!.textDark3, height: 5,
), color: Theme.of(context).extension<StackColors>()!.textDark3,
buttonPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
dropdownDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
items: [ items: [

View file

@ -654,7 +654,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
height: 24, height: 24,
), ),
Center( Center(
child: QrImage( child: QrImageView(
// 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,

View file

@ -768,7 +768,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImage( child: QrImageView(
data: trade.payInAddress, data: trade.payInAddress,
size: width, size: width,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)

View file

@ -369,7 +369,7 @@ class _PaynymDetailsPopupState extends ConsumerState<PaynymDetailsPopup> {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImage( QrImageView(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 100, size: 100,
data: widget.accountLite.code, data: widget.accountLite.code,

View file

@ -147,7 +147,7 @@ class PaynymQrPopup extends StatelessWidget {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImage( QrImageView(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 130, size: 130,
data: paynymAccount.nonSegwitPaymentCode.code, data: paynymAccount.nonSegwitPaymentCode.code,

View file

@ -356,7 +356,7 @@ class _PaynymDetailsPopupState extends ConsumerState<DesktopPaynymDetails> {
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
QrImage( QrImageView(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
size: 100, size: 100,
data: widget.accountLite.code, data: widget.accountLite.code,

View file

@ -77,7 +77,7 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImage( child: QrImageView(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
ref.watch(walletsChangeNotifierProvider.select( ref.watch(walletsChangeNotifierProvider.select(
(value) => (value) =>
@ -266,7 +266,7 @@ class _AddressDetailsViewState extends ConsumerState<AddressDetailsView> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImage( child: QrImageView(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
ref.watch(walletsChangeNotifierProvider.select( ref.watch(walletsChangeNotifierProvider.select(
(value) => (value) =>

View file

@ -126,7 +126,7 @@ class _AddressQrPopupState extends State<AddressQrPopup> {
Center( Center(
child: RepaintBoundary( child: RepaintBoundary(
key: _qrKey, key: _qrKey,
child: QrImage( child: QrImageView(
data: AddressUtils.buildUriString( data: AddressUtils.buildUriString(
widget.coin, widget.coin,
widget.addressString, widget.addressString,

View file

@ -201,7 +201,7 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImage( child: QrImageView(
data: uriString, data: uriString,
size: width, size: width,
backgroundColor: backgroundColor:
@ -543,7 +543,7 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
child: SizedBox( child: SizedBox(
width: 234, width: 234,
height: 234, height: 234,
child: QrImage( child: QrImageView(
data: _uriString, data: _uriString,
size: 220, size: 220,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)

View file

@ -320,7 +320,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
QrImage( QrImageView(
data: "${coin.uriScheme}:$receivingAddress", data: "${coin.uriScheme}:$receivingAddress",
size: MediaQuery.of(context).size.width / 2, size: MediaQuery.of(context).size.width / 2,
foregroundColor: Theme.of(context) foregroundColor: Theme.of(context)

View file

@ -183,32 +183,32 @@ class _EditCoinUnitsViewState extends ConsumerState<EditCoinUnitsView> {
} }
}, },
isExpanded: true, isExpanded: true,
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 12, Assets.svg.chevronDown,
height: 6, width: 12,
color: Theme.of(context) height: 6,
.extension<StackColors>()! color: Theme.of(context)
.textFieldActiveSearchIconRight, .extension<StackColors>()!
), .textFieldActiveSearchIconRight,
buttonPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
dropdownDecoration: BoxDecoration( dropdownStyleData: DropdownStyleData(
color: Theme.of(context) offset: const Offset(0, -10),
.extension<StackColors>()! elevation: 0,
.textFieldDefaultBG, decoration: BoxDecoration(
borderRadius: BorderRadius.circular( color: Theme.of(context)
Constants.size.circularBorderRadius, .extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
), ),
), ),
), ),

View file

@ -616,9 +616,7 @@ class _EditAutoBackupViewState extends ConsumerState<EditAutoBackupView> {
if (isDesktop) if (isDesktop)
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: DropdownButton2( child: DropdownButton2(
offset: const Offset(0, -10),
isExpanded: true, isExpanded: true,
dropdownElevation: 0,
value: _currentDropDownValue, value: _currentDropDownValue,
items: [ items: [
..._dropDownItems.map( ..._dropDownItems.map(
@ -662,30 +660,31 @@ class _EditAutoBackupViewState extends ConsumerState<EditAutoBackupView> {
}); });
} }
}, },
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 10, Assets.svg.chevronDown,
height: 5, width: 10,
color: Theme.of(context).extension<StackColors>()!.textDark3, height: 5,
), color:
buttonPadding: const EdgeInsets.symmetric( Theme.of(context).extension<StackColors>()!.textDark3,
horizontal: 16,
vertical: 8,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
dropdownDecoration: BoxDecoration( dropdownStyleData: DropdownStyleData(
color: Theme.of(context) offset: const Offset(0, -10),
.extension<StackColors>()! elevation: 0,
.textFieldDefaultBG, decoration: BoxDecoration(
borderRadius: BorderRadius.circular( color: Theme.of(context)
Constants.size.circularBorderRadius, .extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
), ),
), ),
), ),

View file

@ -243,7 +243,7 @@ class _XPub extends StatelessWidget {
builder: (child) => RoundedWhiteContainer( builder: (child) => RoundedWhiteContainer(
child: child, child: child,
), ),
child: QrImage( child: QrImageView(
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: foregroundColor:

View file

@ -168,7 +168,7 @@ class WalletBackupView extends ConsumerWidget {
child: SizedBox( child: SizedBox(
width: width + 20, width: width + 20,
height: width + 20, height: width + 20,
child: QrImage( child: QrImageView(
data: data, data: data,
size: width, size: width,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)

View file

@ -374,7 +374,7 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
height: 48, height: 48,
), ),
Center( Center(
child: QrImage( child: QrImageView(
// 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(desktopExchangeModelProvider data: ref.watch(desktopExchangeModelProvider

View file

@ -190,73 +190,47 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
.select((value) => value.getManager(walletId))); .select((value) => value.getManager(walletId)));
return FutureBuilder( return FutureBuilder(
future: manager.fees, future: manager.fees,
builder: (context, AsyncSnapshot<FeeObject> snapshot) { builder: (context, AsyncSnapshot<FeeObject> snapshot) {
if (snapshot.connectionState == ConnectionState.done && if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) { snapshot.hasData) {
feeObject = snapshot.data!; feeObject = snapshot.data!;
} }
return DropdownButtonHideUnderline( return DropdownButtonHideUnderline(
child: DropdownButton2( child: DropdownButton2(
offset: const Offset(0, -10), isExpanded: true,
isExpanded: true, value: ref.watch(feeRateTypeStateProvider.state).state,
dropdownElevation: 0, items: [
value: ref.watch(feeRateTypeStateProvider.state).state, ...FeeRateType.values.map(
// selectedItemBuilder: (s) { (e) => DropdownMenuItem(
// return [ value: e,
// ...FeeRateType.values.map( child: FeeDropDownChild(
// (e) => DropdownMenuItem( feeObject: feeObject,
// value: e, feeRateType: e,
// child: FeeDropDownChild( walletId: walletId,
// feeObject: feeObject, feeFor: feeFor,
// feeRateType: e, isSelected: false,
// walletId: walletId,
// amount: amount,
// feeFor: feeFor,
// isSelected: true,
// ),
// ),
// ),
// ];
// },
items: [
...FeeRateType.values.map(
(e) => DropdownMenuItem(
value: e,
child: FeeDropDownChild(
feeObject: feeObject,
feeRateType: e,
walletId: walletId,
feeFor: feeFor,
isSelected: false,
),
), ),
), ),
], ),
onChanged: (newRateType) { ],
if (newRateType is FeeRateType) { onChanged: (newRateType) {
ref.read(feeRateTypeStateProvider.state).state = newRateType; if (newRateType is FeeRateType) {
} ref.read(feeRateTypeStateProvider.state).state = newRateType;
}, }
},
iconStyleData: IconStyleData(
icon: SvgPicture.asset( icon: SvgPicture.asset(
Assets.svg.chevronDown, Assets.svg.chevronDown,
width: 12, width: 12,
height: 6, height: 6,
color: Theme.of(context).extension<StackColors>()!.textDark3, color: Theme.of(context).extension<StackColors>()!.textDark3,
), ),
buttonPadding: const EdgeInsets.symmetric( ),
horizontal: 16, dropdownStyleData: DropdownStyleData(
vertical: 8, offset: const Offset(0, -10),
), elevation: 0,
buttonDecoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
dropdownDecoration: BoxDecoration(
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.textFieldDefaultBG, .textFieldDefaultBG,
@ -265,8 +239,16 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
), ),
), ),
), ),
); menuItemStyleData: const MenuItemStyleData(
}); padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
),
),
);
},
);
} }
} }

View file

@ -219,7 +219,7 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
height: 32, height: 32,
), ),
Center( Center(
child: QrImage( child: QrImageView(
data: "${coin.uriScheme}:$receivingAddress", data: "${coin.uriScheme}:$receivingAddress",
size: 200, size: 200,
foregroundColor: foregroundColor:

View file

@ -869,9 +869,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
if (coin == Coin.firo) if (coin == Coin.firo)
DropdownButtonHideUnderline( DropdownButtonHideUnderline(
child: DropdownButton2( child: DropdownButton2(
offset: const Offset(0, -10),
isExpanded: true, isExpanded: true,
dropdownElevation: 0,
value: ref.watch(publicPrivateBalanceStateProvider.state).state, value: ref.watch(publicPrivateBalanceStateProvider.state).state,
items: [ items: [
DropdownMenuItem( DropdownMenuItem(
@ -929,30 +927,30 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
}); });
} }
}, },
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 12, Assets.svg.chevronDown,
height: 6, width: 12,
color: Theme.of(context).extension<StackColors>()!.textDark3, height: 6,
), color: Theme.of(context).extension<StackColors>()!.textDark3,
buttonPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
dropdownDecoration: BoxDecoration( dropdownStyleData: DropdownStyleData(
color: Theme.of(context) offset: const Offset(0, -10),
.extension<StackColors>()! elevation: 0,
.textFieldDefaultBG, decoration: BoxDecoration(
borderRadius: BorderRadius.circular( color: Theme.of(context)
Constants.size.circularBorderRadius, .extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
), ),
), ),
), ),

View file

@ -20,16 +20,16 @@ class QRCodeDesktopPopupContent extends StatelessWidget {
maxWidth: 614, maxWidth: 614,
child: Column( child: Column(
children: [ children: [
Row( const Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: const [ children: [
DesktopDialogCloseButton(), DesktopDialogCloseButton(),
], ],
), ),
const SizedBox( const SizedBox(
height: 14, height: 14,
), ),
QrImage( QrImageView(
data: value, data: value,
size: 300, size: 300,
foregroundColor: foregroundColor:

View file

@ -468,9 +468,7 @@ class _CreateAutoBackup extends ConsumerState<CreateAutoBackup> {
child: isDesktop child: isDesktop
? DropdownButtonHideUnderline( ? DropdownButtonHideUnderline(
child: DropdownButton2( child: DropdownButton2(
offset: const Offset(0, -10),
isExpanded: true, isExpanded: true,
dropdownElevation: 0,
value: _currentDropDownValue, value: _currentDropDownValue,
items: [ items: [
..._dropDownItems.map( ..._dropDownItems.map(
@ -515,32 +513,32 @@ class _CreateAutoBackup extends ConsumerState<CreateAutoBackup> {
}); });
} }
}, },
icon: SvgPicture.asset( iconStyleData: IconStyleData(
Assets.svg.chevronDown, icon: SvgPicture.asset(
width: 10, Assets.svg.chevronDown,
height: 5, width: 10,
color: Theme.of(context) height: 5,
.extension<StackColors>()! color: Theme.of(context)
.textDark3, .extension<StackColors>()!
), .textDark3,
buttonPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
buttonDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
), ),
), ),
dropdownDecoration: BoxDecoration( dropdownStyleData: DropdownStyleData(
color: Theme.of(context) offset: const Offset(0, -10),
.extension<StackColors>()! elevation: 0,
.textFieldDefaultBG, decoration: BoxDecoration(
borderRadius: BorderRadius.circular( color: Theme.of(context)
Constants.size.circularBorderRadius, .extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
),
menuItemStyleData: const MenuItemStyleData(
padding: EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
), ),
), ),
), ),