颤动 - 键盘在屏幕上抬起FloatingActionButton

raf*_*b21 6 dart flutter

我正在使用TextField但是键盘正在提升FloatingActionButton.我想知道键盘是否有可能不提高FloatingActionButton

在下面的代码中,我FloatingActionButton用两种不同的方式放两个,但是在两个键盘都上升,这阻碍了字段填充,因为FAB与TextField下面的gif 在同一行.

有什么方法可以解决这个问题吗?

在此输入图像描述

import 'package:flutter/material.dart';
import 'dart:ui' as ui;

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(      
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    final ui.Size logicalSize = MediaQuery.of(context).size;
    final double _width = logicalSize.width;
    return new Scaffold(
      appBar: new AppBar(backgroundColor: new Color(0xFF26C6DA)),        
      body: new Stack(
        children: <Widget>[
          new ListView(
            children: <Widget>[
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
              new TextField(
                decoration: const InputDecoration(
                  labelText: "Description",
                ),
                style: Theme.of(context).textTheme.title,
              ),
            ],
          ),
          new Positioned(
            bottom: 16.0,
            left: (_width / 2) - 28,   
            child: new FloatingActionButton(
              backgroundColor: new Color(0xFFE57373),
              child: new Icon(Icons.check),
              onPressed: (){}
            ),            
          )
        ],        
      ),
      floatingActionButton: new FloatingActionButton(
        backgroundColor: new Color(0xFFE57373),
        child: new Icon(Icons.check),
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

Col*_*son 6

您似乎正在设计一个全屏对话框。

浮动动作按钮代表应用程序中的主要动作,例如创建新项目。它不是用来确认更改并关闭包含文本字段列表的全屏对话框的工具。

与其使用a FloatingActionButton,不如在Material设计示例中,我建议在插槽中AppBar使用a :FlatButtonactions

保存

您可以在Gallery源代码中的Flutter中看到一个如何构建全屏对话框的示例。