Centering ListView in Flutter
Use SingleChildScrollView instead of ListView. Try this...
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Image.asset('assets/images/logo.png', scale: 3.0,),
InputField('enter email address', Icons.email, TextInputType.emailAddress),
PasswordInputField('enter password', Icons.lock, TextInputType.text),
RoundBtn('SIGN IN', signIn),
RoundBtn('SIGN UP', () => {}),
OutlineBtn('FORGOT PASSWORD?', () => {})
],
),
),)
);
}
ListView cannot be added to the center of the screen. Still, no official documentation is there. But still, if you want to do
Example:
Center(
child: ListView(
shrinkWrap: true,
children: <Widget>[
Center(child: Text('Text1')),
Center(child: Text('Text2')),
Center(child: Text('Text3')),
],
),
)
Output: