iampawan / 30DaysOfFlutter

Learn Flutter in 30 Days
413 stars 323 forks source link

Detail page says Bottom overflowed by 80 pixels. #17

Closed codydecode closed 2 years ago

codydecode commented 3 years ago

I guess the size problem comes from parent widgets. I tried using SingleChildScrolView but didnt work.

aditya-mahajan96 commented 3 years ago

Here is the sample code

import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart';

class CupertinoFormdemo extends StatelessWidget { const CupertinoFormdemo({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.cyan, body: SafeArea( child: SingleChildScrollView( child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'Sign Up', style: TextStyle( fontSize: 30, fontWeight: FontWeight.bold, color: Colors.redAccent), ), Text( 'Create your account', style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold, color: Colors.redAccent), ), CupertinoFormSection( header: Text("Personal Details"), children: [ CupertinoFormRow( child: CupertinoTextFormFieldRow( placeholder: "Enter name", ), prefix: Text('Name'), ), CupertinoFormRow( child: CupertinoTextFormFieldRow( placeholder: "Enter phone", ), prefix: Text('Phone'), error: Text("Phone no is not valid"), helper: Text("Eg- 9876****"), ), ]), CupertinoFormSection(header: Text("User Details"), children: [ CupertinoFormRow( child: CupertinoTextFormFieldRow( keyboardType: TextInputType.emailAddress, placeholder: "Enter Email", ), prefix: Text('Email'), ), CupertinoFormRow( child: CupertinoTextFormFieldRow( obscureText: true, placeholder: "Enter password", ), prefix: Text('Password'), ), CupertinoFormRow( child: CupertinoTextFormFieldRow( obscureText: true, placeholder: "Re enter password", ), prefix: Text('Re enter password'), ), ]), CupertinoFormSection( header: Text("Terms and Conditions"), children: [ CupertinoFormRow( child: CupertinoSwitch( value: true, onChanged: (value) {}), prefix: Text('I agree')), ], ), SizedBox( height: 20, ), Container( width: 150, alignment: Alignment.center, height: 50, color: Colors.green, child: TextButton( onPressed: () {}, child: Text( 'Sign Up', style: TextStyle(color: Colors.white), ))) ], ), ), ), )); } }