add bullet points in text widget flutter 1

add bullet points in text widget flutter

class DottedText extends Text {
  const DottedText(String data, {
    Key key,
    TextStyle style,
    TextAlign textAlign,
    TextDirection textDirection,
    Locale locale,
    bool softWrap,
    TextOverflow overflow,
    double textScaleFactor,
    int maxLines,
    String semanticsLabel,
  }) : super(
    '\u2022 $data',
    key: key,
    style: style,
    textAlign: textAlign,
    textDirection: textDirection,
    locale: locale,
    softWrap: softWrap,
    overflow: overflow,
    textScaleFactor: textScaleFactor,
    maxLines: maxLines,
    semanticsLabel: semanticsLabel,);
}

Here is what the above code is Doing:
1. We’re creating a new class called DottedText that extends the Text class.
2. We’re passing the data that we want to display to the Text class.
3. We’re adding a bullet point to the beginning of the data.
4. We’re passing all the other parameters to the Text class.

Now, we can use the DottedText class in our code.

DottedText(
‘This is a dotted text’,
style: TextStyle(
fontSize: 20.0,
color: Colors.black,
),
),

Similar Posts