在iPhoneX上颤抖的SafeArea和Align看起来很奇怪

时间:2018-11-28 00:21:39

标签: flutter

我想显示视频和类似的按钮。

Scaffold(
  backgroundColor: Colors.black,
  body: SafeArea(
      child: Stack(
        children: <Widget>[
          Center(
            child: AspectRatio(
              aspectRatio: _videoPlayer.value.aspectRatio,
                child: VideoPlayer(_videoPlayer)
            ),
          ),
          Align(
            alignment: Alignment.topCenter,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                IconButton(
                  icon: Icon(Icons.clear, color: Colors.white),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                ),
                IconButton(
                  icon: Icon(Icons.add, color: Colors.white),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                )
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 16.0),
            child: Align(
              alignment: Alignment.bottomCenter,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Expanded(
                    child: RaisedButton(
                      child: Text('Dummy Text'),
                      color: Colors.white,
                      onPressed: () {},
                    ),
                  ),
                  SizedBox(width: 10.0),
                  FloatingActionButton(
                    child: Icon(Icons.more_horiz, color: Colors.black),
                    backgroundColor: Colors.white,
                    onPressed: () {
                      Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(builder: (_) => Page1()));
                    },
                  )
                ],
              ),
            ),
          )
        ],
      ),
    )
  );

看起来不错,但有点奇怪。对齐的按钮位于视频边缘的中间和视频外部。 看起来像这样。

这是因为视频的宽高比不合适,因为这里link出现了问题? 我该如何在视频外部对齐按钮?

0 个答案:

没有答案