mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-25 19:55:52 +00:00
clean up buy form and add unstyled buy button
This commit is contained in:
parent
64662c9076
commit
bdfb1f0a20
1 changed files with 15 additions and 70 deletions
|
@ -20,6 +20,7 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
||||||
|
@ -74,9 +75,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
ref.watch(supportedSimplexCurrenciesProvider).supportedCryptos;
|
ref.watch(supportedSimplexCurrenciesProvider).supportedCryptos;
|
||||||
|
|
||||||
await _showFloatingCryptoSelectionSheet(
|
await _showFloatingCryptoSelectionSheet(
|
||||||
coins: supportedCoins,
|
coins: supportedCoins, onSelected: (_) {});
|
||||||
onSelected: (from) =>
|
|
||||||
ref.read(buyFormStateProvider).updateFrom(from, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showFloatingCryptoSelectionSheet({
|
Future<void> _showFloatingCryptoSelectionSheet({
|
||||||
|
@ -156,9 +155,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
ref.watch(supportedSimplexCurrenciesProvider).supportedFiats;
|
ref.watch(supportedSimplexCurrenciesProvider).supportedFiats;
|
||||||
|
|
||||||
await _showFloatingFiatSelectionSheet(
|
await _showFloatingFiatSelectionSheet(
|
||||||
fiats: supportedFiats,
|
fiats: supportedFiats, onSelected: (_) {});
|
||||||
onSelected: (from) =>
|
|
||||||
ref.read(buyFormStateProvider).updateFrom(from, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showFloatingFiatSelectionSheet({
|
Future<void> _showFloatingFiatSelectionSheet({
|
||||||
|
@ -236,48 +233,9 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
String? _fetchIconUrlFromTicker(String? ticker) {
|
String? _fetchIconUrlFromTicker(String? ticker) {
|
||||||
if (ticker == null) return null;
|
if (ticker == null) return null;
|
||||||
|
|
||||||
// Iterable<Crypto> possibleCurrencies;
|
|
||||||
//
|
|
||||||
// switch (ref.read(currentExchangeNameStateProvider.state).state) {
|
|
||||||
// case ChangeNowExchange.exchangeName:
|
|
||||||
// possibleCurrencies = ref
|
|
||||||
// .read(availableChangeNowCurrenciesProvider)
|
|
||||||
// .coins
|
|
||||||
// .where((e) => e.ticker.toUpperCase() == ticker.toUpperCase());
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// possibleCurrencies = [];
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (final Crypto in possibleCurrencies) {
|
|
||||||
// if (Crypto.image.isNotEmpty) {
|
|
||||||
// return Crypto.image;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWalletCoin(Coin? coin, bool isSend) {
|
|
||||||
if (coin == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String? ticker;
|
|
||||||
|
|
||||||
if (isSend) {
|
|
||||||
ticker = ref.read(buyFormStateProvider).fromTicker;
|
|
||||||
} else {
|
|
||||||
ticker = ref.read(buyFormStateProvider).toTicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticker == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return coin.ticker.toUpperCase() == ticker.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_receiveAddressController = TextEditingController();
|
_receiveAddressController = TextEditingController();
|
||||||
|
@ -760,31 +718,18 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// BuyTextField(
|
SizedBox(
|
||||||
// //)BuyCurrencySelect(
|
height: isDesktop ? 20 : 12,
|
||||||
// controller: _fiatController,
|
),
|
||||||
// focusNode: _fiatFocusNode,
|
PrimaryButton(
|
||||||
// textStyle: STextStyles.smallMed14(context).copyWith(
|
buttonHeight: isDesktop ? ButtonHeight.l : null,
|
||||||
// color: Theme.of(context).extension<StackColors>()!.textDark,
|
enabled: ref.watch(exchangeFormStateProvider
|
||||||
// ),
|
.select((value) => value.canExchange)),
|
||||||
// buttonColor:
|
onPressed: () {
|
||||||
// Theme.of(context).extension<StackColors>()!.buttonBackSecondary,
|
// TODO implement buy confirmation dialog
|
||||||
// borderRadius: Constants.size.circularBorderRadius,
|
},
|
||||||
// background:
|
label: "Exchange",
|
||||||
// Theme.of(context).extension<StackColors>()!.textFieldDefaultBG,
|
)
|
||||||
// onTap: () {
|
|
||||||
// if (_fiatController.text == "-") {
|
|
||||||
// _fiatController.text = "";
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// onChanged: fiatFieldOnChanged,
|
|
||||||
// onButtonTap: selectFiat,
|
|
||||||
// isWalletCoin: isWalletCoin(coin, true),
|
|
||||||
// image: _fetchIconUrlFromTicker(ref
|
|
||||||
// .watch(buyFormStateProvider.select((value) => value.fromTicker))),
|
|
||||||
// ticker: ref
|
|
||||||
// .watch(buyFormStateProvider.select((value) => value.fromTicker)),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue