New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement WidgetFactory.buildListMarker
#511
Conversation
Demo appDeployed 9d23de5 to https://example-4w9ln1ia2-flutter-widget-from-html.vercel.app. Quick links: |
Codecov Report
@@ Coverage Diff @@
## master #511 +/- ##
==========================================
+ Coverage 97.75% 97.91% +0.16%
==========================================
Files 46 47 +1
Lines 2979 2979
==========================================
+ Hits 2912 2917 +5
+ Misses 67 62 -5
Continue to review full report at Codecov.
|
It's now possible to use image as marker: main.dartclass ImageListMarkerScreen extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: Text('ImageListMarkerScreen'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: HtmlWidget(
kHtml,
factoryBuilder: () => _ImageListMarkerFactory(),
),
),
);
}
class _ImageListMarkerFactory extends WidgetFactory {
@override
Widget buildListMarker(
BuildMetadata meta,
TextStyleHtml tsh,
String listStyleType,
int index,
) {
if (index == 2) {
final style = tsh.styleWithHeight;
return Image.asset(
'logos/android.png',
height: style.fontSize,
width: style.fontSize,
);
}
return super.buildListMarker(meta, tsh, listStyleType, index);
}
} const kHtml = '''
<ol style="font-size: larger; line-height: 2">
<li>One</li>
<li>Flutter</li>
<li>Three</li>
</ol>
'''; |
Refactor
tag_li.dart
to make it possible to customize marker widget.