I have a list and I want to add a bullet to each item (I'm using new Column
because I don't want to implement scrolling). How would I create a bulleted list?
I'm thinking maybe an icon but possibly there is a way with the decoration class used in the text style.
You can create a separate class to generate the bullet item that you can further easily modify as per your design. i.e you can use different bullet styles like instead of circle rectangle, triangle, any other icon. I have just added the option to add the custom padding.
Place your cursor where you want a bulleted list. Click Home> Paragraph, and then click the arrow next to Bullets. Choose a bullet style and start typing.
You create an unordered list using the ul tag. Then, you use the li tag to list each and every one of the items you want your list to include.
To make it as simple as possible, you can use UTF-code. This's going to be a bullet
String bullet = "\u2022 "
Following widget will create a filled circle shape, So you can call this widget for every item in your column.
class MyBullet extends StatelessWidget{ @override Widget build(BuildContext context) { return new Container( decoration: new BoxDecoration( color: Colors.black, shape: BoxShape.circle, ), ); } }
Hope this is what you want !
EDIT :
class MyList extends StatelessWidget{ @override Widget build(BuildContext context) { return new Column( children: <Widget>[ new ListTile( leading: new MyBullet(), title: new Text('My first line'), ), new ListTile( leading: new MyBullet(), title: new Text('My second line'), ) ], ); } } class MyBullet extends StatelessWidget{ @override Widget build(BuildContext context) { return new Container( height: 20.0, width: 20.0, decoration: new BoxDecoration( color: Colors.black, shape: BoxShape.circle, ), ); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With