nick.tdr
nick.tdr

Reputation: 4933

Widgets overflows when soft keyboard opens

I am using TabBarView with tabs in flutter. My tab bar view contains input form. Now when the keyboard opens the widgets overflows

I tried using Listview and SingleChildScrollView to avoid this issue but its not working for me. When using ListView or SingleChildScrollView the screen goes blank.

@override Widget build(BuildContext context) { SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); return new Scaffold( resizeToAvoidBottomPadding: true, body: SafeArea( child: DefaultTabController( length: 2, child: Column( children: <Widget>[ Expanded( flex: 0, child: TabBar( tabs: [ Tab(text: 'Sign In'), Tab(text: 'Sign Up'), ], labelColor: Theme.of(context).primaryColor, unselectedLabelColor: Colors.grey, indicatorPadding: const EdgeInsets.symmetric(horizontal: 16.0), labelPadding: const EdgeInsets.symmetric(vertical: 4.0), ), ), Expanded( flex: 1, child: TabBarView( children: [_buildSignInForm(), _buildSignupForm()]), ) ], ), ), ), backgroundColor: Colors.white, ); }

Upvotes: 0

Views: 348

Answers (1)

Mazin Ibrahim
Mazin Ibrahim

Reputation: 7889

Wrap your Column inside a Container widget and set the height to match the screen height by :

`height: MediaQuery.of(context).size.height,`

Upvotes: 1

Related Questions