mac desktop keyboard type crash fix

This commit is contained in:
julian 2022-12-30 11:36:00 -06:00
parent c42ea26a3b
commit 4b58f3ec60
6 changed files with 44 additions and 28 deletions

View file

@ -409,8 +409,9 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
height: 1.8, height: 1.8,
) )
: STextStyles.field(context), : STextStyles.field(context),
keyboardType: keyboardType: Util.isDesktop
const TextInputType.numberWithOptions(decimal: true), ? null
: const TextInputType.numberWithOptions(decimal: true),
onChanged: (_) => setState(() {}), onChanged: (_) => setState(() {}),
decoration: standardInputDecoration( decoration: standardInputDecoration(
"Amount", "Amount",

View file

@ -1111,7 +1111,9 @@ class _SendViewState extends ConsumerState<SendView> {
const Key("amountInputFieldCryptoTextFieldKey"), const Key("amountInputFieldCryptoTextFieldKey"),
controller: cryptoAmountController, controller: cryptoAmountController,
focusNode: _cryptoFocus, focusNode: _cryptoFocus,
keyboardType: const TextInputType.numberWithOptions( keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),
@ -1168,8 +1170,9 @@ class _SendViewState extends ConsumerState<SendView> {
const Key("amountInputFieldFiatTextFieldKey"), const Key("amountInputFieldFiatTextFieldKey"),
controller: baseAmountController, controller: baseAmountController,
focusNode: _baseFocus, focusNode: _baseFocus,
keyboardType: keyboardType: Util.isDesktop
const TextInputType.numberWithOptions( ? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),

View file

@ -391,7 +391,8 @@ class _EpiBoxInfoFormState extends ConsumerState<EpicBoxInfoForm> {
enableSuggestions: Util.isDesktop ? false : true, enableSuggestions: Util.isDesktop ? false : true,
controller: portController, controller: portController,
decoration: const InputDecoration(hintText: "Port"), decoration: const InputDecoration(hintText: "Port"),
keyboardType: const TextInputType.numberWithOptions(), keyboardType:
Util.isDesktop ? null : const TextInputType.numberWithOptions(),
), ),
const SizedBox( const SizedBox(
height: 8, height: 8,

View file

@ -739,7 +739,9 @@ class _TransactionSearchViewState
controller: _amountTextEditingController, controller: _amountTextEditingController,
focusNode: amountTextFieldFocusNode, focusNode: amountTextFieldFocusNode,
onChanged: (_) => setState(() {}), onChanged: (_) => setState(() {}),
keyboardType: const TextInputType.numberWithOptions( keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),

View file

@ -1002,7 +1002,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
key: const Key("amountInputFieldCryptoTextFieldKey"), key: const Key("amountInputFieldCryptoTextFieldKey"),
controller: cryptoAmountController, controller: cryptoAmountController,
focusNode: _cryptoFocus, focusNode: _cryptoFocus,
keyboardType: const TextInputType.numberWithOptions( keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),
@ -1056,7 +1058,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
key: const Key("amountInputFieldFiatTextFieldKey"), key: const Key("amountInputFieldFiatTextFieldKey"),
controller: baseAmountController, controller: baseAmountController,
focusNode: _baseFocus, focusNode: _baseFocus,
keyboardType: const TextInputType.numberWithOptions( keyboardType: Util.isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),

View file

@ -4,6 +4,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/loading_indicator.dart'; import 'package:stackwallet/widgets/loading_indicator.dart';
class ExchangeTextField extends StatefulWidget { class ExchangeTextField extends StatefulWidget {
@ -62,6 +63,8 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
late final void Function(String)? onChanged; late final void Function(String)? onChanged;
late final void Function(String)? onSubmitted; late final void Function(String)? onSubmitted;
final isDesktop = Util.isDesktop;
@override @override
void initState() { void initState() {
borderRadius = widget.borderRadius; borderRadius = widget.borderRadius;
@ -100,7 +103,9 @@ class _ExchangeTextFieldState extends State<ExchangeTextField> {
enableSuggestions: false, enableSuggestions: false,
autocorrect: false, autocorrect: false,
readOnly: widget.readOnly, readOnly: widget.readOnly,
keyboardType: const TextInputType.numberWithOptions( keyboardType: isDesktop
? null
: const TextInputType.numberWithOptions(
signed: false, signed: false,
decimal: true, decimal: true,
), ),