I implement textformfield
in form . I run in android emulator when I click text field,keyboard show and close instantly and get error . In iOS emulator run perfectly only error in Android.error screen record
When I try delete form and convert textformfield
to formfield
it works perfectly. I think there are android error about form. What can I do?
Error:
W/IInputConnectionWrapper(10839): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(10839): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(10839): getTextAfterCursor on inactive InputConnection W/IInputConnectionWrapper(10839): beginBatchEdit on inactive InputConnection W/IInputConnectionWrapper(10839): endBatchEdit on inactive InputConnection
Form:
SingleChildScrollView(
child: Form(
key: formKey,
child: Column(
children: <Widget>[
SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: entryField(
title: "Haber Başlığı(Zorunlu)",
textEditingController: headerController,
faIcon: FaIcon(
FontAwesomeIcons.horseHead,
color: Colors.deepOrange,
size: 30,
)),
),
lineDivider(),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: entryField(
title: "Haber İçeriği(Zorunlu)",
textEditingController: descController,
faIcon: FaIcon(
FontAwesomeIcons.userNinja,
color: Colors.deepOrange,
size: 30,
)),
),
lineDivider(),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: entryField(
title: "Youtube Linki",
textEditingController: youtubeController,
faIcon: FaIcon(
FontAwesomeIcons.youtube,
color: Colors.deepOrange,
size: 30,
)),
),
lineDivider(),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: entryField(
title: "Diğer Linkler",
textEditingController: otherController,
faIcon: FaIcon(
FontAwesomeIcons.slack,
color: Colors.deepOrange,
size: 30,
)),
),
],
),
),
),
Textformfield:
Widget entryField(
{String title,
TextEditingController textEditingController,
FaIcon faIcon}) {
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: GoogleFonts.righteous(
color: Colors.deepOrange,
fontWeight: FontWeight.bold,
fontSize: 20),
),
SizedBox(
height: 10,
),
TextFormField(
validator: (e) {
String yazilacak;
if (title == "Haber Başlığı(Zorunlu)") {
if (e.isEmpty) yazilacak = "Lütfen Başlığı giriniz";
}
if (title == "Haber İçeriği(Zorunlu)") {
if (e.isEmpty) yazilacak = "Lütfen içeriği giriniz";
}
if (title == "Youtube Linki") {
if (e != "" && !e.contains("youtube")) {
if (!e.contains("youtu.be"))
if(!e.contains("https"))
yazilacak = "Lütfen sadece youtube linki giriniz";
} else {
if(!e.contains("https://")&& e!="") yazilacak="Lütfen https:// ekleyin";
}
}
return yazilacak;
},
maxLines: null,
style: GoogleFonts.roboto(color: Colors.limeAccent),
controller: textEditingController,
cursorColor: Colors.limeAccent,
keyboardType: TextInputType.text,
maxLength: title == "Haber Başlığı(Zorunlu)" ? 35 : 200,
decoration: InputDecoration(
counterStyle: TextStyle(color: Colors.limeAccent),
hoverColor: Colors.limeAccent,
focusColor: Colors.limeAccent,
suffixIcon: faIcon,
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.limeAccent),
borderRadius: BorderRadius.circular(10.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.lime),
borderRadius: BorderRadius.circular(10.0),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Colors.lime)),
fillColor: Colors.white12,
errorStyle: GoogleFonts.adventPro(
fontSize: 15,
color: Colors.limeAccent,
fontWeight: FontWeight.bold),
filled: true))
],
),
);
}