-
Notifications
You must be signed in to change notification settings - Fork 30.2k
I am new to flutter and I just encountered an issue using the TextFormField #51566
Description
My code is:
`import 'package:flutter/material.dart';
import 'package:email_king/responsiveness/size_config.dart';
import 'dart:ui';
class MyTextFormField extends StatelessWidget {
const MyTextFormField(
{@required this.myHintText,
@required this.icon,
@required this.myErrorMessage});
final String myHintText;
final IconData icon;
final String myErrorMessage;
@OverRide
Widget build(BuildContext context) {
return TextFormField(
style: TextStyle(fontSize: 3 * SizeConfig.textMultiplier),
decoration: InputDecoration(
hintText: myHintText,
hintStyle: TextStyle(fontSize: 20.0),
border: UnderlineInputBorder(),
icon: Icon(
icon,
),
//labelText: 'password',
),
validator: (value) {
if (value.isEmpty) {
return myErrorMessage;
}
return null;
},
);
}
}
`
My error message was:
I/flutter (15651): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (15651): The following assertion was thrown building InputDecorator(decoration: InputDecoration(icon:
I/flutter (15651): Icon(IconData(U+0E897)), hintText: "Repeat your password", hintMaxLines: "1", border:
I/flutter (15651): UnderlineInputBorder(), alignLabelWithHint: false), baseStyle: TextStyle(inherit: true, size: 21.3),
I/flutter (15651): isFocused: false, isEmpty: true, dependencies: [MediaQuery, _LocalizationsScope-[GlobalKey#ecc34],
I/flutter (15651): Directionality, _InheritedTheme], state: _InputDecoratorState#d0a20(tickers: tracking 2 tickers)):
I/flutter (15651): 'package:flutter/src/services/text_input.dart': Failed assertion: line 742 pos 12: 'attached': is
I/flutter (15651): not true.
I/flutter (15651):
I/flutter (15651): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (15651): more information in this error message to help you determine and fix the underlying cause.