Reputation: 93
i want my bottom widget to push on top when keyboard focused because it hide the the bottom widget please help me how can i resolve and i have some more widgets but i want to my bottom widget to show up on screen
body: Column(
children: [
Container(
color: Colors.black,
height: MediaQuery.of(context).size.height * 0.6,
),
Container(
padding: EdgeInsets.fromLTRB(10, 20, 10, 0),
height: MediaQuery.of(context).size.height * 0.4,
child: Column(
children: [
Column(
children: [
Align(),
Padding()
Container(),
SizedBox(height: 20),
Container(),
SizedBox(height: 20),
GestureDetector(),
SizedBox(height: 15),
Text.rich(
TextSpan(),
),
],
),
],
),
)
],
),
Upvotes: 0
Views: 663
Reputation: 63749
You can include resizeToAvoidBottomInset:true
it is will shrink the size on keyboard appear(default).
If you use resizeToAvoidBottomInset: false,
wrap the body with scollable widget. like
body: SingleChildScrollView( child: Column(...
To check keyboard visibility, you can check flutter_keyboard_visibility and and use a scrollController to move bottom.
return KeyboardVisibilityBuilder(
builder: (context, isKeyboardVisible) {
if (isKeyboardVisible){
controller.animateTo(
controller.position.maxScrollExtent,
curve: Curves.bounceIn,
duration: Duration(milliseconds: 100)
);
}
return ListView(
controller: controller,
),
);
Upvotes: 1