Android 按钮在自定义列表项中的位置
我正在尝试[![make the button][1]][1]在列表项的一角,但它不起作用 这就是我试过的Android 按钮在自定义列表项中的位置,android,flutter,flutter-layout,flutter-widget,Android,Flutter,Flutter Layout,Flutter Widget,我正在尝试[![make the button][1]][1]在列表项的一角,但它不起作用 这就是我试过的 Container( margin: EdgeInsets.all(5), padding: EdgeInsets.all(10), color: Colors.black12, child: Row( mainAxisSize
Container(
margin: EdgeInsets.all(5),
padding: EdgeInsets.all(10),
color: Colors.black12,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
height: 100,
width: 100,
color: Colors.black,
child: Image.network(_items[index]['product_img']),
),
Container(
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
child: Container(
padding: const EdgeInsets.all(8.0),
child: Text(_items[index]['product_name']),
),
),
Container(
padding: const EdgeInsets.all(8.0),
child: Text('M.R.P: ₹ ' +
_items[index]['product_price']),
),
Container(
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Align(
alignment: Alignment.bottomRight,
child: Container(
padding: EdgeInsets.all(8),
child: ElevatedButton(
child: Text("Add +"),
onPressed: () =>
print("it's pressed"),
style: ElevatedButton.styleFrom(
primary: Colors.red,
onPrimary: Colors.white,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(32.0),
),
),
),
),
),
],
),
)
],
),
)
试图设置尺寸,但也不起作用,在其中一个建议中,我被告知放置横轴,我也尝试过,但仍然不起作用
[1] :在按钮将
Spacer()
放置为行的子级之前,这将执行一个技巧,但按钮不可见,然后从行中删除mainAxisSize:mainAxisSize.max
。