feat: customizes quoted text style

This commit is contained in:
Lucas.Xu 2022-08-07 22:03:51 +08:00
parent 59838f5845
commit 25387cd0b0
3 changed files with 19 additions and 7 deletions

View File

@ -18,12 +18,14 @@ class FlowySvg extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (name != null) {
return SvgPicture.asset(
'assets/images/$name.svg',
color: color,
package: 'flowy_editor',
width: size.width,
height: size.width,
return SizedBox.fromSize(
size: size,
child: SvgPicture.asset(
'assets/images/$name.svg',
color: color,
package: 'flowy_editor',
fit: BoxFit.fill,
),
);
} else if (number != null) {
final numberText =

View File

@ -158,6 +158,7 @@ class _FlowyRichTextState extends State<FlowyRichText> with Selectable {
color: widget.textNode.toRawString().isNotEmpty
? Colors.transparent
: Colors.grey,
fontSize: baseFontSize,
),
),
],

View File

@ -59,7 +59,10 @@ class _QuotedTextNodeWidgetState extends State<QuotedTextNodeWidget>
return Row(
children: [
FlowySvg(
size: Size.square(leftPadding),
size: Size(
leftPadding,
_quoteHeight,
),
name: 'quote',
),
FlowyRichText(
@ -71,4 +74,10 @@ class _QuotedTextNodeWidgetState extends State<QuotedTextNodeWidget>
],
);
}
double get _quoteHeight {
final lines =
widget.textNode.toRawString().characters.where((c) => c == '\n').length;
return (lines + 1) * leftPadding;
}
}