当单击TextField并打开键盘时,会出现许多错误。然后单击下一步,Samsungsmartsuggesti ...不断停止出现

发布于 2025-02-10 06:16:09 字数 5010 浏览 2 评论 0原文

我尝试使用Textfield的简单页面,当我单击TextField时,出现这些错误(如果是错误),flutter医生没有问题,我正在使用Real Device,Samsung Galaxy A50(SM-A-A505F),

在此处输入图像描述“

这些出现,当我单击以编写Texfield时,如果我写的话,每个字符出现错误

”

然后,如果我单击下一步't甚至需要单击下一步

”输入映像在此处“

“在此处输入图像说明”

loginview和自定义textfield,

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:shopping/core/constants/padding/padding_constants.dart';
import 'package:shopping/core/constants/textstyle/text_styles.dart';
import 'package:shopping/core/init/translations/locale_keys.g.dart';
import 'package:shopping/product/widget/textfield/custom_textfield.dart';

class LoginView extends StatefulWidget {
  const LoginView({Key? key}) : super(key: key);

  @override
  State<LoginView> createState() => _LoginViewState();
}

class _LoginViewState extends State<LoginView> {
  //Controllers
  late final TextEditingController _emailController;
  // FocusNodes
  late final FocusNode _emailFocusNode;
  @override
  void initState() {
    super.initState();

    _emailController = TextEditingController();
    _emailFocusNode = FocusNode();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        appBar: AppBar(
          backgroundColor: Colors.transparent,
          elevation: 0,
        ),
        body: Column(
          children: [
            Text(
              LocaleKeys.login.tr(),
              style: TextStylesConstants.titleTextStyle,
            ),
            Padding(
              padding: PaddingConstants.onlyTopSmall,
              child: Text(
                LocaleKeys.addYourDetailsToLogin.tr(),
                style: Theme.of(context).textTheme.subtitle1,
              ),
            ),
            Padding(
              padding: PaddingConstants.onlyTopMedium,
              child: CustomTextField(
                controller: _emailController,
                focusNode: _emailFocusNode,
                keyboardType: TextInputType.emailAddress,
                hintText: LocaleKeys.yourEmail.tr(),
              ),
            ),
          ],
        ),
      ),
    );
  }
}



