激活键盘时,persistentFooterButtons 被覆盖。
...
persistentFooterButtons: <Widget>[
ButtonBar(
children: [
IconButton(
iconSize: 15,
onPressed: () {},
icon: Icon(Icons.east, color: Colors.green),
),
IconButton(
iconSize: 15,
onPressed: () {},
icon: Icon(Icons.api, color: Colors.blue),
),],),],
); //Scaffold
激活键盘后,图标应显示在键盘上方。
您需要检测键盘是否可见。
为此,您应该在当前上下文中使用验证:
View.of(context).viewInsets.bottom == 0;
这意味着您的键盘已关闭。
View.of(context).viewInsets.bottom != 0;
这意味着您的键盘可见。
通过此验证,您可以创建一个条件来显示或隐藏,或移动按钮。
写入浮动操作按钮
例如:
floatingActionButton: Column(
children: [
Row(
children: [
Expanded(child: Container()),
FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
],
),
Container(
height: 1, color: Colors.grey , margin: EdgeInsets.only(top: 10 , left: 30),
),
Container(
child: ButtonBar(
children: [
IconButton(
iconSize: 15,
onPressed: () {},
icon: Icon(Icons.extension, color: Colors.green),
),
IconButton(
iconSize: 15,
onPressed: () {},
icon: Icon(Icons.ac_unit, color: Colors.blue),
),
],
),
)
],
mainAxisAlignment: MainAxisAlignment.end,
), //