flutter - 如何在 Flutter 中实现这种布局?我尝试使用堆栈和溢出框,但它仍然看起来不一样
解决方案
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(20, 10, 0, 10),
child: Container(
width: 200,
height: 40,
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue,
width: 2,
),
borderRadius: BorderRadius.circular(15),
),
),
),
Positioned(
left: 0,
top: 0,
child: Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.grey,
border: Border.all(
color: Colors.blue,
width: 2
),
borderRadius: BorderRadius.circular(50),
),
)
),
],
),
),
);
}
推荐阅读
- wordpress - 在 htaccess [WordPress] 中重定向分页 URL
- python - POST 返回“详细信息”:“方法 \"GET\" 不允许。”
- python - 获取列表中重复次数最多的元素重复的次数
- rust - Rust 反序列化:将字节向量转换为 uuid 的哈希集
- html - 简单的初学者问题:在下拉列表中随机启动选项?
- c# - C# - 对不止一个词使用自动完成
- google-data-studio - 尝试加载 repo 信息时,Github 连接器 Google Data Studio 抛出错误
- python - 在列表列表中转换 pd.DataFrame,同时为空文本“”替换“np.nan”值
- css - 在反应js中设置背景并模糊图像背景
- html - TailwindCSS - 修复了 flex 父级的 div 全宽