how to create a row of scrollable text boxes or widgets in flutter inside a ListView?

前端 未结 6 1097
悲哀的现实
悲哀的现实 2021-01-01 11:46

1.Please, can someone tell me how to create a row of text boxes that are scrollable to left or right in flutter inside a ListView. I can see that I am trying to define an in

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 11:51

    I have done this to make my Row widget scrollable:

    Text("Debilidades",
        style: TextStyle(fontWeight: FontWeight.bold)),
    SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
      child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: pokemon.weaknesses == null
              ? [
                  Text(
                    "No tiene debilidades",
                    style: TextStyle(color: Colors.grey),
                  )
                ]
              : pokemon.weaknesses
                  .map((weakness) => FilterChip(
                      backgroundColor: Colors.red,
                      label: Text(
                        weakness,
                        style: TextStyle(color: Colors.white),
                      ),
    
                      onSelected: (b) {}))
                  .toList()),
    ),
    

提交回复
热议问题