Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

flutter: Specify listTile height

  • 0

In this code, I am trying to make a list of buttons or tile “as buttons doesnot works well for me ” in the very top of the page. Thus, when one is clicked it return a value in the rest of the page.

The issue is: The tile here toke around more than half of the page which make it looks inconsistent. I want to limit the height of the tile, I have tried putting them in a row and a container and it doesn’t work. Any HELP will be appreciated.

the result after running the code is:

this is the error after runing the code :

 

Share

1 Answer

  1. Just remove the Expanded Widget to avoid fill the space available and use a parent Container with a fixed height, the same as the itemExtent value:

        Column(
                      children: <Widget>[
                        Container(
                          height: 100.0,
                          child: ListView.builder(
                              scrollDirection: Axis.horizontal,
                              itemExtent: 100.0,
                              itemCount: temp.length,
                              itemBuilder: (BuildContext context, int index) {
                                return ListTile(
                                    title: Text(temp[index]),
                                    onTap: () {
                                      print(temp[index]);
                                    });
                              }),
                        ),
                        Container(
                          child: Text('data'),
                        )
                      ],
                    ),

    • 0
Leave an answer

Leave an answer

Browse

close