Bottom overflowed by 217 pixels - flutter

I am trying to build a form which is the code attach below. But when I try to input the text in the textfieldform it pops out error of bottom overflowed by 217 pixels
I am trying to build a form which is the code attach below. But when I try to input the text in the textfieldform it pops out error of bottom overflowed by 217 pixels
Scaffold(
appBar: AppBar(
leading: SizedBox(
width: 16,
child: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const Splash()),
);
}),
),
title: const Text(
"Upload KYC",
style: TextStyles.header4,
),
backgroundColor: ColorPalette.grey2,
elevation: 0,
),
backgroundColor: ColorPalette.grey2,
body: Column(
children: [
Container(
padding: EdgeInsets.only(
top: 45.h(), left: 20.w(), right: 20.w(), bottom: 20.h()),
child: Row(
children: <Widget>[
Expanded(
child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Center(
child: Text(
"Personal Details",
style: TextStyles.subtitle04,
),
),
Divider(
thickness: 4.h(),
color: ColorPalette.azure,
)
],
),
),
const SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Center(
child: Text(
"ID Proof",
style: TextStyles.subtitle004,
),
),
Divider(
thickness: 4.h(),
color: ColorPalette.grey3,
)
],
),
),
const SizedBox(
width: 10,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Center(
child: Text(
"Bank Details",
style: TextStyles.subtitle004,
),
),
Divider(
thickness: 4.h(),
color: ColorPalette.grey3,
)
],
),
),
],
),
),
Expanded(
child: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 20.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 30.h(),
),
const Text(
"Enter Your Details",
style: TextStyles.header002,
),
SizedBox(height: 50.h()),
// KYC form
Form(
key: formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Align(
alignment: Alignment.topLeft,
child: Text(
'First Name',
style: TextStyles.subtitle4,
),
),
SizedBox(
height: 20.h(),
),
TextFormField(
keyboardType: TextInputType.name,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
hintText: 'Enter Your First Name',
hintStyle: TextStyles.subtitle1,
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(16))),
contentPadding:
EdgeInsets.fromLTRB(24, 24, 12, 16),
),
toolbarOptions:
const ToolbarOptions(copy: true, paste: true),
validator: (val) {
if (val!.isEmpty) {
return 'Please fill in your name';
}
firstName = val;
},
),
SizedBox(
height: 50.h(),
),
const Align(
alignment: Alignment.topLeft,
child: Text(
'Last Name',
style: TextStyles.subtitle4,
),
),
SizedBox(
height: 20.h(),
),
TextFormField(
keyboardType: TextInputType.name,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
hintText: 'Enter Your Last Name',
hintStyle: TextStyles.subtitle1,
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(16))),
contentPadding:
EdgeInsets.fromLTRB(24, 24, 12, 16),
),
toolbarOptions:
const ToolbarOptions(copy: true, paste: true),
validator: (val) {
if (val!.isEmpty) {
return 'Please complete your name';
}
lastName = val;
},
),
SizedBox(
height: 50.h(),
),
const Align(
alignment: Alignment.topLeft,
child: Text(
'Email',
style: TextStyles.subtitle4,
),
),
SizedBox(
height: 20.h(),
),
TextFormField(
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
hintText: 'Enter Your Email Address',
hintStyle: TextStyles.subtitle1,
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(16))),
contentPadding:
EdgeInsets.fromLTRB(24, 24, 12, 16),
),
toolbarOptions:
const ToolbarOptions(copy: true, paste: true),
onChanged: (_) {
emailExists = false;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter an email address';
}
if (!Constants().emailFilter.hasMatch(val)) {
return 'Please enter a valid email';
}
if (emailExists) {
return 'A user with this email already exists';
}
email = val;
},
),
SizedBox(
height: 50.h(),
),
const Align(
alignment: Alignment.topLeft,
child: Text(
'Phone Email',
style: TextStyles.subtitle4,
),
),
SizedBox(
height: 20.h(),
),
TextFormField(
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
hintText: 'Enter Your Phone Number',
hintStyle: TextStyles.subtitle1,
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(16))),
contentPadding:
EdgeInsets.fromLTRB(24, 24, 12, 16),
),
validator: (val) {
if (val!.length < 11 || val.length > 11) {
return 'Phone Number should be 11';
}
phoneNumber = val;
},
),
],
)),
const Spacer(),
Padding(
padding: const EdgeInsets.only(bottom: 50),
child: ConstrainedBox(
constraints: const BoxConstraints.expand(height: 54),
child: Align(
alignment: Alignment.bottomCenter,
child: RoundedLoadingButton(
color: ColorPalette.blue1,
width: (MediaQuery.of(context).size.width - 40),
controller: _btnController,
borderRadius: 12,
elevation: 0,
animateOnTap: false,
onPressed: () => Navigator.of(context)
.pushReplacementNamed(KYCIDProofScreen.routeName),
child: const Text('Next'),
),
),
),
),
],
),
),
),
],
),
);

