My Error Image
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return SafeArea(
bottom: false,
child: Scaffold(
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Container(
decoration: BoxDecoration(color: Colors.white),
),
Positioned(
top: 86,
bottom: 294,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image(
width: 104,
height: 112,
image: AssetImage('assets/images/rootinelogo.png'),
),
SizedBox(
height: 24,
),
Text(
'Rootine',
style: TextStyle(
fontFamily: 'Grandstander',
fontSize: 32,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(
height: 48,
),
LoginForm(),
],
),
)
],
),
),
);
}
}
class LoginForm extends StatefulWidget {
const LoginForm({
super.key,
});
@override
State<LoginForm> createState() => _LoginFormState();
}
class _LoginFormState extends State<LoginForm> {
final _formKey = GlobalKey<FormState>();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
child: TextFormField(
controller: emailController,
decoration: InputDecoration(border: OutlineInputBorder(), labelText: 'Email'),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your email';
}
return null;
},
),
),
Flexible(
child: TextFormField(
obscureText: true,
controller: passwordController,
decoration: InputDecoration(border: OutlineInputBorder(), labelText: 'Password'),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your password';
}
return null;
},
),
),
],
),
);
}
}
I wanted to build login page. Normally I build with just Column, and it is ok. But, now I used Stack Widget because I have some images to overlap in the page. Everything was fine until LoginForm class. After building LoginForm, the error was started and TextFormField didn’t appear. Although I couldn’t capture the errors because android debug logs kept running, I saw the errors are in Stack and Column widget from LoginForm. Please help me to fix the errors and guide me that how can I solve? Thank you.
Kaung Myat Tun is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.