Skip to content

In the 1.0 version, the line height and font spacing(letterSpacing) I defined have no effect at all. Why is this? #212

@sliverRing

Description

@sliverRing

In the 1.1 version, the line height and font spacing(letterSpacing) I defined have no effect at all. Why is this?
`import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_html/style.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:literature/common/common.dart';

class HtmlText extends StatelessWidget {
final String content;
final double fontSize;
final fontH = ScreenUtil().setWidth(3.5);

HtmlText({this.content, this.fontSize = 0.0});

@OverRide
Widget build(BuildContext context) {
double fontSuzie = ScreenUtil().setSp(SLiverCommon.readContent);
if (fontSize != 0.0) {
fontSuzie = ScreenUtil().setSp(fontSize);
}
return Html(
data: content,
shrinkWrap: false,
style: {
"div": buildStyleDive(),
"html": buildStyleHtml(fontSuzie, context),
"em": buildStyleEm(),
"body": buildStyleBody(),
"p": buildStyleP(),
"p":Style.fromTextStyle(
TextStyle(wordSpacing: 0.0)
),
"strong": buildStyleStrong(),
"blockquote": buildStyleBlockquote(),
},
);
}

Style buildStyleDive() =>
Style(display: Display.BLOCK, margin: EdgeInsets.only(bottom: 10.0));

Style buildStyleStrong() {
return Style(
color: Colors.black,
alignment: Alignment.center,
display: Display.BLOCK);
}

Style buildStyleP() {
return Style(
whiteSpace: WhiteSpace.PRE,
margin: EdgeInsets.only(top: 5.0),
color: Color(0xFF535353),
width: double.infinity);
}

// DT
Style buildStyleEm() {
return Style(
color: Color(0xFF535353),
display: Display.INLINE_BLOCK,
height: fontH,
margin: EdgeInsets.only(top: 5.0),
fontStyle: FontStyle.normal);
}
Style buildStyleBlockquote() {
return Style(
fontFamily: 'Zkwyt',
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
border: Border(left: BorderSide(width: 2.0, color: Colors.grey[800])),
backgroundColor: Colors.grey[200],
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(15.0),
right: ScreenUtil().setWidth(15.0),
top: 5.0,
bottom: 5.0,
),
);
}

Style buildStyleBody() {
return Style(
width: double.infinity,
color: Color(0xFF535353),
padding: EdgeInsets.only(left: 0.0, top: 0.0),
margin: EdgeInsets.only(left: 0.0, top: 0.0));
}

Style buildStyleHtml(double fontSuzie, context) {
return Style.fromTextStyle(TextStyle(
fontSize: fontSuzie,
inherit: false,
height: fontH,
fontFamily: 'FZSSJW',
wordSpacing: 0.0,
color: Color(0xFF535353),
letterSpacing: 2.5));
}
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions