ExpandableText constructor

const ExpandableText({
  1. Key? key,
  2. required TextSpan textSpan,
  3. required int maxLines,
  4. Text seeMore = const Text("Show more", style: TextStyle(fontWeight: FontWeight.bold, decoration: TextDecoration.underline)),
  5. Text seeLess = const Text("Show less", style: TextStyle(fontWeight: FontWeight.bold, decoration: TextDecoration.underline)),
})

Multiline text that can be eventually expanded with a button to show more lines.

Defines the max number of lines to show and the text to truncate.

Implementation

const ExpandableText({
  super.key,
  required this.textSpan,
  required this.maxLines,
  this.seeMore = const Text(
    "Show more",
    style: TextStyle(
        fontWeight: FontWeight.bold, decoration: TextDecoration.underline),
  ),
  this.seeLess = const Text(
    "Show less",
    style: TextStyle(
        fontWeight: FontWeight.bold, decoration: TextDecoration.underline),
  ),
});