class CustomTextField extends StatelessWidget {
  const CustomTextField(
      {Key? key, required this.controller, this.focusNode, required this.keyboardType, required this.hintText})
      : super(key: key);
  final TextEditingController controller;
  final FocusNode? focusNode;
  final TextInputType keyboardType;
  final String hintText;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: context.dynamicWidth(0.9),
        height: context.dynamicHeight(0.069),
        decoration: const BoxDecoration(
          color: ColorConstants.textFieldColor,
          borderRadius: BorderRadius.all(
            Radius.circular(90),
          ),
        ),
        child: Center(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 24.0),
            child: TextField(
              textInputAction: TextInputAction.next,
              cursorColor: ColorConstants.brightOrange,
              cursorRadius: const Radius.circular(45),
              controller: controller,
              focusNode: focusNode,
              keyboardType: keyboardType,
              decoration: InputDecoration(
                focusedBorder: const OutlineInputBorder(
                  borderSide: BorderSide(color: ColorConstants.textFieldColor),
                ),
                enabledBorder: const UnderlineInputBorder(
                  borderSide: BorderSide(
                    color: ColorConstants.textFieldColor,
                  ),
                ),
                hintText: hintText,
                hintStyle: TextStylesConstants.textFieldTextStyle,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

https://github.com/flutter/flutter/flutter/flutter/flutter/sissues/98505#issuecomment-1067976038 错误

I try to simple page with textfield, when I click textfield, these errors appears(If they are errors), Flutter doctor no issues, I am working with real device,Samsung Galaxy A50 (SM-A505F),

enter image description here

enter image description here

These ones appear, when I just clicked to write texfield, then If I write, a error appears for each character

enter image description here

then If I click next, sometimes I don't even need to click next

enter image description here

enter image description here

LoginView, And Custom TextField,

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:shopping/core/constants/padding/padding_constants.dart';
import 'package:shopping/core/constants/textstyle/text_styles.dart';
import 'package:shopping/core/init/translations/locale_keys.g.dart';
import 'package:shopping/product/widget/textfield/custom_textfield.dart';

class LoginView extends StatefulWidget {
  const LoginView({Key? key}) : super(key: key);

  @override
  State<LoginView> createState() => _LoginViewState();
}

class _LoginViewState extends State<LoginView> {
  //Controllers
  late final TextEditingController _emailController;
  // FocusNodes
  late final FocusNode _emailFocusNode;
  @override
  void initState() {
    super.initState();

    _emailController = TextEditingController();
    _emailFocusNode = FocusNode();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        appBar: AppBar(
          backgroundColor: Colors.transparent,
          elevation: 0,
        ),
        body: Column(
          children: [
            Text(
              LocaleKeys.login.tr(),
              style: TextStylesConstants.titleTextStyle,
            ),
            Padding(
              padding: PaddingConstants.onlyTopSmall,
              child: Text(
                LocaleKeys.addYourDetailsToLogin.tr(),
                style: Theme.of(context).textTheme.subtitle1,
              ),
            ),
            Padding(
              padding: PaddingConstants.onlyTopMedium,
              child: CustomTextField(
                controller: _emailController,
                focusNode: _emailFocusNode,
                keyboardType: TextInputType.emailAddress,
                hintText: LocaleKeys.yourEmail.tr(),
              ),
            ),
          ],
        ),
      ),
    );
  }
}



class CustomTextField extends StatelessWidget {
  const CustomTextField(
      {Key? key, required this.controller, this.focusNode, required this.keyboardType, required this.hintText})
      : super(key: key);
  final TextEditingController controller;
  final FocusNode? focusNode;
  final TextInputType keyboardType;
  final String hintText;

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: context.dynamicWidth(0.9),
        height: context.dynamicHeight(0.069),
        decoration: const BoxDecoration(
          color: ColorConstants.textFieldColor,
          borderRadius: BorderRadius.all(
            Radius.circular(90),
          ),
        ),
        child: Center(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 24.0),
            child: TextField(
              textInputAction: TextInputAction.next,
              cursorColor: ColorConstants.brightOrange,
              cursorRadius: const Radius.circular(45),
              controller: controller,
              focusNode: focusNode,
              keyboardType: keyboardType,
              decoration: InputDecoration(
                focusedBorder: const OutlineInputBorder(
                  borderSide: BorderSide(color: ColorConstants.textFieldColor),
                ),
                enabledBorder: const UnderlineInputBorder(
                  borderSide: BorderSide(
                    color: ColorConstants.textFieldColor,
                  ),
                ),
                hintText: hintText,
                hintStyle: TextStylesConstants.textFieldTextStyle,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

https://github.com/flutter/flutter/issues/98505#issuecomment-1067976038 this one must fix SamsungSmartSugges.... keepsstopping, but rest of errors still error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情域 2025-02-17 06:16:10

textfield-&gt; textformfield

用表单包裹所有TextFormField,并给出一个键

https:// https://docs.flutter.dev/cookbook /表格/验证

Form(
              key: formKey,
              child: Column(
                children: [
                  const Text(
                    'Please log in to your account in order to interact with and create notes and talk friends',
                  ),
                  EmailTextFormField(emailController: emailController),
                  PasswordTextFormField(passwordController: passwordController),
                  LoginButton(emailController: emailController, passwordController: passwordController),
                  const ForgotPasswordButton(),
                  const SignInWithGoogleButton(),
                  const NotRegisterYetButton()
                ],
              ),
            ),

TextField --> TextFormField

wrap all TextFormField with a Form and give a key

https://docs.flutter.dev/cookbook/forms/validation

Form(
              key: formKey,
              child: Column(
                children: [
                  const Text(
                    'Please log in to your account in order to interact with and create notes and talk friends',
                  ),
                  EmailTextFormField(emailController: emailController),
                  PasswordTextFormField(passwordController: passwordController),
                  LoginButton(emailController: emailController, passwordController: passwordController),
                  const ForgotPasswordButton(),
                  const SignInWithGoogleButton(),
                  const NotRegisterYetButton()
                ],
              ),
            ),
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文