Flutter 如何在颤振中定位这些图标?
我试图从Gmail中重新创建布局,但我不知道如何在布局中定位图标 以下是我希望这些图标的外观: 下面是我在《颤栗》中已经做过的一张图片: 我希望图标之间有一个空间,我希望它们的高度与“麦当劳波兰”相同 有人能帮我吗 代码:Flutter 如何在颤振中定位这些图标?,flutter,dart,Flutter,Dart,我试图从Gmail中重新创建布局,但我不知道如何在布局中定位图标 以下是我希望这些图标的外观: 下面是我在《颤栗》中已经做过的一张图片: 我希望图标之间有一个空间,我希望它们的高度与“麦当劳波兰”相同 有人能帮我吗 代码: 导入“包装:颤振/材料.省道”; 类GeneratedMailCouponScreen扩展了无状态小部件{ 最终字符串耦合图像; GeneratedMailCouponScreen({Key-Key,@required this.couponImage}):super(K
导入“包装:颤振/材料.省道”;
类GeneratedMailCouponScreen扩展了无状态小部件{
最终字符串耦合图像;
GeneratedMailCouponScreen({Key-Key,@required this.couponImage}):super(Key:Key);
@凌驾
小部件构建(构建上下文){
返回脚手架(
背景颜色:Colors.white,
正文:安全区(
子:容器(
填充:所有边缘设置(16.0),
子:列(
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
图标(
图标。返回箭头
)
],
),
划船(
儿童:[
图标(
图标.存档
),
尺寸箱(宽度:5.0),
图标(
图标。删除
),
尺寸箱(宽度:5.0),
图标(
Icons.mail
),
尺寸箱(宽度:5.0),
图标(
图标。更多信息
)
],
)
],
),
尺寸箱(高度:16.0),
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
文本(“凭证”,样式:TextStyle(颜色:Colors.black,fontSize:18.0)),
尺寸箱(宽度:8.0),
容器(
颜色:颜色。灰色[200],
孩子:填充(
填充:从LTRB(4,2,4,2)开始的边缘设置,
子项:文本('Odebrane',样式:TextStyle(颜色:Colors.black,fontSize:12.0)),
),
)
],
),
划船(
儿童:[
图标(
图标.star\u边框
)
],
)
],
),
尺寸箱(高度:16.0),
划船(
儿童:[
容器(
身高:45.0,
宽度:45.0,
装饰:盒子装饰(
颜色:颜色。蓝色[100],
形状:BoxShape.circle
),
儿童:中心(
子项:文本('M',样式:TextStyle(fontSize:20.0),),
)
),
划船(
儿童:[
纵队(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
划船(
儿童:[
Text('McDonalds Poland',样式:TextStyle(颜色:Colors.black)),
尺寸箱(宽度:8.0),
文本('Wczoraj',样式:TextStyle(颜色:Colors.grey))
],
),
划船(
儿童:[
Text('do mnie',style:Text样式(颜色:Colors.grey)),
图标(
Icons.expand\u更多信息
)
],
)
],
),
划船(
儿童:[
图标(
图标。回复
),
图标(
图标。更多信息
)
],
)
],
)
],
)
],
),
),
),
);
}
}
我对您的代码做了一些修改,请检查它是否适合您
我做了一些改变。现在这些图标的高度与文本高度相同,我希望对你有用
@覆盖
小部件构建(构建上下文){
返回脚手架(
背景颜色:Colors.white,
正文:安全区(
子:容器(
填充:所有边缘设置(16.0),
子:列(
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
子项:[图标(图标。箭头返回)],
),
划船(
儿童:[
图标(Icons.archive),
尺寸箱(宽度:5.0),
图标(Icons.delete),
尺寸箱(宽度:5.0),
图标(Icons.mail),
尺寸箱(宽度:5.0),
图标(图标。更多内容)
],
)
],
),
尺寸箱(高度:16.0),
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
小孩
import 'package:flutter/material.dart';
class GeneratedMailCouponScreen extends StatelessWidget {
final String couponImage;
GeneratedMailCouponScreen({Key key, @required this.couponImage})
: super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Container(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [Icon(Icons.arrow_back)],
),
Row(
children: [
Icon(Icons.archive),
SizedBox(width: 5.0),
Icon(Icons.delete),
SizedBox(width: 5.0),
Icon(Icons.mail),
SizedBox(width: 5.0),
Icon(Icons.more_vert)
],
)
],
),
SizedBox(height: 16.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Text(
'Voucher',
style: TextStyle(color: Colors.black, fontSize: 18.0),
),
SizedBox(width: 8.0),
Container(
color: Colors.grey[200],
child: Padding(
padding: EdgeInsets.fromLTRB(4, 2, 4, 2),
child: Text(
'Odebrane',
style:
TextStyle(color: Colors.black, fontSize: 12.0),
),
),
)
],
),
Row(
children: [Icon(Icons.star_border)],
)
],
),
SizedBox(height: 16.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 45.0,
width: 45.0,
decoration: BoxDecoration(
color: Colors.blue[100], shape: BoxShape.circle),
child: Center(
child: Text(
'M',
style: TextStyle(fontSize: 20.0),
),
),
),
SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'McDonalds Poland',
style: TextStyle(color: Colors.black),
),
SizedBox(width: 8.0),
Text(
'Wczoraj',
style: TextStyle(color: Colors.grey),
)
],
),
Row(
children: [
Text('do mnie',
style: TextStyle(color: Colors.grey)),
Icon(Icons.expand_more)
],
)
],
),
Spacer(flex: 1,),
Row(
children: [Icon(Icons.reply), Icon(Icons.more_vert)],
)
],
)
],
),
),
),
);
}
}
return Scaffold(
body: Container(
padding: EdgeInsets.only(top: 50),
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
height: 45.0,
width: 45.0,
decoration: BoxDecoration(
color: Colors.blue[100], shape: BoxShape.circle),
child: Center(
child: Text(
'M',
style: TextStyle(fontSize: 20.0),
),
)),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text('McDonalds Poland',
style: TextStyle(color: Colors.black)),
SizedBox(width: 8.0),
Text('Wczoraj',
style: TextStyle(color: Colors.grey))
],
),
Row(
children: [
Text('do mnie',
style: TextStyle(color: Colors.grey)),
Icon(Icons.expand_more)
],
)
],
),
],
),
Container(
padding: EdgeInsets.only(top: 50),
child: Row(
children: [
Icon(Icons.reply),
Icon(Icons.more_vert)
],
),
)
],
)
])),
);