flutter - AppBar中的分隔线没有出现
问题描述
我正在努力弄清楚为什么我的应用栏中的分隔线没有出现。当我增加分隔线的高度时,我注意到我的小部件向上移动。我查看了类似的问题,但没有一个有效。我的 appBar 由两列和一行组成,用于用户个人资料信息和有关其“合作伙伴”的信息。我想使用分隔符将合作伙伴名称和用户名与赢/输比率分开。强文本
Widget build(BuildContext context) {
final user = Provider.of<User>(context);
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF2430346),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(100.0),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(left:20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildUserInfo(user),
Text(
"@username",
style: new TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.white,
)
)
],
),
),
),
Padding(
padding: const EdgeInsets.only(right:70.0),
child: Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"My Partner",
style: new TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
Text(
"Dorian",
style: new TextStyle(
color: Colors.white,
),
),
Text(
"@Doetheman",
style: new TextStyle(
color: Colors.white,
),
),
// Mfer aint appearing
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 10, bottom: 10),
child: Divider(
height: 2.0,
color: Colors.white,
),
),
],
),
),
),
],
),
),
),
),
Widget _buildUserInfo(User user) {
return Column(
children: [
Avatar(
photoUrl: user.photoUrl,
radius: 40,
borderColor: Colors.black54,
borderWidth: 2.0,
),
const SizedBox(height: 8),
if (user.displayName != null)
Text(
user.displayName,
style: TextStyle(color: Colors.white),
),
const SizedBox(height: 8),
],
);
}
}
我希望它在视图中显示的内容: 在此处输入图像描述
解决方案
您可以使用这样的容器来代替分隔符
Container(
alignment: Alignment.center,
width: 250,
height: 1,
color: Colors.black
),
推荐阅读
- javascript - redux:Array.find() 不是函数
- python - 解码 unix 时间戳
- javascript - 如何在角度 8 中悬停时显示来自 json 的表列数据
- fullcalendar - 将当前视图传递到 FullCalendar JSON 提要 url
- abap - 如何使用 WHERE 条件中的关联值从 ABAP SQL 使用 CDS?
- python - python groupby多列,计数和百分比
- ios - Swift 5 Json 解析错误“dataCorrupted”
- python - 将地址转换为 PyKD 可以使用/等效于 WinDbg 的数字?命令
- leaflet - Mapbox studio - png 标签层 - 透明度显示为黑色
- hibernate - 如何在 JPA 中使用动态分组查询