Flutter 自定义一个右侧可滑动 左侧为按钮的组件
var topicList = ["圈子话题1","圈子话题2","圈子话题3","圈子话题4-天气很好","圈子话题5","圈子话题6"];
@override
Widget build(BuildContext context){
return SizedBox(
height:40 ,
child:
Stack(
children:[
Container(
height: 40,
margin: EdgeInsets.fromLTRB( 10, 0, 40, 0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
for (int i = 0 ;i < topicList.length;i++)
//TopicItem为自定义组件
TopicItem(topicString: topicList[i]) ,
],
),//Row
),//SingleChildScrollView
),//Container
Container(
width: 40,
height:40,
margin: EdgeInsets.only(left:336),
child: ElevatedButton(
onPressed: ()=>{
},
style:const ButtonStyle(backgroundColor: MaterialStatePropertyAll(Colors.black)),
child:const Image(image: AssetImage("image/detail_cell.png"),),
),//ElevatedButton
)//Container
],//children
)//Stack
);//SizedBox
}
效果如下:
标签:Container,自定义,圈子,按钮,话题,40,child,Flutter From: https://www.cnblogs.com/huangczh/p/17962226