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,
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 12,
height: 6,
color: Theme.of(context)
.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,
iconStyleData: IconStyleData(
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 12,
height: 6,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconRight,
),
),
dropdownDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
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: 8,
),
),
),

View file

@ -99,9 +99,25 @@ class _NewContactAddressEntryFormState
"Select cryptocurrency",
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,
dropdownElevation: 0,
value: ref.watch(addressEntryDataProvider(widget.id)
.select((value) => value.coin)),
onChanged: (value) {
@ -109,30 +125,12 @@ class _NewContactAddressEntryFormState
ref.read(addressEntryDataProvider(widget.id)).coin = value;
}
},
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 10,
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,
iconStyleData: IconStyleData(
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 10,
height: 5,
color: Theme.of(context).extension<StackColors>()!.textDark3,
),
),
items: [

View file

@ -654,7 +654,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
height: 24,
),
Center(
child: QrImage(
child: QrImageView(
// TODO: grab coin uri scheme from somewhere
// data: "${coin.uriScheme}:$receivingAddress",
data: model.trade!.payInAddress,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -183,32 +183,32 @@ class _EditCoinUnitsViewState extends ConsumerState<EditCoinUnitsView> {
}
},
isExpanded: true,
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 12,
height: 6,
color: Theme.of(context)
.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,
iconStyleData: IconStyleData(
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 12,
height: 6,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconRight,
),
),
dropdownDecoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
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: 8,
),
),
),

View file

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

View file

@ -243,7 +243,7 @@ class _XPub extends StatelessWidget {
builder: (child) => RoundedWhiteContainer(
child: child,
),
child: QrImage(
child: QrImageView(
data: xpub,
size: isDesktop ? 280 : MediaQuery.of(context).size.width / 1.5,
foregroundColor:

View file

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

View file

@ -374,7 +374,7 @@ class _StepScaffoldState extends ConsumerState<StepScaffold> {
height: 48,
),
Center(
child: QrImage(
child: QrImageView(
// TODO: grab coin uri scheme from somewhere
// data: "${coin.uriScheme}:$receivingAddress",
data: ref.watch(desktopExchangeModelProvider

View file

@ -190,73 +190,47 @@ class _DesktopFeeDropDownState extends ConsumerState<DesktopFeeDropDown> {
.select((value) => value.getManager(walletId)));
return FutureBuilder(
future: manager.fees,
builder: (context, AsyncSnapshot<FeeObject> snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
feeObject = snapshot.data!;
}
return DropdownButtonHideUnderline(
child: DropdownButton2(
offset: const Offset(0, -10),
isExpanded: true,
dropdownElevation: 0,
value: ref.watch(feeRateTypeStateProvider.state).state,
// selectedItemBuilder: (s) {
// return [
// ...FeeRateType.values.map(
// (e) => DropdownMenuItem(
// value: e,
// child: FeeDropDownChild(
// feeObject: feeObject,
// feeRateType: e,
// 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,
),
future: manager.fees,
builder: (context, AsyncSnapshot<FeeObject> snapshot) {
if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) {
feeObject = snapshot.data!;
}
return DropdownButtonHideUnderline(
child: DropdownButton2(
isExpanded: true,
value: ref.watch(feeRateTypeStateProvider.state).state,
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) {
ref.read(feeRateTypeStateProvider.state).state = newRateType;
}
},
),
],
onChanged: (newRateType) {
if (newRateType is FeeRateType) {
ref.read(feeRateTypeStateProvider.state).state = newRateType;
}
},
iconStyleData: IconStyleData(
icon: SvgPicture.asset(
Assets.svg.chevronDown,
width: 12,
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(
offset: const Offset(0, -10),
elevation: 0,
decoration: BoxDecoration(
color: Theme.of(context)
.extension<StackColors>()!
.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,
),
Center(
child: QrImage(
child: QrImageView(
data: "${coin.uriScheme}:$receivingAddress",
size: 200,
foregroundColor:

View file

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

View file

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

View file

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