Different behaviours using `SingleChildScrollView` Flutter - flutter

I'm trying to make the whole OrderScreen slide up when the keyboard appears as I do in UserProfileScreen by wrapping the scaffold's container in a SingleChildScrollView, but doing so on this screen it throws various RenderBox was not laid out: _RenderScrollSemantics#abc84 relayoutBoundary=up4 NEEDS-PAINT errors, which are not thrown without SingleChildScrollView. I set up the two screen just the same apart from UserProfileScreen having a Column as a child of another Column. All column's children are wrapped in and Expanded widget with different flex values for layout purposes. Can you se why I do get these errors?
UserProfileScreen ( working ) :
child: Scaffold(
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(
child: Container(
color: Colors.black54,
padding:
EdgeInsets.only(left: 100, right: 100, top: 30, bottom: 70),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 100,
),
Stack(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey[200],
width: 2,
),
borderRadius: BorderRadius.circular(100),
),
child: CircleAvatar(
radius: 50,
backgroundImage:
NetworkImage('${widget.user.shopLogoUrl}'),
),
),
],
),
SizedBox(
height: 35,
width: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
AppLocalizations.instance.text('Shop name'),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontSize: fontSize),
),
),
// SizedBox(width: 50),
Expanded(
flex: 2,
child: TextField(
controller: _nameController,
style: TextStyle(
color: Colors.black87,
fontSize: fontSize,
fontWeight: FontWeight.w500),
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.all(5),
enabled: false,
hintText: AppLocalizations
.instance
.text(
'Shop name placeholder'),
//'nome',
hintStyle: TextStyle(
fontSize: fontSize,
color: Colors.grey[350]),
border: OutlineInputBorder(),
// focusColor: Colors.lightGreenAccent,
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
width: 1,
),
),
fillColor: Colors.white,
filled: true),
cursorColor: Colors.black,
),
),
],
),
...
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
// TODO cancel button
RaisedButton(
color: Colors.redAccent,
child: Text(
AppLocalizations.instance
.text('Cancel'),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: fontSize),
),
onPressed: () {
BlocProvider.of<UserBloc>(context)
.add(LoadUser());
},
),
SizedBox(width: 20),
// TODO save button
RaisedButton(
color: Colors.green.shade400,
child: Text(
AppLocalizations.instance.text('Save'),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: fontSize),
),
onPressed: () {
BlocProvider.of<UserBloc>(context)
.add(SaveUser(
user: FixitUser(
shopName: widget.user.shopName,
email: widget.user.email,
phoneNumber:
_phoneNumberController.text,
uid: widget.user.uid,
shopLogoUrl:
widget.user.shopLogoUrl,
address: _addressController.text,
zipCode: _zipCodeController.text,
city: widget.cityUser,
region: widget.regionUser,
country: widget.countryUser,
vatNumber: _vatController.text,
homeLat: widget
.userLocation.latitude
.toString(),
homeLong: widget
.userLocation.longitude
.toString(),
lastLogin: DateTime.now()
.millisecondsSinceEpoch,
signUpDate: signUpDate ??
DateTime.now()
.millisecondsSinceEpoch),
));
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
child: Container(
padding: EdgeInsets.all(50),
child: new Column(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
mainAxisSize:
MainAxisSize.min,
children: [
new CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<
Color>(
Colors
.redAccent),
),
SizedBox(
height: 50,
),
new Text(
AppLocalizations
.instance
.text(
'Saving user profile'),
style: TextStyle(
fontSize: fontSize,
color:
Colors.black54),
),
],
),
),
);
});
}),
...
],
),
),
],
),
),
),
),
OrderScreen ( trowing error ) :
child: Scaffold(
resizeToAvoidBottomInset : true,
body: SingleChildScrollView(
child: Container(
color: Colors.black54,
padding:
const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10,),
Expanded(
flex: 1,
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.redAccent, width: 2),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 9,
child: TextField(
controller: _customerNameController,
style: TextStyle(
color: Colors.black87,
fontSize: fontSize,
fontWeight: FontWeight.w500),
decoration: InputDecoration(
isDense: true,
enabled: true,
hintText: AppLocalizations.instance
.text('Customer name placeholder'), //'nome',
hintStyle: TextStyle(
fontSize: fontSize, color: Colors.grey[400]),
border: OutlineInputBorder(),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
width: 1,
),
),
fillColor: Colors.white,
filled: true),
cursorColor: Colors.black,
onChanged: (value){
BlocProvider.of<OrderBloc>(context).add(LoadOrdersForCustomer(_customerNameController.text));
},
),
),
SizedBox(width: 20,),
Expanded(
flex: 2,
child: RaisedButton(
color: Colors.redAccent,
child: Text(
AppLocalizations.instance.text('Cancel'),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontSize: fontSize),
),
onPressed: () {
setState(() {
_customerNameController.text = '';
});
BlocProvider.of<OrderBloc>(context).add(LoadOrders(user: widget.user));
},
),
)
],
),
),
),
...
],
),
),
),
),
Progress
Adding height and width to the container got rid of the error, but the view doesn't slide up as UserProfileScreen instead does..with or without resizeToAvoidBottomInset: true, set in Scaffold.. the keyboard just covers up the screen..
child: Scaffold(
resizeToAvoidBottomInset: true,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height-50,
width: MediaQuery.of(context).size.width,
color: Colors.black54,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Column(
So I have two different behaviours.
UserProfileScreen doesn't need Container's heigh and width and it slides up on keyboard appearing.
OrderScreen does need Container's height and width but doesn't slide up on keyboard appearing.

Related

I want Radio button widget and text widget inline

I want the single selected radio button widget and text widget in the same row. It won't work even if I try to wrap it with the row. I want it like the image below.I want this, But I got this. Thanks in advance!
Column(
children: [
RadioListTile(
title: Padding(
padding: const EdgeInsets.only(left: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
///use your image
Text(
" English",
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
),
),
],
),
),
value: "English",
groupValue: "english",
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)),
onChanged: (value) {
setState(() {});
},
tileColor: Color(0xff28e8df),
),
Container(
decoration: BoxDecoration(
color: Color(0xffbebdbd),
border: Border.all(color: Color(0xffbebdbd)),
borderRadius: BorderRadius.circular(5)),
child: Padding(
padding: EdgeInsets.all(10.0),
child: Text("العربية",
style: TextStyle(
fontSize: 17,
color: Color(0xff000000),
fontWeight: FontWeight.bold)))),
],
),
You have to use Row widget and wrap each child in it with Expanded, because RadioListTile want to take the width of its parent, and Row wait its children to render, so it can know its own width.
By using Expanded the Row know that it must take all the possible with, and it's children can fit correctly in it.
try this update i hope it will fix the issue
Container(
width: MediaQuery.of(context).size.width,
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width / 2,
height: 50,
child: RadioListTile(
title: Padding(
padding: const EdgeInsets.only(left: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
///use your image
Text(
" English",
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
),
),
],
),
),
value: "English",
groupValue: "english",
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
onChanged: (value) {
setState(() {});
},
tileColor: Color(0xff28e8df),
),
),
Container(
width: MediaQuery.of(context).size.width / 2,
decoration: BoxDecoration(
color: Color(0xffbebdbd),
border: Border.all(color: Color(0xffbebdbd)),
borderRadius: BorderRadius.circular(5),
),
child: Padding(
padding: EdgeInsets.all(10.0),
child: Text(
"العربية",
style: TextStyle(
fontSize: 17,
color: Color(0xff000000),
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),

How to change textformfield spacing?

I am new to using flutter. I want to ask. How to change the spacing between textformfield? I have done the same as textformfield address, Postcode and District for textformfield firstname, last name, and relationship but still not successful. I have changed the container margin and padding and used spacing wrap for textformfield firstname, last name and relationship but still not successful. Where is my coding error? Please, someone, help me in solving this problem.
This is my code:
Container(
width: double.infinity,
//margin: EdgeInsets.symmetric(vertical: 50),
margin: EdgeInsets.symmetric(
horizontal: 10, vertical: 40),
padding: EdgeInsets.symmetric(horizontal: 210),
decoration: BoxDecoration(
border: Border.all(
color: Colors.transparent,
width: 1.0,
),
borderRadius: BorderRadius.circular(5)),
/*decoration: BoxDecoration(
border: Border(
/* top: BorderSide(
color: Colors.blue,
width: 2.0,
),*/
bottom: BorderSide(
color: Colors.blue, width: 2.0))),*/
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 30,
child: Text(
'Next of kin 1',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
),
Container(
//height: 51,
//width: 30,
width: double.infinity,
//margin: EdgeInsets.symmetric(horizontal: 10),
/*padding: EdgeInsets.symmetric(horizontal: 5),*/
decoration: BoxDecoration(
border: Border.all(
color: Colors.transparent,
width: 1.0,
),
borderRadius: BorderRadius.circular(5)),
child: Row(
children: [
Expanded(
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.start,
//spacing: 20.0,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
SizedBox(
height: 30,
child: Text(
'First Name',
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16),
),
),
SizedBox(
width: 300,
//height: 100,
child: TextFormField(
style: const TextStyle(
color: Colors.black),
controller:
nextOfKinFirstName,
onSaved: (String? value) {
nextOfKinFirstName.text =
value!;
},
decoration:
const InputDecoration(
border:
OutlineInputBorder(),
hintText: 'First Name',
hintStyle: TextStyle(
color: Colors.black,
fontSize: 16),
),
),
),
],
)
],
),
),
Expanded(
child: Wrap(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 30,
child: Text(
'Last Name',
style: TextStyle(
fontWeight:
FontWeight.bold,
fontSize: 16),
),
),
SizedBox(
width: 300,
//height: 100,
child: TextFormField(
style: const TextStyle(
color: Colors.black),
controller: nextOfKinLastName,
onSaved: (String? value) {
nextOfKinLastName.text =
value!;
},
decoration:
const InputDecoration(
border:
OutlineInputBorder(),
hintText: 'Last Name',
hintStyle: TextStyle(
color: Colors.black,
fontSize: 16),
),
),
),
],
),
],
)),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(
height: 30,
child: Text(
'Relationship',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16),
),
),
Container(
height: 51,
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 5),
decoration: BoxDecoration(
border: Border.all(
color: Colors.black12,
width: 1.0,
),
borderRadius:
BorderRadius.circular(5)),
child: SizedBox(
width: 300,
child: DropdownButton<String>(
underline: Container(
color:
Colors.transparent),
hint: _nextOfKinRelationship ==
null
? Text('Relationship')
: Text(
_nextOfKinRelationship),
isExpanded: true,
value:
_nextOfKinRelationship,
items: <String>[
'Father',
'Mother',
'Husband',
'Wife',
'Son',
'Daughter',
'Brother',
'Sister',
'Grandfather',
'Grandmother',
'Grandson',
'Grandaughter',
'Uncle',
'Aunt',
'Cousin',
'Nephew',
'Neice',
'Father in law',
'Mother in law',
'Son in law',
'Daughter in law',
'Brother in law',
'Sister in law',
'Friend'
].map((String value) {
return new DropdownMenuItem<
String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (value) {
setState(() {
_nextOfKinRelationship =
value!;
});
},
)),
),
],
),
)
],
))
],
),
),
you use Row to cover 3 TextField and wrap it with expanded, the space that available will be devide into 3.
but for the TextField you wrap it with certain width (SizedBox). and i think current screen is wider than all children inside Row
my suggestion is change it with Container which is fit available space.
Row(
children: [
// option 1
Expanded(
child: Column(
children: [
Text("label"),
TextField(), // without sizebox ,
],
),
),
//option 2
Expanded(
child: Column(
children: [
Text("label"),
Container(
width: double.infinity, // push to maximum space available
child: TextField(),
) // use container insted if you want to make decoration ,
],
),
),
],
);

