mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
Reformat the whole codebase with 100 line width (#3403)
This commit is contained in:
@@ -25,8 +25,7 @@ class CakePayAccountPage extends BasePage {
|
||||
label: S.of(context).seed_alert_back,
|
||||
child: TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor: WidgetStateColor.resolveWith(
|
||||
(states) => Colors.transparent),
|
||||
overlayColor: WidgetStateColor.resolveWith((states) => Colors.transparent),
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: backButton(context),
|
||||
@@ -41,10 +40,10 @@ class CakePayAccountPage extends BasePage {
|
||||
Widget middle(BuildContext context) {
|
||||
return Text(
|
||||
S.current.account,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,9 +65,7 @@ class CakePayAccountPage extends BasePage {
|
||||
),
|
||||
),
|
||||
child: CakePayTile(
|
||||
title: S.of(context).email_address,
|
||||
subTitle: cakePayAccountViewModel.email
|
||||
),
|
||||
title: S.of(context).email_address, subTitle: cakePayAccountViewModel.email),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -146,9 +146,7 @@ class CakePayVerifyOtpPage extends BasePage {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void _onOtpSuccessful(BuildContext context) =>
|
||||
Navigator.pop(context, true);
|
||||
void _onOtpSuccessful(BuildContext context) => Navigator.pop(context, true);
|
||||
|
||||
void _verify() async => await _authViewModel.verifyEmail(_codeController.text);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ class UserCakePayCardsStateFailure extends UserCakePayCardsState {
|
||||
|
||||
class UserCakePayCardsStateSuccess extends UserCakePayCardsState {}
|
||||
|
||||
|
||||
abstract class CakePayVendorState {}
|
||||
|
||||
class InitialCakePayVendorLoadingState extends CakePayVendorState {}
|
||||
|
||||
@@ -360,7 +360,8 @@ class CakePayBuyCardPage extends BasePage {
|
||||
},
|
||||
text: S.of(context).purchase_gift_card,
|
||||
isDisabled: !cakePayBuyCardViewModel.isAmountSufficient ||
|
||||
cakePayBuyCardViewModel.isPurchasing || _sendViewModel.state is ExecutedSuccessfullyState,
|
||||
cakePayBuyCardViewModel.isPurchasing ||
|
||||
_sendViewModel.state is ExecutedSuccessfullyState,
|
||||
isLoading: _sendViewModel.state is IsExecutingState ||
|
||||
cakePayBuyCardViewModel.isPurchasing,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
@@ -585,8 +586,7 @@ class CakePayBuyCardPage extends BasePage {
|
||||
.map((o) => o.OutputCopyWithParsedAddress(
|
||||
parsedAddress: ParsedAddress(
|
||||
parsedAddressByCurrencyMap: {
|
||||
cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency:
|
||||
o.address,
|
||||
cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency: o.address,
|
||||
},
|
||||
handle: 'Cake Pay',
|
||||
profileName: order?.cards.first.cardName ?? 'Cake Pay',
|
||||
@@ -613,13 +613,13 @@ class CakePayBuyCardPage extends BasePage {
|
||||
titleIconPath: _sendViewModel.selectedCryptoCurrency.iconPath,
|
||||
currency: _sendViewModel.selectedCryptoCurrency,
|
||||
amount: S.of(bottomSheetContext).send_amount,
|
||||
amountValue: _sendViewModel.amountParsingProxy.asDisplayStringWithSymbol(
|
||||
_sendViewModel.pendingTransaction!.amount),
|
||||
amountValue: _sendViewModel.amountParsingProxy
|
||||
.asDisplayStringWithSymbol(_sendViewModel.pendingTransaction!.amount),
|
||||
quantity: 'QTY: ${cakePayBuyCardViewModel.quantity}',
|
||||
fiatAmountValue: _sendViewModel.pendingTransactionFiatAmountFormatted,
|
||||
fee: S.of(bottomSheetContext).send_fee,
|
||||
feeValue: _sendViewModel.amountParsingProxy.asDisplayStringWithSymbol(
|
||||
_sendViewModel.pendingTransaction!.fee),
|
||||
feeValue: _sendViewModel.amountParsingProxy
|
||||
.asDisplayStringWithSymbol(_sendViewModel.pendingTransaction!.fee),
|
||||
feeFiatAmount: _sendViewModel.pendingTransactionFeeFiatAmountFormatted,
|
||||
outputs: displayingOutputs,
|
||||
footerType: FooterType.slideActionButton,
|
||||
@@ -657,8 +657,7 @@ class CakePayBuyCardPage extends BasePage {
|
||||
.map((o) => o.OutputCopyWithParsedAddress(
|
||||
parsedAddress: ParsedAddress(
|
||||
parsedAddressByCurrencyMap: {
|
||||
cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency:
|
||||
o.address,
|
||||
cakePayBuyCardViewModel.sendViewModel.selectedCryptoCurrency: o.address,
|
||||
},
|
||||
handle: 'Cake Pay',
|
||||
profileName: order?.cards.first.cardName ?? 'Cake Pay',
|
||||
|
||||
@@ -92,7 +92,9 @@ class CakePayCardsPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return KeyboardHideOverlay(child:CakePayCardsPageBody(cardsListViewModel: _cardsListViewModel, titleColor: titleColor));
|
||||
return KeyboardHideOverlay(
|
||||
child:
|
||||
CakePayCardsPageBody(cardsListViewModel: _cardsListViewModel, titleColor: titleColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,11 @@ class CakePayCard {
|
||||
final parsedMinValueLocal = _toDouble(json['min_value']);
|
||||
final parsedMinValueUsd = _toDouble(json['min_value_usd']);
|
||||
|
||||
if (parsedMinValueLocal != null && parsedMinValueLocal > 0 && parsedMinValueUsd != null && parsedMinValueUsd > 0 && parsedMinValueUsd < 10.0) {
|
||||
if (parsedMinValueLocal != null &&
|
||||
parsedMinValueLocal > 0 &&
|
||||
parsedMinValueUsd != null &&
|
||||
parsedMinValueUsd > 0 &&
|
||||
parsedMinValueUsd < 10.0) {
|
||||
final rate = parsedMinValueLocal / parsedMinValueUsd;
|
||||
final minLocalValueLimit = 10.0 * rate;
|
||||
minValue = minLocalValueLimit.toStringAsFixed(2);
|
||||
@@ -80,6 +84,7 @@ class CakePayCard {
|
||||
static String stripHtmlIfNeeded(String text) {
|
||||
return text.replaceAll(RegExp(r'<[^>]*>|&[^;]+;'), ' ');
|
||||
}
|
||||
|
||||
static double? _toDouble(dynamic v) {
|
||||
if (v == null) return null;
|
||||
if (v is num) return v.toDouble();
|
||||
|
||||
@@ -37,15 +37,12 @@ class CakePayOrder {
|
||||
});
|
||||
|
||||
factory CakePayOrder.fromMap(Map<String, dynamic> map) {
|
||||
|
||||
final cards = map['cards'] as List<dynamic>;
|
||||
final firstCard = cards.isNotEmpty ? cards.first as Map<String, dynamic> : {};
|
||||
|
||||
return CakePayOrder(
|
||||
orderId: map['order_id'] as String,
|
||||
cards: cards
|
||||
.map((x) => OrderCard.fromMap(x as Map<String, dynamic>))
|
||||
.toList(),
|
||||
cards: cards.map((x) => OrderCard.fromMap(x as Map<String, dynamic>)).toList(),
|
||||
externalId: map['external_id'] as String?,
|
||||
amountUsd: map['amount_usd'] as double,
|
||||
totalReceiveAmount: firstCard['subtotal'] as String? ?? '',
|
||||
@@ -56,7 +53,7 @@ class CakePayOrder {
|
||||
paymentData: PaymentData.fromMap(map['payment_data'] as Map<String, dynamic>));
|
||||
}
|
||||
|
||||
static CryptoPaymentData? getPaymentDataFor({CakePayPaymentMethod? method,CakePayOrder? order}) {
|
||||
static CryptoPaymentData? getPaymentDataFor({CakePayPaymentMethod? method, CakePayOrder? order}) {
|
||||
if (order == null || method == null) return null;
|
||||
|
||||
final data = switch (method) {
|
||||
@@ -76,7 +73,8 @@ class CakePayOrder {
|
||||
final addr = uri.path;
|
||||
final price = uri.queryParameters['amount'] ?? data.price;
|
||||
|
||||
return CryptoPaymentData(price: price, address: addr, amount: data.amount, paymentUrls: data.paymentUrls);
|
||||
return CryptoPaymentData(
|
||||
price: price, address: addr, amount: data.amount, paymentUrls: data.paymentUrls);
|
||||
}
|
||||
|
||||
return data;
|
||||
@@ -151,12 +149,21 @@ class PaymentData {
|
||||
|
||||
factory PaymentData.fromMap(Map<String, dynamic> map) {
|
||||
return PaymentData(
|
||||
btc: map['BTC'] != null ? CryptoPaymentData.fromMap(map['BTC'] as Map<String, dynamic>) : null,
|
||||
btc_ln: map['BTC_LN'] != null ? CryptoPaymentData.fromMap(map['BTC_LN'] as Map<String, dynamic>) : null,
|
||||
xmr: map['XMR'] != null ? CryptoPaymentData.fromMap(map['XMR'] as Map<String, dynamic>) : null,
|
||||
ltc: map['LTC'] != null ? CryptoPaymentData.fromMap(map['LTC'] as Map<String, dynamic>) : null,
|
||||
ltc_mweb: map['LTC_MWEB'] != null ? CryptoPaymentData.fromMap(map['LTC_MWEB'] as Map<String, dynamic>) : null,
|
||||
zec: map['ZEC_CHAIN'] != null ? CryptoPaymentData.fromMap(map['ZEC_CHAIN'] as Map<String, dynamic>) : null,
|
||||
btc:
|
||||
map['BTC'] != null ? CryptoPaymentData.fromMap(map['BTC'] as Map<String, dynamic>) : null,
|
||||
btc_ln: map['BTC_LN'] != null
|
||||
? CryptoPaymentData.fromMap(map['BTC_LN'] as Map<String, dynamic>)
|
||||
: null,
|
||||
xmr:
|
||||
map['XMR'] != null ? CryptoPaymentData.fromMap(map['XMR'] as Map<String, dynamic>) : null,
|
||||
ltc:
|
||||
map['LTC'] != null ? CryptoPaymentData.fromMap(map['LTC'] as Map<String, dynamic>) : null,
|
||||
ltc_mweb: map['LTC_MWEB'] != null
|
||||
? CryptoPaymentData.fromMap(map['LTC_MWEB'] as Map<String, dynamic>)
|
||||
: null,
|
||||
zec: map['ZEC_CHAIN'] != null
|
||||
? CryptoPaymentData.fromMap(map['ZEC_CHAIN'] as Map<String, dynamic>)
|
||||
: null,
|
||||
invoiceTime: DateTime.fromMillisecondsSinceEpoch(map['invoice_time'] as int),
|
||||
expirationTime: DateTime.fromMillisecondsSinceEpoch(map['expiration_time'] as int),
|
||||
commission: map['commission'] as int?,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class CakePayUserCredentials {
|
||||
const CakePayUserCredentials(this.username, this.token);
|
||||
const CakePayUserCredentials(this.username, this.token);
|
||||
|
||||
final String username;
|
||||
final String token;
|
||||
}
|
||||
final String username;
|
||||
final String token;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class CakePayTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
@@ -27,16 +27,16 @@ class CakePayTile extends StatelessWidget {
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
subTitle,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
color: colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -65,18 +65,18 @@ class _DenominationsAmountWidgetState extends State<DenominationsAmountWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DropdownFilterList(
|
||||
items: widget.denominations
|
||||
.map((e) => e.value.toString())
|
||||
.toList(),
|
||||
items: widget.denominations.map((e) => e.value.toString()).toList(),
|
||||
itemPrefix: widget.fiatCurrency,
|
||||
selectedItem: _selected.$1,
|
||||
onItemSelected: (value) {
|
||||
setState(() => _selected = (value, widget.denominations
|
||||
.firstWhere((e) => e.value.toString() == value)
|
||||
.cardId));
|
||||
setState(() => _selected = (
|
||||
value,
|
||||
widget.denominations.firstWhere((e) => e.value.toString() == value).cardId
|
||||
));
|
||||
widget.amountController.text = value;
|
||||
widget.onAmountChanged(value);
|
||||
widget.cakePayBuyCardViewModel.selectedDenomination = (_selected.$1, _selected.$2);
|
||||
widget.cakePayBuyCardViewModel.selectedDenomination =
|
||||
(_selected.$1, _selected.$2);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
@@ -59,12 +59,11 @@ class EnterAmountWidget extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('QTY ', style: Theme.of(context).textTheme.titleMedium!),
|
||||
Text(
|
||||
'1',
|
||||
style: Theme.of(context).textTheme
|
||||
.titleMedium!
|
||||
.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant)
|
||||
),
|
||||
Text('1',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -87,12 +86,12 @@ class EnterAmountWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(S.of(context).min_amount(minValue) + ' $fiatCurrency',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
)),
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
)),
|
||||
Text(S.of(context).max_amount(maxValue) + ' $fiatCurrency',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
)),
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
)),
|
||||
],
|
||||
),
|
||||
Spacer(flex: 1),
|
||||
|
||||
@@ -21,7 +21,7 @@ class FlipCard extends StatefulWidget {
|
||||
|
||||
class FlipCardState extends State<FlipCard> with SingleTickerProviderStateMixin {
|
||||
late final AnimationController _ctrl =
|
||||
AnimationController(vsync: this, duration: widget.duration);
|
||||
AnimationController(vsync: this, duration: widget.duration);
|
||||
bool _isFront = true;
|
||||
|
||||
void toggleCard() {
|
||||
@@ -45,18 +45,17 @@ class FlipCardState extends State<FlipCard> with SingleTickerProviderStateMixin
|
||||
transform: Matrix4.identity()
|
||||
..setEntry(3, 2, 0.001)
|
||||
..rotateY(angle),
|
||||
child: isFront ? widget.front
|
||||
child: isFront
|
||||
? widget.front
|
||||
: Transform(
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.rotationY(math.pi),
|
||||
child: widget.back,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.rotationY(math.pi),
|
||||
child: widget.back,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return widget.flipOnTouch
|
||||
? GestureDetector(onTap: toggleCard, child: content)
|
||||
: content;
|
||||
return widget.flipOnTouch ? GestureDetector(onTap: toggleCard, child: content) : content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class ClickableLinksText extends StatelessWidget {
|
||||
text: url,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontSize: 18,
|
||||
fontSize: 18,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
|
||||
@@ -14,16 +14,15 @@ class RoundedOverlayCards extends StatelessWidget {
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
return ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.only(bottomLeft: Radius.circular(25.0), bottomRight: Radius.circular(25.0)),
|
||||
BorderRadius.only(bottomLeft: Radius.circular(25.0), bottomRight: Radius.circular(25.0)),
|
||||
child: Container(
|
||||
height: screenHeight * 0.50,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer
|
||||
),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24),
|
||||
),
|
||||
color: Theme.of(context).colorScheme.surfaceContainer),
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
@@ -44,4 +43,4 @@ class RoundedOverlayCards extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class ThreeCheckboxAlert extends BaseAlertDialog {
|
||||
|
||||
@override
|
||||
VoidCallback get actionRight => () {
|
||||
actionRightButton(checkbox1, checkbox2, checkbox3);
|
||||
};
|
||||
actionRightButton(checkbox1, checkbox2, checkbox3);
|
||||
};
|
||||
|
||||
@override
|
||||
bool get barrierDismissible => alertBarrierDismissible;
|
||||
@@ -87,13 +87,13 @@ class ThreeCheckboxAlertContent extends StatefulWidget {
|
||||
|
||||
@override
|
||||
_ThreeCheckboxAlertContentState createState() => _ThreeCheckboxAlertContentState(
|
||||
checkbox1: checkbox1,
|
||||
toggleCheckbox1: toggleCheckbox1,
|
||||
checkbox2: checkbox2,
|
||||
toggleCheckbox2: toggleCheckbox2,
|
||||
checkbox3: checkbox3,
|
||||
toggleCheckbox3: toggleCheckbox3,
|
||||
);
|
||||
checkbox1: checkbox1,
|
||||
toggleCheckbox1: toggleCheckbox1,
|
||||
checkbox2: checkbox2,
|
||||
toggleCheckbox2: toggleCheckbox2,
|
||||
checkbox3: checkbox3,
|
||||
toggleCheckbox3: toggleCheckbox3,
|
||||
);
|
||||
|
||||
static _ThreeCheckboxAlertContentState? of(BuildContext context) {
|
||||
return context.findAncestorStateOfType<_ThreeCheckboxAlertContentState>();
|
||||
|
||||
@@ -2,12 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'image_placeholder.dart';
|
||||
|
||||
class UserCardItem extends StatelessWidget {
|
||||
UserCardItem({
|
||||
required this.title,
|
||||
required this.subTitle,
|
||||
this.onTap,
|
||||
this.logoUrl
|
||||
});
|
||||
UserCardItem({required this.title, required this.subTitle, this.onTap, this.logoUrl});
|
||||
|
||||
final VoidCallback? onTap;
|
||||
final String title;
|
||||
@@ -80,4 +75,4 @@ class UserCardItem extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user