PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 13, 2022

[FIXED] how to display listview inside alert in flutter

 September 13, 2022     android, cross-platform, flutter, flutter-layout     No comments   

Issue

i am using rflutter_alert plugin to handle alerts in my App using Flutter but i have an issue when I put listView for parameter content other widgets like Text work without issues

i am getting the following error

Exception caught by rendering library ═════════════════════════════════════════════════════ The following assertion was thrown during performLayout(): RenderViewport does not support returning intrinsic dimensions.

Expanded(
  child: Card(
    child: ListView.builder(
        itemCount: content.length,
        itemBuilder: (ctx, index) {
          return ListTile(title: Text(content[index]["doctor_name"]),
          onTap: (){
            Alert(
              context: context,
              title: doctors[index]["doctor_name"],
              content: ListView(children: <Widget>[
                Text(doctors[index]["major"]),
                Text(doctors[index]["hospital"]),
              ],)
            ).show();
          },
          );
        }),
  ),
)

this is the pluing url rflutter_alert

could you please help in this issue ?


Solution

You could try and wrap it into container and set width/height

   onTap: (){
        Alert(
          context: context,
          title: doctors[index]["doctor_name"],
          content: Container(
            width: 100,
            height: 100,
            child: ListView(children: <Widget>[
               Text(doctors[index]["major"]),
               Text(doctors[index]["hospital"]),
          ],))
        ).show();


Answered By - Nuts
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing