0

你好朋友我一个月以来一直在尝试解决这个问题但我几乎无法尝试所有内容并搜索每个地方但我找不到任何解决方案所以我在这里寻求你的帮助我想建立一个登录屏幕但我的输入文本给出我有很多警告,我不知道我做错了什么

import 'package:chat_app/screens/LoginScreen/widgets/login_button.dart';
import 'package:chat_app/screens/utilsscreen/forgetPasswordScreen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class TextFields extends StatefulWidget {
 static GlobalKey<FormState> formKey = GlobalKey<FormState>();

 @override
 _TextFieldsState createState() => _TextFieldsState();
}

class _TextFieldsState extends State<TextFields> {
 var passwordController = TextEditingController();
 var emailController = TextEditingController();

 @override
 Widget build(BuildContext context) {
   return Container(
     margin: const EdgeInsets.only(top: 10),
     child: Form(
       key: TextFields.formKey,
       child: Column(
         crossAxisAlignment: CrossAxisAlignment.start,
         children: [
           TextFormField(
               validator: (val) {
                 if (!GetUtils.isEmail(val)) {
                   return "please enter a valid email";
                 } else
                   return null;
               },
               controller: emailController,
               keyboardType: TextInputType.emailAddress,
               style:
                   TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
               cursorColor: Colors.black,
               decoration: InputDecoration(
                   prefixIcon: Icon(Icons.email),
                   labelText: "Email",
                   enabledBorder:
                       Theme.of(context).inputDecorationTheme.disabledBorder,
                   border: OutlineInputBorder(
                       borderRadius: BorderRadius.circular(15)))),
           SizedBox(
             height: 30,
           ),
           TextFormField(
               validator: (val) {
                 if (val.length < 8) {
                   return "please enter correct password";
                 } else
                   return null;
               },
               controller: passwordController,
               obscureText: true,
               autocorrect: false,
               enableSuggestions: false,
               keyboardType: TextInputType.visiblePassword,
               style:
                   TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
               cursorColor: Colors.black,
               decoration: InputDecoration(
                   prefixIcon: Icon(Icons.lock),
                   labelText: "Password",
                   enabledBorder:
                       Theme.of(context).inputDecorationTheme.disabledBorder,
                   border: OutlineInputBorder(
                       borderSide: BorderSide(width: 2),
                       borderRadius: BorderRadius.circular(15)))),
           SizedBox(
             height: 20,
           ),
           TextButton(
             child: Text("Forget Password?",
                 style: Theme.of(context).textTheme.bodyText1),
             onPressed: () {
               Get.to(ForgetPassword());
             },
           ),
           SizedBox(
             height: 15,
           ),
           Center(child: LoginButton(chekValidation))
         ],
       ),
     ),
   );
 }

 void chekValidation() {
   if (TextFields.formKey.currentState.validate()) {
     submit();
   }
 }

 void submit() {
   Get.find<LoginController>()
       .login(emailController.text, passwordController.text);
 }
}
    ```


here are these error I am getting I hope this will help you to find a solution and I also want to know should take this warning serious or ignore them 
```    W/IInputConnectionWrapper( 8858): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 8858): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 8858): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 8858): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 8858): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 8858): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 8858): endBatchEdit on inactive InputConnection
   ```
4

0 回答 0