Home > Software engineering >  How to use read more option in flutter html?
How to use read more option in flutter html?

Time:09-14

Here I want to know about how to use read more option for text in flutter html.

I did not find any solution.

This is my code

 Html(
              data: "${productDetailsData['description']}",
              tagsList: Html.tags..addAll(["bird", "flutter"]),
              style: {
                '#': Style(
                  fontSize: FontSize(12),
                  fontWeight: FontWeight.w400,
                  color: Color(0xffA5AAB4),
                  margin: EdgeInsets.zero,
                  padding: EdgeInsets.zero,
                  fontStyle: FontStyle.normal,
                ),
              },
            ),

CodePudding user response:

try this one

body:  SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(16.0),
                child: ExpandableText(
                  'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque scelerisque efficitur posuere. Curabitur tincidunt placerat diam ac efficitur. Cras rutrum egestas nisl vitae pulvinar. Donec id mollis diam, id hendrerit neque. Donec accumsan efficitur libero, vitae feugiat odio fringilla ac. Aliquam a turpis bibendum, varius erat dictum, feugiat libero. Nam et dignissim nibh. Morbi elementum varius elit, at dignissim ex accumsan a',
                   trimLines: 2,
                ),
              ),
            ],
          ),
        ),

CodePudding user response:

First of all wrap the text inside a fixed width and height container and then put the text data inside ReadMoreText() widget with

 trimMode: ,  TrimMode.Line,  trimCollapsedText: '... Show more',  trimExpandedText: ' Show less',
  • Related