Элементы в строке переполнены - PullRequest
0 голосов
/ 23 марта 2020

У меня есть 20 пунктов в списке. Чтобы отобразить эти элементы в строке, необходимо только 100 или 4 элемента (в зависимости от длины элемента) в строке. Это мой код Выходные данные iam: my output screen

 Widget build(BuildContext context) {
    var screenSize = MediaQuery.of(context).size;
    var width = screenSize.width;

    return Scaffold(
      body: Container(
        height: 50,
        width: width,
        color: Theme.of(context).primaryColor,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: List.generate(selectedStudentsIT.length, (index) {
            return Wrap(
              children: <Widget>[
                Container(
                  width: 100,
                  child: Card(
                    color: Colors.white,
                    semanticContainer: true,
                    clipBehavior: Clip.antiAliasWithSaveLayer,
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10.0),
                    ),
                    elevation: 5,
                    margin: EdgeInsets.all(10),
                    child: Center(
                      child: Text(
                        "myowntext",// item from the list using the index
                        style: TextStyle(
                          color: Colors.blue,
                          fontWeight: FontWeight.bold,
                          fontSize: 15.0,
                        ),
                      ),
                    ),
                  ),
                )
              ],
            );
          }),
        ),
      ),
    );
  }

Я пробовал использовать виджет WRAP, Flex и также расширился. Но это не решило мою проблему. Пожалуйста, помогите.

1 Ответ

2 голосов
/ 23 марта 2020

Оберните свою строку с SingleChlidScrollView.

SingleChildScrollView(scrollDirection:Axis.horizontal,child:Row(children......
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...