Flutter prevent listview showing in new line

423

Try using Wrap widget. For example, like this.

final List<String> ayahs = ['This', 'is', 'a', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'very', 'long', 'text'];

  @override
  Widget build(BuildContext context) {
    return Wrap(
      children: ayahs
          .map((element) => Text(element))
          .toList(),
    );
  }
Share:
423
zia sultan
Author by

zia sultan

Full stack web developer and mobile application developer with Php, Laravel, Nodejs, ReactJs, Golang, Web socket, Microservice, Pub sub, docker, kubernetes, Android, iOS and Flutter skills. Love to work on startups

Updated on December 29, 2022

Comments

  • zia sultan
    zia sultan over 1 year

    I want to show my listview in same line one after another but listview showing every item in every new line. How can I prevent to show in new line. So that it shows like paragraph

    ListView.builder(
          shrinkWrap: true,
          itemCount:
          controller.page.value.data.ayahs.length,
          itemBuilder: (context, index) {
             return Text(controller.page.value.data.ayahas[index].name);
         })
    

    Please look at this photo. I want to show text like this one after another instead of new line Listview Text one after another

    • Admin
      Admin about 3 years
      could you put a picture of the problem please??