Scaffold persistentFooterButtons is hidden by keyboard

1,055 views
Skip to first unread message

ZP L

unread,
Nov 15, 2018, 2:49:07 AM11/15/18
to Flutter Dev
But persistentFooterButtons is hidden by keyboard, Is this a bug ?

Sample code

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
TextField(
decoration: InputDecoration(
hintText: 'Anything',
),
),
],
),
)),
persistentFooterButtons: [
FlatButton(
child: Text('SubmitAAAA'),
onPressed: () {},
),
FlatButton(
child: Text('SubmitBBBB'),
onPressed: () {},
),
]);
}
}

 

Before I clicked TextField:

251542267717_.pic.jpg


After:


261542267718_.pic.jpg



What I want is a persistentFooterButton always Persistent event keyboard pops up.

Luis Rodrigues

unread,
Nov 15, 2018, 10:41:29 AM11/15/18
to Flutter Dev
Hi,

I think you have to use the "resizeToAvoidBottomPadding" property and set it to "true".
Hope it works.

ZP L

unread,
Nov 15, 2018, 8:28:16 PM11/15/18
to lui...@gmail.com, flutt...@googlegroups.com
From the doc, "Defaults to ture":

/// Whether the [body] (and other floating widgets) should size themselves to
/// avoid the window's bottom padding.
///
/// For example, if there is an onscreen keyboard displayed above the
/// scaffold, the body can be resized to avoid overlapping the keyboard, which
/// prevents widgets inside the body from being obscured by the keyboard.
///
/// Defaults to true.
final bool resizeToAvoidBottomPadding;


Luis Rodrigues <lui...@gmail.com> 于2018年11月15日周四 下午11:41写道:
Hi,

I think you have to use the "resizeToAvoidBottomPadding" property and set it to "true".
Hope it works.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
--刘志平

ZP L

unread,
Nov 15, 2018, 8:33:24 PM11/15/18
to lui...@gmail.com, flutt...@googlegroups.com
Already try to set resizeToAvoidBottomPadding to true and false, doesn't help, It only change the 'body' behavior, not the bottom.

ZP L <flyi...@gmail.com> 于2018年11月16日周五 上午9:28写道:


--
--刘志平

Benedicte Roussel

unread,
Nov 19, 2018, 12:23:30 PM11/19/18
to lui...@gmail.com, ZP L, flutt...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages