I want to add a title or image on the home page of the project, how can I do that? I need help. I want to add an image describing the application above the registration or login form.
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Scaffold(
appBar: AppBar(
title: _title(),
),body: Container(
height: double.infinity,
width: double.infinity,
padding: const EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_entryField('email', _controllerEmail),
Padding(padding: EdgeInsets.only(bottom: 10)),
_entryField('password', _controllerPassword),
Padding(padding: EdgeInsets.only(bottom: 10)),
_submitButton(),
_loginOrRegisterButton(),
],
),
),
);
}
}
CodePudding user response:
Add items inside Column
widget,
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return Scaffold(
appBar: AppBar(
title: _title(),
),body: Container(
height: double.infinity,
width: double.infinity,
padding: const EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset("YourImagePath",height: 100,width:200 ,fit: BoxFit.cover,), //here
_entryField('email', _controllerEmail),
Padding(padding: EdgeInsets.only(bottom: 10)),
_entryField('password', _controllerPassword),
Padding(padding: EdgeInsets.only(bottom: 10)),
_submitButton(),
_loginOrRegisterButton(),
],
),
),
);
}
}
Find more about assets-and-images
CodePudding user response:
You should be able to put an Image widget in your Column, right before the email entryfield. Either an AssetImage or a NetworkImage.