Column wrap with SingleChildScrollView it will solve the overflow issue

Related

How to add border shadow to a TextField in Flutter

how to add border or elevation to a textfield in flutter
I wanted to give a shadow to my text field.
After some digging i found the answer to my question.
here is my code :
// This is a single TextField
// Wrap your TextField around Material Widget and give border radius and // elevaiton to Material Widget.
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: Container(
height: 50,
width: 250,
child: Material(
borderRadius: BorderRadius.circular(20),
elevation: 8,
child: TextField(
decoration: InputDecoration(
labelText: 'First Name',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20)
)
),
),
),
),
),
Blockquote
// IF YOU WANT TO USE THE DESIGN IN THE IMAGE THEN USE THIS CODE ://
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:signup_figma/Screens/signin_personal_details_screen.dart';
import '../Widgets/otp_pin_input_field.dart';
class SignUpScreen extends StatefulWidget {
const SignUpScreen({Key? key}) : super(key: key);
#override
State<SignUpScreen> createState() => _SignUpScreenState();
}
class _SignUpScreenState extends State<SignUpScreen> {
bool mobileNumberVerify = false;
bool emailVerify = false;
bool checkBoxValue = false;
#override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: [
SizedBox(
child: Padding(
padding: const EdgeInsets.only(top: 60, left: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
/////// SignUp///////////
Text(
"Sign up",
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
),
SizedBox(
height: 8,
),
Text(
"Create an account to get started",
style: TextStyle(fontSize: 18),
),
SizedBox(
height: 20,
)
],
),
),
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: Container(
height: 50,
width: 250,
child: Material(
borderRadius: BorderRadius.circular(20),
elevation: 8,
child: TextField(
decoration: InputDecoration(
labelText: 'First Name',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20)
)
),
),
),
),
),
Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
child: Container(
height: 50,
width: 250,
child: Material(
borderRadius: BorderRadius.circular(20),
elevation: 8,
child: TextFormField(
decoration: InputDecoration(
// fillColor: Colors.white,
// filled: true,
labelText: 'Last Name',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20)),
),
),
),
),
),
Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
child: SizedBox(
width: 250,
height: 50,
child: Material(
borderRadius: BorderRadius.circular(20),
elevation: 8,
child: TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: 'Mobile Number',
suffixIcon: Padding(
padding: EdgeInsets.only(right: 15, top: 15),
child: InkWell(
onTap: () {
print("Clicked");
setState(() {
mobileNumberVerify = true;
});
},
child: Text("verify")),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20))),
),
),
),
),
Padding(
padding:
const EdgeInsets.only(left: 36, right: 16, top: 8, bottom: 8),
child: SizedBox(
child: Text(
"Resend OTP",
style: TextStyle(color: Colors.deepPurpleAccent),
),
),
),
mobileNumberVerify
? OtpPinInputField()
: SizedBox(
height: 2,
),
Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
child: SizedBox(
width: 250,
height: 50,
child: Material(
borderRadius: BorderRadius.circular(20),
elevation: 8,
child: TextField(
decoration: InputDecoration(
labelText: ' Email',
suffixIcon: Padding(
padding: EdgeInsets.only(right: 15, top: 15),
child: InkWell(
onTap: () {
print("Clicked");
setState(() {
emailVerify = true;
});
},
child: Text("verify")),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20))),
),
),
),
),
const Padding(
padding:
EdgeInsets.only(left: 36, right: 16, top: 8, bottom: 8),
child: SizedBox(
child: Text(
"Resend OTP",
style: TextStyle(color: Colors.deepPurpleAccent),
),
),
),
emailVerify
? OtpPinInputField()
: SizedBox(
height: 2,
),
Row(
children: [
Checkbox(
value: checkBoxValue,
onChanged: (value) {
setState(() {
this.checkBoxValue = value!;
});
}),
Container(
width: 320,
child: RichText(
text: const TextSpan(
children: <TextSpan>[
TextSpan(
text: "I've read and agree with the ",
style: TextStyle(color: Colors.black)),
TextSpan(
text: 'Terms & Conditions, Privacy Policy',
style: TextStyle(color: Colors.deepPurpleAccent)),
TextSpan(text: ' & '),
TextSpan(
text: 'End User License Agreement',
style: TextStyle(color: Colors.deepPurpleAccent)),
],
),
),
),
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: MaterialButton(
height: 50,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PersonalDetailsScreen()),
);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(11)),
color: Colors.deepPurpleAccent,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PersonalDetailsScreen()),
);
},
child: const Text(
"Register",
style: TextStyle(color: Colors.white),
),
),
),
)
],
),
),
);
}
}
Blockquote
Create a file otpPininputfield.dart and paste this code :
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class OtpPinInputField extends StatelessWidget {
const OtpPinInputField({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Form(
child: Padding(
padding: const EdgeInsets.only(left: 35,right: 40),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
height: 45,
width: 45,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15)
)
),
onChanged: (value){
if(value.length == 1){
FocusScope.of(context).nextFocus();
}
},
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly
],
),
),
SizedBox(
height: 45,
width: 45,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15)
)
),
onChanged: (value){
if(value.length == 1){
FocusScope.of(context).nextFocus();
}
},
style: Theme.of(context).textTheme.headline6,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly
],
),
), SizedBox(
height: 45,
width: 45,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15)
)
),
onChanged: (value){
if(value.length == 1){
FocusScope.of(context).nextFocus();
}
},
style: Theme.of(context).textTheme.headline6,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly
],
),
), SizedBox(
height: 45,
width: 45,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15)
)
),
onChanged: (value){
if(value.length == 1){
FocusScope.of(context).nextFocus();
}
},
style: Theme.of(context).textTheme.headline6,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
FilteringTextInputFormatter.digitsOnly
],
),
),
],
),
),
),
);
}
}
You can try this way.....
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey[400]),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey[600]),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red[600]),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red[800]),
),
contentPadding: EdgeInsets.all(12.0),
fillColor: Colors.white,
),
style: TextStyle(
color: Colors.grey[800],
fontSize: 16.0,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey[300],
blurRadius: 10.0,
spreadRadius: 5.0,
offset: Offset(5.0, 5.0),
),
],
),
),

