我想在水平网格视图中添加多个容器,这是我尝试过的代码,但iam只实现了一个记录显示,而不是多个。
行(主轴对齐:主轴对齐。结束,子项:[容器(//颜色:Colors.blue,子级:IconButton(//对IconData图标使用EvaIcons类:天气图标,按下:(){},),),文本(s温度+“\u2103”,文本对齐:文本左对齐,样式:文本样式(字体粗细:字体重量.w400,字体大小:14.sp,颜色:应用主题.灰色,),),],)],
),
children: [
Padding(
padding: EdgeInsets.only(top: 0.0, left: 10.w, right: 10.w),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
color: Colors.white,
elevation: 10,
child:
Row(
children: [
Padding(padding: EdgeInsets.only(
top: 5.h, left: 10.w, right: 0.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 70.w,
height: 70.h,
//color: Colors.red,
child: weatherIconInside
),
Text(
'$weatherDesc',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 14.sp,
letterSpacing: 0.2,
color: AppTheme.grey,
),
),
],
)
),
Padding(padding: EdgeInsets.only(
top: 5.h, left: 20.w, right: 0.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Min',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16.sp,
letterSpacing: 0.2,
color: AppTheme.grey,
),
),
Text(
'18 ' + '\u2103',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
letterSpacing: 0.2,
color: AppTheme.grey,
),
),
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.black, width: 10.0),
),
),
),
Text(
'Max',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16.sp,
letterSpacing: 0.2,
color: AppTheme.grey,
),
),
Text(
'28 ' + '\u2103',
textAlign: TextAlign.left,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
letterSpacing: 0.2,
color: AppTheme.grey,
),
),
SizedBox(height: 10.h,)
],
)
),
],
)
),
)
],
),
); }
i was calling 5 days wheather api and wanted to display in horizontal grid view in list
1条答案
按热度按时间fnvucqvd1#
尝试用Flexible Widget Package 每个Column小部件。