2

i am really new to flutter , trying to learn designing part. whatever i did to adjust the size of the form its not getting into shape. its showing overflow error and not showing form full screen.

 class CustomerInfo extends StatefulWidget { @override _CustomerInfoState createState() => _CustomerInfoState(); } class _CustomerInfoState extends State<CustomerInfo> { TextEditingController customername = TextEditingController(text: 'Customer Name'); TextEditingController customerid = TextEditingController(text: 'CR20211212'); TextEditingController customertype = TextEditingController(text: 'CR'); TextEditingController contactno = TextEditingController(text: '12345678'); TextEditingController contactperson = TextEditingController(text: 'Person to Contact'); TextEditingController contactpersonposition = TextEditingController(text: 'Position of the Person'); TextEditingController mobileno = TextEditingController(text: '12345678'); TextEditingController tradelicense = TextEditingController(text: 'TR1000'); TextEditingController trdExpiry = TextEditingController(text: '2021/12/12'); TextEditingController place = TextEditingController(text: 'Location'); TextEditingController TRN = TextEditingController(text: '100012345123450'); TextEditingController notes = TextEditingController(text: 'Some notes'); TextEditingController active = TextEditingController(text: 'Customer Active'); @override Widget build(BuildContext context) { Widget subTitle = Padding( padding: const EdgeInsets.only(right: 56.0, top: 0.0), child: Text( 'Limited information only you can modify!!!', style: TextStyle( color: Colors.white, fontSize: 14.0, ), )); Widget registerButton = Positioned( left: MediaQuery.of(context).size.width / 4, child: Container( width: MediaQuery.of(context).size.width / 2, height: 30, child: Center( child: new Text("Update", style: const TextStyle( color: const Color(0xfffefefe), fontWeight: FontWeight.w600, fontStyle: FontStyle.normal, fontSize: 16.0))), decoration: BoxDecoration( color: Colors.blueGrey, boxShadow: [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.16), offset: Offset(0, 5), blurRadius: 10.0, ) ], borderRadius: BorderRadius.circular(9.0)), ), ); Widget registerForm = Container( height: MediaQuery.of(context).size.height / 2, child: SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( children: <Widget>[ Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, padding: const EdgeInsets.only(left: 32.0, right: 12.0), decoration: BoxDecoration( color: Color.fromRGBO(255, 255, 255, 0.8), borderRadius: BorderRadius.only( topLeft: Radius.circular(10), bottomLeft: Radius.circular(10))), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: customername, style: TextStyle(fontSize: 16.0), decoration: InputDecoration(labelText: 'Customer Name'), enabled: false, ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: customerid, style: TextStyle(fontSize: 16.0), decoration: InputDecoration(labelText: 'Customer ID'), enabled: false, ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: contactno, style: TextStyle(fontSize: 16.0), decoration: InputDecoration(labelText: 'Contact No'), ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: contactperson, style: TextStyle(fontSize: 16.0), decoration: InputDecoration(labelText: 'Contact Person'), ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: contactpersonposition, style: TextStyle(fontSize: 16.0), decoration: InputDecoration( labelText: 'Contact Person Position'), ), ), Padding( padding: const EdgeInsets.only(top: 8.0), child: TextField( controller: mobileno, style: TextStyle(fontSize: 16.0), decoration: InputDecoration(labelText: 'Mobile No'), ), ), ], ), ), ], ))); Widget socialRegister = Column( children: <Widget>[ Text( 'Please take approval for any kind of other modifications!!!', style: TextStyle( fontSize: 12.0, fontStyle: FontStyle.italic, color: Colors.white), ), ], ); return Scaffold( appBar: AppBar( title: Text('Customer Information'), centerTitle: true, backgroundColor: Colors.blue.shade200, ), backgroundColor: Colors.white70, body: Stack( children: <Widget>[ Container( // Padding( alignment: Alignment.topRight, padding: const EdgeInsets.only(left: 28.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ subTitle, SizedBox(height: 10), // Expanded(child: Container(child: registerForm)), registerForm, Container( alignment: Alignment.bottomRight, child: registerButton, ), Spacer(flex: 2), Padding( padding: EdgeInsets.only(bottom: 5), child: socialRegister) ], ), ) ], ), ); } } 

Trying to show some customer details and some information change from user side.i tried to use expand and tried manually put the height also.

2
  • what was the error? for overflow error in flutter , your code running well Commented Dec 27, 2021 at 11:39
  • bottom overflowed by 26pixels also the form is showing half of the screen. i tried to adjust the padding too. Commented Dec 27, 2021 at 11:40

2 Answers 2

1

Try below code hope its help to you. add your Column inside SingleChildScrollView() and remove Spacer

Refer my answer here

Refer SingleChildScrollView here

body: SingleChildScrollView( child:Column( children:[ //Declare Your Widgets Here ], ), ), 

Updated code:

Widget registerButton = Container( width: MediaQuery.of(context).size.width / 2, height: 30, child: Center( child: new Text("Update", style: const TextStyle( color: const Color(0xfffefefe), fontWeight: FontWeight.w600, fontStyle: FontStyle.normal, fontSize: 16.0))), decoration: BoxDecoration( color: Colors.blueGrey, boxShadow: [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.16), offset: Offset(0, 5), blurRadius: 10.0, ) ], borderRadius: BorderRadius.circular(9.0)), ); 
Sign up to request clarification or add additional context in comments.

7 Comments

now the form is half of the screen
also returning this error on debug console. Incorrect use of ParentDataWidget.
Change your registerButton Widget and remove Positioned Widget check my updated answer for registerButton
error is gone... and i changed this line to height: 600, // MediaQuery.of(context).size.height, (600) fixed is it okey the size for devices. i mean overflow error. otherwise screen still half of the screen.
If you want want your Add extra spaces in between Textfields then add SizedBox() in two widgets.
|
0

wrap you column with SingleChildScrollView and remove spacer() and use expanded because SingleChildScrollView make container height infinity

3 Comments

you can use socialRegister widget in bottom navigation
socialRegister even i removed this when i am click inside the textbox it will show overflow error.
did you wrap your column with SingleChildScrollView ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.