Skip to content
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

how to implement text center? #60

Closed
lanxiaoha opened this issue Jul 18, 2019 · 4 comments
Closed

how to implement text center? #60

lanxiaoha opened this issue Jul 18, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@lanxiaoha
Copy link

lanxiaoha commented Jul 18, 2019

i want to implement text center,how can i do?

===============================================
i have implement Font Tag,and place there。

in core_widget_factory.dart add 'font' tag

  NodeMetadata parseLocalName(NodeMetadata meta, String localName) {
    switch (localName) {
      case 'a':
        meta = lazySet(meta, buildOp: tagA());
        break;
      case 'font':
        meta = lazySet(meta, buildOp: tagFont());
        break;
}
class TagFont {
  final WidgetFactory wf;

  TagFont(this.wf);

  BuildOp get buildOp =>
      BuildOp(
          defaultStyles: (NodeMetadata meta, e) {
            if (meta != null) {
              if(e != null && e.attributes != null){
                e.attributes.forEach((key,value){
                  if(key == "color" && value != null){
                    var color = colorParseValue(value);
                    meta.color = color;
                  }
                });
              }
            }
          },
      );
}
@daohoangson
Copy link
Owner

It's already supported, you can use <center>Text</center> or <span style="text-align: center">Text</span> in your HTML.

@daohoangson daohoangson self-assigned this Jul 18, 2019
@daohoangson daohoangson added the question Further information is requested label Jul 18, 2019
@lanxiaoha
Copy link
Author

this is my html code but center attr not work

<div align="center">欢迎持续关注</div>

@daohoangson
Copy link
Owner

daohoangson commented Jul 18, 2019 via email

@daohoangson daohoangson added enhancement New feature or request and removed question Further information is requested labels Oct 31, 2019
@daohoangson daohoangson added this to the 0.2.4 milestone Oct 31, 2019
daohoangson added a commit that referenced this issue Apr 6, 2020
@daohoangson daohoangson modified the milestones: 0.3.3, 0.4.0 Apr 6, 2020
@daohoangson
Copy link
Owner

Your HTML now works with the latest rc version (0.4.0-rc.2020043001). I'm closing this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants