-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bc386d
commit 78d837c
Showing
6 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.0.15 | ||
|
||
- add comments for code | ||
|
||
## 0.0.14 | ||
|
||
- update test | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,41 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:style_parser/style_parser.dart'; | ||
|
||
void hi() { | ||
StyleParser.htmlTagToTextSpan("HI"); | ||
void main() { | ||
runApp(MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
String css = """ | ||
.bold { font-weight: bold; } | ||
.italic { font-style: italic; } | ||
.large { font-size: 24pt; } | ||
"""; | ||
|
||
String html = """ | ||
<p class="bold">This is bold text.</p> | ||
<p class="italic">This is italic text.</p> | ||
<p class="large">This is large text.</p> | ||
"""; | ||
|
||
Map<String, TextStyle> styles = StyleParser.cssToTextStyle(css); | ||
TextSpan textSpan = | ||
StyleParser.htmlTagToTextSpan(html, existingClassStyle: styles); | ||
|
||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: Text('StyleParser Example'), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: RichText( | ||
text: textSpan, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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
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
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