ios - iphone上的Flutter FloatingActionButton对齐有/没有缺口
问题描述
如代码中所写,我有三个浮动操作按钮。
不知何故,按钮对齐的行为与带有/不带有缺口的iPhone 不同。我想将按钮与按钮对齐。Search this area
在 Android 手机上测试它正确对齐。
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,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.fromLTRB(0, MediaQuery.of(context).padding.top + 100, 0, 0),
child: RaisedButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0)),
child: Text('Search this area'),
onPressed: () {}),
),
),
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, MediaQuery.of(context).padding.top + 120, 0, 0),
child: Column(
children: [
Container(
width: 40.0,
height: 40.0,
child: FloatingActionButton(
child: Icon(Icons.my_location),
onPressed: () {},
heroTag: null,
backgroundColor: Colors.red,
),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
width: 40.0,
height: 40.0,
child: FloatingActionButton(
child: Icon(Icons.map),
onPressed: () {},
heroTag: null,
backgroundColor: Colors.green,
),
),
],
),
),
FloatingActionButton(
onPressed: () {},
child: Icon(Icons.add),
heroTag: null,
),
],
),
);
}
}
截图
没有缺口 带缺口解决方案
这个问题注册到官方flutter仓库https://github.com/flutter/flutter/issues/71956
推荐阅读
- php - HTML 文本表单元素仅显示 PHP 数组中的第一个单词
- text - 如何创建文本文件、命名并填充内容?
- java - Microsoft Azure IoT 中心 (java) 通知“与服务器的连接丢失。重新连接 0 次。” 发送消息后
- amazon-web-services - AWS 中的 Terraform - 如何开始
- osgi - OSGi DS 原型参考未发布
- java - 正多边形与圆相交
- oracle - Oracle 存储过程,拆分 VARCHAR 并处理案例
- c# - C# 在 XML 错误中添加节点:“此操作将创建结构不正确的文档。”
- multithreading - 如何将 Tokio 线程池限制为一定数量的本机线程?
- c++ - C++ 语言环境是否有关联的时区?如果是,您如何访问它?