flutter : how to make transparent

How to make it transparent which is I circled.
Scaffold(
appBar: AppBar(
title: Text("Add New Address",
style: TextStyle(
fontSize: t1Size,
fontWeight: FontWeight.w700,
color: Colors.white)),
),
bottomNavigationBar: saveButton(context),
backgroundColor: Colors.white.withOpacity(0.9),
body: Container(
child: Column(
// alignment: Alignment.topCenter,
children: [
Expanded(
child: MapPicker(
// pass icon widget
iconWidget: Icon(
Icons.location_on,
size: 40,
color: appGreenColor,
),
//add map picker controller
mapPickerController: mapPickerController,
child: GoogleMap(
myLocationEnabled: true,
zoomControlsEnabled: false,
// hide location button
myLocationButtonEnabled: true,
mapType: MapType.normal,
indoorViewEnabled: false,
// camera position
initialCameraPosition: cameraPosition,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
onCameraMoveStarted: () {
// notify map is moving
mapPickerController.mapMoving!();
textController.text = "checking ...";
},
onCameraMove: (cameraPosition) {
this.cameraPosition = cameraPosition;
},
onCameraIdle: () async {
// notify map stopped moving
mapPickerController.mapFinishedMoving!();
//get address name from camera position
List<Placemark> placemarks = await placemarkFromCoordinates(
cameraPosition.target.latitude,
cameraPosition.target.longitude,
);
fLocationName = placemarks.first.name;
setState(() {
fLocationName;
});
// update the ui with the address
textController.text =
'${placemarks.first.name} ,${placemarks.first.subLocality}, ${placemarks.first.locality}, ${placemarks.first.administrativeArea}, ${placemarks.first.country}';
},
),
),
),
Container(
// height: MediaQuery.of(context).size.height - 400,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30))),
child: SingleChildScrollView(
child: Column(children: [
SizedBox(
height: 25,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Select Your Location",
style: TextStyle(
fontSize: t2Size,
fontWeight: FontWeight.w700,
),
),
],
),
),
SizedBox(
height: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Row(
children: [
Icon(
Icons.location_on_outlined,
color: appYellowColor,
size: 20,
),
SizedBox(
width: 6,
),
Text(
fLocationName == null ? "" : '$fLocationName',
style: TextStyle(
color: appYellowColor,
fontSize: t3Size,
fontWeight: FontWeight.w500,
),
),
],
),
),
SizedBox(
height: 5,
),
Container(
padding: const EdgeInsets.only(left: 46.0, right: 20),
child: Text(
'${textController.text}',
style: TextStyle(
color: extraLightColor,
fontSize: t4Size,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.start,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
Column(
children: [
SizedBox(
height: 15,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Save This Address As",
style: TextStyle(
fontSize: t2Size,
fontWeight: FontWeight.w700,
),
),
],
),
),
SizedBox(
height: 10,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width - 30,
decoration: BoxDecoration(
color: extraLightColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
//color: Colors.white,
),
padding: const EdgeInsets.only(left: 12.0),
child: Center(
child: TextFormField(
controller: _saveAddressAsController,
autocorrect: false,
style: TextStyle(
color: apptitleColor,
fontWeight: FontWeight.w400,
fontSize: t4Size),
decoration: InputDecoration(
border: UnderlineInputBorder(
borderSide: BorderSide.none),
hintText: "Home/ Work/ Other",
prefixIconConstraints: BoxConstraints(
minWidth: 16,
minHeight: 16,
),
//isDense: true,
),
//controller: _controller1,
maxLines: 1,
// onChanged: searchSalon,
),
),
)
],
),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Search Location",
style: TextStyle(
fontSize: t2Size,
fontWeight: FontWeight.w700,
),
),
],
),
),
SizedBox(
height: 15.0,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15),
child: searchBar(context),
),
],
)
],
),
]),
),
)
],
),
),
);
wrap your container with ClipRRect
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child:Container()
)
That color is coming from Scaffold's backgroundColor. For this kind of layout, Stack is more suitable than Column. Also in your snippet you can do a trick using Transform. But for click-event you might find some trouble. For this, use Container's transform for second Container that is holding second part.
Container(
transform: Matrix4.translationValues(0, -30, 0),//-30=y based on your need
you can try this suggestions
*first;
You can use>> Stack widget runs like a layer (maybe you know Photoshop etc..)
Stack( children: <Widget>[
//Container(), this show bottom
// Column(),
// google map
//TextField(), this show top
// any widget..
]),
*secondly;
Scaffold(
backgroundColor: Colors.transparent, //maybe it work
);

how to implement textfield inside tile flutter

hi i need to design this page
but i'm new in flutter so i'm face difficult to manage to do it
here is my try
Container (
child: Column (
children: <Widget> [
Container(
margin: EdgeInsets.all(20),
child: Text(
"Source Account",
style: TextStyle(fontSize: 30,
color: Color(0xff8aa1ba)),
),
),
Container(
height: 100,
child: Card(
color: Color(0xff343b4b),
clipBehavior: Clip.antiAlias,
elevation: 10,
margin: EdgeInsets.all(7),
child: Column(
children: <Widget>[
ListTile(
title: Text("Main Account 123456",
style: TextStyle(
color: Colors.white,
fontSize: 15, fontWeight: FontWeight.bold),textAlign: TextAlign.left,),
subtitle: Text(" Available Balance \n 10.000.9 KWD" ,
style: TextStyle(
color: Colors.white,
fontSize: 15, fontWeight: FontWeight.bold),textAlign: TextAlign.right,),
),
],
),
),
),
],
),
)
so can any one help me to implement this or give me an idea of how to implement a textfield inside a list tile or card
Put a Row inside of your title. So replace the your code with something like this:
ListTile(
title: Row(
children: <Widget>[
Expanded(
child: TextField(
// your TextField's Content
),
),
],
),
Card(color: Colors.grey, child: Container(
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8), child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Loans", style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500,),),
Column(children: [
Icon(Icons.add),
Text("Amount", style: TextStyle(color: Colors.white,),)
])
]
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(2),
),
padding: EdgeInsets.symmetric(horizontal: 16),
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
),
style: TextStyle(color: Colors.white),
textAlign: TextAlign.end,
),
)
]),
),)

handling application layout in flutter app

I have Entry page to my app like below, I am getting bottom overflow , image size issue , text font issue, when I run on the phone with less than 5 inches,
If I run the same app on over 5 inches I am getting like below
Can anyone who have worked on developing flutter apps help me on how I can adjust according to the screen?
also How to adjust text size, image size every other things as per the screen size?
below is my code:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Color colorTheme;
class LoginPage extends StatefulWidget {
#override
_LoginPageState createState() => new _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
TextEditingController controllerEmail = TextEditingController();
TextEditingController controllerPassword = TextEditingController();
String username, password;
Widget loginButtonChild = const Text(
"Log in",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontFamily: "OpenSans-Regular", fontSize: 16),
);
Widget loginButtonWithCircle = Row(
children: <Widget>[
const Text(
"Log in",
style: TextStyle(
color: Colors.white,
fontFamily: "OpenSans-Regular",
),
),
CircularProgressIndicator(),
],
);
#override
Widget build(context) {
double maxHeight = MediaQuery.of(context).size.height;
// ScreenUtil.instance = ScreenUtil.getInstance()..init(context);
return Scaffold(
resizeToAvoidBottomPadding: true,
body: SingleChildScrollView(
child: LimitedBox(
maxHeight: maxHeight * 1,
child: Stack(
//fit: StackFit.expand,
children: <Widget>[
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.05,
left: MediaQuery.of(context).size.width * 0.05),
child: Image.asset('assets/Heat Map.png',
width: 100, height: 20, fit: BoxFit.fill),
)
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(15))),
padding: EdgeInsets.all(
// MediaQuery.of(context).size.width * 0.09,
MediaQuery.of(context).size.width * 0.1,
),
child: Image.asset(
'assets/layer_1_3.png',
// color: Color(0xFFe31735),
// width: 300,
width: MediaQuery.of(context).size.width * 0.72,
// height: 300,
height: MediaQuery.of(context).size.height * 0.5,
fit: BoxFit.contain,
),
),
Positioned(
left: 78.0,
bottom: 10.0,
child: RichText(
text: TextSpan(
text: 'APP',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
children: <TextSpan>[
TextSpan(
text: '\nDevelopment',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.normal,
),
),
TextSpan(
text: '\nFlutter',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.normal,
),
),
],
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
softWrap: true,
),
),
],
),
SingleChildScrollView(
child: new Container(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 40.0, 40.0),
child: new Form(
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20),
child: Icon(Icons.person_outline,
size: 38, color: Colors.black),
),
SizedBox(width: 10.0),
new Expanded(
child: new TextFormField(
style: TextStyle(color: Colors.black),
controller: controllerEmail,
//cursorColor: , make it yellow later TODO
decoration: new InputDecoration(
labelText: "Username",
enabledBorder: new UnderlineInputBorder(
borderSide: new BorderSide(
color: Colors.red,
))),
keyboardType: TextInputType.text,
),
),
],
),
Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20),
child: Icon(
Icons.lock_outline,
size: 38,
color: Colors.black,
),
),
SizedBox(width: 10.0),
new Expanded(
child: new TextFormField(
controller: controllerPassword,
style: TextStyle(color: Colors.red),
decoration: new InputDecoration(
labelText: "Password",
enabledBorder: new UnderlineInputBorder(
borderSide: new BorderSide(
color: Colors.red,
))),
obscureText: true,
keyboardType: TextInputType.text,
),
),
],
),
Padding(
padding: EdgeInsets.only(
top: 0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
onPressed: () {
},
child: Text(
"Forgot password?",
style: TextStyle(
color: Colors.grey,
fontFamily: "OpenSans-Regular",
),
),
)
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.04,
),
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius:
new BorderRadius.circular(25.0),
side: BorderSide(color: Colors.red)),
color: Colors.red,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 48),
child: loginButtonChild,
),
const SizedBox(
width: 45.0,
height: 45.0,
),
Icon(Icons.arrow_forward,
color: Colors.white),
],
),
onPressed: () {
}),
],
),
),
),
),
],
),
],
),
),
),
);
}
}
You can use SingleChildScrollView to avoid overflow error just wrap your widget with SingleChildScrollView
Example:-
SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
child:YourWidget();
)
)