flutter - MainAxisSize.SpaceEvenly 没有在小部件中提供相等的空间
问题描述
这是代码
body: Center(
child: Column(
children: [
Row(
children: [
CircleAvatar(
backgroundImage: NetworkImage(
'https://raw.githubusercontent.com/flutter/website/master/examples/layout/sizing/images/pic1.jpg'),
radius: 50,
),
SizedBox(
width: 30,
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('Post'),
Text('Followers'),
Text('Following')
],
),
)
],
),
],
),
),
解决方案
试试下面的代码希望它对你有帮助,用过的 ListTile 小部件也可以在这里参考 ListTile ,在这里参考我的答案以获得相同的设计
ListTile(
leading: CircleAvatar(
backgroundImage: NetworkImage(
'https://raw.githubusercontent.com/flutter/website/master/examples/layout/sizing/images/pic1.jpg',
),
radius: 50,
),
title: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('Post'),
Text('Followers'),
Text('Following'),
],
),
),
),
推荐阅读
- ios - 修复 iOS 应用程序中的内存管理问题
- vue.js - 避免直接改变 prop,因为每当父组件重新渲染时,该值都会被覆盖
- javascript - 为什么固定列不能使用数据表工作?
- java - 在运行时获取错误 jar 不存在
- api - 如何在 SOAP Web 服务中设计标头信息?
- jboss - 是否可以在 jBPM 中集成 Salesforce 或 facebook
- mule - mule 中 APIkit 和 APIkit 控制台组件的区别?
- javascript - 如果选中复选框,如何更改背景颜色,由 id 选择
- ios - 具有动态高度的 TableViewHeader
- python - 无法解码 JSON 对象,但输入为 JSON 格式