markdown_widget
markdown_widget copied to clipboard
Allow to define the starting index of a numbered list
Is your feature request related to a problem? Please describe. Currently a numbered list starts with 0 and I cannot figure out a way to change it.
Describe the solution you'd like I would like it to start with 1. However imagine a list with a text in between and the the continuation of the list, perhaps one want to start the list with a different index. It would be nice to be able to control the starting index.
Describe alternatives you've considered Only hardcoding and the list.
It's not hard, I will add initialScrollIndex
to MarkdownWidget
later
you can update to v1.1.9, use initialIndex
to define the starting index of a numbered list
I couldn't make it work. Please check if that's the right way:
Expanded( child: Padding( padding: EdgeInsets.all(20), child: MarkdownWidget( data: termsOfUse, controller: TocController(initialIndex: 1), styleConfig: StyleConfig( // fix breaklines after bold pConfig: PConfig(selectable: false, ), // fix list index alignment olConfig: OlConfig(indexWidget: (deep, index) { return Container(margin: EdgeInsets.only(left: 5, right: 5), child: Text(index < 10 ? ' $index.':'$index.',),); },)),),)),
Make MarkdownWidget
directly wrapped by Expanded
I've tried all combinations, remove the padding, wrapping with a container, nothing works. the only hack I manage to make it work was adding an index++; right after OlConfig(indexWidget: (deep, index) { It's an ugly hack though..
could you provider your error logs?
Unfortunately there is no error anywhere. it silently ignores the TOCController(initialIndex: 1)
Unfortunately there is no error anywhere. it silently ignores the TOCController(initialIndex: 1)
In my test, it's ok
final TocController controller = TocController(initialIndex: 5);
can you provider more information😅