Created
August 23, 2021 14:20
-
-
Save daohoangson/a69cf847dda053eab3c9d2cff2a0b65d to your computer and use it in GitHub Desktop.
`Paragraph.getBoxesForPlaceholders` returns NaN when font size is zero. Reference: https://github.com/daohoangson/flutter_widget_from_html/issues/578
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MaterialApp( | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
)); | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final style = DefaultTextStyle.of(context).style; | |
return SingleChildScrollView( | |
child: RichText( | |
text: TextSpan( | |
children: [ | |
const WidgetSpan(child: SizedBox(width: 10, height: 10)), | |
TextSpan(text: 'hover me', style: style), | |
], | |
style: style.copyWith(fontSize: 0.0), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment