Lash
Lash

Reputation: 353

ExpansionTile and SingleChildScrollView not working together in Flutter?

How can I avoid the overflowing in my text when using ExpansionTile widget? When I was not using this widget my text was not overflowing and using SingleChildScrollView was enough.

ExpansionTile(
    title: Text('History'),
    children: [
        SingleChildScrollView(
            child:Text(widget.descriptionText as String),
        ),
    ]
)

Upvotes: 1

Views: 677

Answers (1)

Kaushik Chandru
Kaushik Chandru

Reputation: 17734

A single child scroll view can take infinite height if not bound. You can try wrapping it with a SizedBox of a specific height:

ExpansionTile(
    title: Text('History'),
    children: [
      SizedBox(
        height: 500,
        width: MediaQuery.of(context).size.width*0.7,
        child: SingleChildScrollView(
            child:Text(widget.descriptionText as String),
        ),
    )
    ]
)

Upvotes: 3

Related Questions