flutter dropdownbutton that loads info from the dropdown to a data grid

as i have on my profile before, multiple posts of question about data grid. i need to get the grid by a dropdown button/menu that has all the driver's names and looks up all the data by that name/ driver number.
below is the snip of the body for that dropdown class.
body: TabBarView(
children: [
Center(
child: SingleChildScrollView(
child: isLoading
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new CircularProgressIndicator(),
new Text(" please wait for data to load... ")
],
)
: new Column(
//crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(height: 0),
Center(
child: Text(
" drivers name "
, style: TextStyle(fontSize: 25,),
),
),
Container(
height: 75,
width: 400,
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.70), // border color
borderRadius: BorderRadius.all(Radius.circular(20))
),
child: Center(
child: DropdownButtonHideUnderline(
child: DropdownButton(
hint: Text("press here",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold
),),
alignment: AlignmentDirectional.topCenter,
menuMaxHeight: 300,
dropdownColor: Colors.grey.shade300,
borderRadius: BorderRadius.all(Radius.circular(15.0)),
items: DriversName.map((item) {
return DropdownMenuItem(
child: Center(
child: Text(
item['DriverName'].toString().trim(), //Names that the api dropdown contains
style: const TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold
),
textAlign : TextAlign.end,
),
),
value: item['DriverNo'].toString().trim() //Id that has to be passed that the dropdown has.....
//e.g India (Name) and its ID (55fgf5f6frf56f) somethimg like that....
);
}).toList(),
onChanged: (String? newVal) {
setState(() {
driverName = newVal.toString();
driverName1 = driverName?.trim();
print(driverName1.toString());
});
},
value: driverName, //pasing the default id that has to be viewed... //i havnt used something ... //you can place some (id)
),
),
),
),
SizedBox(height: 5,),
// Operations Types Api List New
Container(
height: 75,
width: 250,
margin: EdgeInsets.all(15),
child: TextField(
style: TextStyle(fontSize: 25),
keyboardType: TextInputType.number,
controller: driverNoController,
textAlign: TextAlign.center,
decoration: InputDecoration(
alignLabelWithHint: true,
//labelText: 'Qty',
hintText: 'enter drivers name',
hintStyle: TextStyle(),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 20),
borderRadius: BorderRadius.all(Radius.circular(15.0)),
//borderRadius: BorderRadius.circular(15),
),
),
obscureText: false,
//controller: myController,
),
),
Container(
height: 50,
width: 150,
child: ElevatedButton(
//style: ElevatedButton.styleFrom(side: BorderSide(width: 1,style: BorderStyle.solid),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.lightBlueAccent),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0),
side: BorderSide(color: Colors.white)))),
//style: ButtonStyle(shape: OutlinedBorder()),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.local_shipping_outlined),
SizedBox(
width: 25,
),
Text(
'GO ',
style: TextStyle(color: Colors.white, fontSize: 20),
),
],
)),
onPressed: () {
//fetchOpTypesData();
int driverNo = int.parse(driverNoController.text);
if (driverNo.isNaN || driverName1 == '') {
print('empty data');
return;
}
else {
upload();
searchDetailsByDriverNoFromJson(driverNo).then(
(value) {
Navigator.push(
context,
new MaterialPageRoute(
//builder: (context) => BalanceScreen(),
builder: (context) => transData(),
),
);
// print(value.driverNo);
saveDriverNoPrefs(driverNo);
}
).onError((error, stackTrace) {
CoolAlert.show(
context: context,
type: CoolAlertType.error,
text: "please check data",
);
});
};
} ),
),
],),
)
)

Flutter:(TextFormField)Problem when opening the keyboard and start typing

When I open the keyboard to start typing, the problem appears that there is too much space
[1]: https://i.stack.imgur.com/Nk4l6.png
[2]: https://i.stack.imgur.com/12jNe.png
the code:
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
class SignUpScreen extends StatelessWidget {
#override
var Email, Pass;
var txt;
GlobalKey<FormState> formstate = new GlobalKey<FormState>();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
leading: Container(),
backgroundColor: Color(0xFF03045E),
),
body: Container(
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFF03045E),Color(0xFF1F21D5),]
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: 45,
height: 45,
margin: EdgeInsets.only(top: 70,right: 35),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xff383989),
),
child: FlatButton(
onPressed: (){
Get.back();
},
child: Image(
image: AssetImage('assets/images/cancel-icon.png'),
color: Colors.white,
width: double.infinity,
),
),
),
],
),
Container(
margin: EdgeInsets.symmetric(horizontal: 35),
child: Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 40),
child: Row(
children: [
Text('Create\n Account',style: TextStyle(
color: Colors.white,
fontSize: 30
),),
],
),
),
Row(
children: [
Text('Create account and enjoy 7 days free trial',style: TextStyle(
color: Color(0xffB2B2DC),
fontSize: 15
),),
],
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.name,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
hintText: 'Your first and last name?',
labelText: 'Full Name',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.emailAddress,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 'Email',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.visiblePassword,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 'password',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.visiblePassword,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 're-password',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Container(
margin: EdgeInsets.only(bottom: 50,top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)
),
color: Colors.white,
height: 70,
onPressed: (){},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text('Sign up',textAlign:TextAlign.center,
style: TextStyle(
color: Color(0xff03045E),
fontSize: 18.0,
),),
),
],
),
),
),
Expanded(flex: 1 , child: Container(),),
],
),
),
],
),
),
],
),),
],
),
),
);
}
}
======== Exception caught by rendering library =====================================================
The following assertion was thrown during layout:
A RenderFlex overflowed by 51 pixels on the bottom.
The relevant error-causing widget was:
Column Column:file:///M:/Android%20PG/lockvpn0/lib/view/auth/sign-up.dart:87:26
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
The specific RenderFlex in question is: RenderFlex#d12d3 relayoutBoundary=up5 OVERFLOWING
... needs compositing
... parentData: offset=Offset(0.0, 260.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, h=388.9)
... size: Size(411.4, 388.9)
... direction: vertical
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
You can wrap your column with a SingleChildScrollView. That should fix the overflow issue.
If you set resizeToAvoidBottomInset to true on your scaffold, the column won't be squished but you also won't be able to see your TextFields.

The Alignment on top Right and top Left are not exactly Align on the top of the page | flutter

I have two RaisedButton and I want to make them at the top of the page for (add and cancel) and it aligned at the top of the page but one of them it's gone down a bit in the middle of the page as you can see here app Image
and one more question,How can I solve this problem?
TextFormFeild issue
My code of the cancel and add Button:
Widget addCancelButton(
String Buttontext, textAlign, textColor, backgroundColor) {
return Align(
alignment: textAlign,
//Alignment.topRight,
child: SizedBox(
width: 79,
child: RaisedButton(
onPressed: () {},
child: Text(Buttontext,
style: TextStyle(
fontSize: 13,
fontFamily: 'Montserrat-Arabic',
)),
color: backgroundColor,
textColor: textColor,
//Colors.purple[900],
elevation: 0,
),
),
);
}
final GlobalKey<FormState> _formKey = GlobalKey<FormState();
#override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 20, right:20),
child: Form(
key: _formKey,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: addCancelButton(
'add',
Alignment.topRight,
Theme.of(context).accentColor,
Theme.of(context).backgroundColor),
),
addCancelButton(
'Cancel',
Alignment.topLeft,
Theme.of(context).accentColor,
Theme.of(context).backgroundColor),
SizedBox(
height: 80,
),
modalBottomSheet(
userInput: widget.title,
buttonFeild: 'Title',
buttonHinit: 'Ex: My friend birthday',
buttonKeyboardType: TextInputType.text,
butonColor: Theme.of(context).backgroundColor,
),
SizedBox(
height: 20,
),
modalBottomSheet(
userInput: widget.emoji,
buttonFeild: 'Emoji',
buttonHinit: 'Enter an emoji',
buttonKeyboardType: TextInputType.text,
butonColor: Theme.of(context).backgroundColor,
),
SizedBox(
height: 20,
),
modalBottomSheet(
userInput: widget.datePicker.toString(),
buttonFeild: 'Date',
buttonHinit: 'Mar 19,2022',
textEditingController: textEditingController1,
buttonKeyboardType: TextInputType.datetime,
IconButtonFuncation: () => datePicker(),
butonColor: Theme.of(context).backgroundColor,
icon: Icons.calendar_today,
),
SizedBox(
height: 20,
),
modalBottomSheet(
userInput: widget.TimePicker.toString(),
buttonFeild: 'Time',
buttonHinit: '9:00 am',
textEditingController: textEditingController2,
IconButtonFuncation: () => timePicker(),
buttonKeyboardType: TextInputType.datetime,
butonColor: Theme.of(context).backgroundColor,
icon: Icons.access_time_sharp,
),
SizedBox(
height: 20,
),
modalBottomSheet(
userInput: widget.notes,
buttonFeild: 'Notes',
buttonHinit: 'To Do list',
buttonKeyboardType: TextInputType.multiline,
maxLine: 5,
butonColor: Theme.of(context).backgroundColor,
),
],
),
),
),
),
),
);
}
}
My code of the TextFormFeild:
modalBottomSheet(
// userInput: notes,
buttonFeild: 'Notes',
buttonHinit: 'To Do list',
buttonKeyboardType: TextInputType.text,
butonColor: Theme.of(context).backgroundColor,
contentPaddingText: new EdgeInsets.symmetric(
vertical: 50.0, horizontal: 100.0),
),
__
TextFormField(
keyboardType: widget.buttonKeyboardType,
controller: widget.textEditingController,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: widget.IconButtonFuncation,
icon: Icon(
widget.icon,
color: Colors.white,
)),
prefixIcon: Padding(
padding: EdgeInsets.only(top: 15),
),
contentPadding: widget.contentPaddingText,
disabledBorder: InputBorder.none,
hintText: widget.buttonHinit,
hintStyle: TextStyle(
color: Theme.of(context).hintColor,
fontSize: 13,
fontFamily: 'Montserrat-Arabic',
fontWeight: FontWeight.w400,
),
filled: true,
fillColor: widget.butonColor,
//Theme.of(context).backgroundColor,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(8),
),
),
validator: (String value) {
if (value.isEmpty) {
return 'Feild is Required';
}
return null;
},
onSaved: (String value) {
// widget.userInput = value;
},
),
Concerning your buttons
You have placed your buttons in a Column, wausing them to be placed bellow each other. You should use a Row instead like so:
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
addCancelButton('Add'),
addCancelButton('Cancel')
],
)
Concerning your text field
Here it's because of the text field internal padding that you use:
/// GOOD
contentPaddingText: new EdgeInsets.symmetric(vertical: 50.0, horizontal: 10.0), // Reduce the horizontal padding
/// BAD
contentPaddingText: new EdgeInsets.symmetric(vertical: 50.0, horizontal: 100.0),

Flutter change password

I want to make a change password in my app using mysql but i dont know how to get the specific logged in id to change my password i have a dash board i am using cards on it so when i click the card with a name change password it will redirect
to this page i am using a mysql for my localdatabase.
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text('Change Password'),
backgroundColor: Color(0xff083663),
),
body: Form(
key: _key,
child: Center(
child: Column(
children: <Widget>[
SizedBox(
height: 30.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Change Password',
style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w900),
)
],
),
),
),
SizedBox(
height: 10.0,
),
//This is the field where you will enter the Current Password
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Please Enter Current Password";
}
return null;
},
obscureText: _secureText1,
onSaved: (e) => c1 = e,
decoration: InputDecoration(
labelText: 'Current Password',
suffixIcon: IconButton(
onPressed: showHide,
icon: Icon(_secureText1
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Please Enter New Password";
}
return null;
},
obscureText: _secureText2,
onSaved: (e) => c2 = e,
decoration: InputDecoration(
labelText: 'New Password',
suffixIcon: IconButton(
onPressed: showHide2,
icon: Icon(_secureText2
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
// this is the field for the verify password
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Verify Password";
}
return null;
},
onSaved: (e) => c3 = e,
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: 'Verify Password',
suffixIcon: IconButton(
onPressed: showHide3,
icon: Icon(_secureText3
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Divider(),
),
SizedBox(
height: 20.0,
),
Container(
height: 50,
width: 250,
child: RaisedButton(
onPressed: () {
check();
},
color: Color(0xffb5171d),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30.0))),
textColor: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.vpn_key,
color: Colors.white,
),
Text(
'Save Changes',
style: TextStyle(fontSize: 15),
),
SizedBox(
height: 20,
)
],
),
),
),
],
),
),
),
);
}
}