Skip to content

Commit ce9943c

Browse files
committed
add example to repo, code fixes
- change to Text.rich instead of RichText to allow default styles to propogate to built-in widgets - minor code cleanups, gitignore
1 parent 4dcae9f commit ce9943c

15 files changed

+679
-25
lines changed

.gitignore

+44
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,51 @@
33

44
.packages
55
.pub/
6+
.generated/
67

78
build/
89
ios/
910
android/
11+
12+
.idea/
13+
.vagrant/
14+
.sconsign.dblite
15+
.svn/
16+
17+
.DS_Store
18+
*.swp
19+
profile
20+
21+
DerivedData/
22+
GeneratedPluginRegistrant.h
23+
GeneratedPluginRegistrant.m
24+
25+
*.pbxuser
26+
*.mode1v3
27+
*.mode2v3
28+
*.perspectivev3
29+
30+
!default.pbxuser
31+
!default.mode1v3
32+
!default.mode2v3
33+
!default.perspectivev3
34+
35+
xcuserdata
36+
37+
*.moved-aside
38+
39+
*.pyc
40+
*sync/
41+
Icon?
42+
.tags*
43+
44+
/Flutter/app.flx
45+
/Flutter/app.zip
46+
/Flutter/flutter_assets/
47+
/Flutter/App.framework
48+
/Flutter/Flutter.framework
49+
/Flutter/Generated.xcconfig
50+
/ServiceDefinitions.json
51+
52+
Pods/
53+
.symlinks/

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class Demo extends StatelessWidget {
4343
Widget build(BuildContext context) {
4444
return ContentfulRichText(document).documentToWidgetTree;
4545
// Example widget tree produced:
46-
// RichText(text: 'Hello World');
46+
// Paragraph(
47+
// Text(text: 'Hello World'),
48+
// );
4749
}
4850
}
4951
```
@@ -86,12 +88,14 @@ class Demo extends StatelessWidget {
8688
Widget build(BuildContext context) {
8789
return ContentfulRichText(document).documentToWidgetTree;
8890
// Example widget tree produced:
89-
// RichText(
90-
// text: '',
91-
// children: <Widgets>[
92-
// TextSpan(text: 'Hello', style: { fontWeight: FontWeight.bold }),
93-
// TextSpan(text: ' world!', style: { fontStyle: FontStyle.italic }),
94-
// ],
91+
// Paragraph(
92+
// Text(
93+
// text: '',
94+
// children: <Widgets>[
95+
// TextSpan(text: 'Hello', style: { fontWeight: FontWeight.bold }),
96+
// TextSpan(text: ' world!', style: { fontStyle: FontStyle.italic }),
97+
// ],
98+
// ),
9599
// );
96100
}
97101
}
@@ -182,8 +186,8 @@ The `renderNode` keys should be the `value` of one of the following `BLOCKS` and
182186
- ~~`EMBEDDED_ASSET`~~ // not implemented yet
183187

184188
- `INLINES`
185-
- `EMBEDDED_ENTRY` (this is different from the `BLOCKS.EMBEDDED_ENTRY`) // not implemented yet
186-
- `HYPERLINK` // not implemented yet
189+
- `HYPERLINK`
190+
- ~~`EMBEDDED_ENTRY`~~ (this is different from the `BLOCKS.EMBEDDED_ENTRY`) // not implemented yet
187191
- ~~`ENTRY_HYPERLINK`~~ // not implemented yet
188192
- ~~`ASSET_HYPERLINK`~~ // not implemented yet
189193

contentful_rich_text.iml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<excludeFolder url="file://$MODULE_DIR$/.idea" />
1010
<excludeFolder url="file://$MODULE_DIR$/.pub" />
1111
<excludeFolder url="file://$MODULE_DIR$/build" />
12+
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
13+
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
14+
<excludeFolder url="file://$MODULE_DIR$/example/build" />
1215
</content>
1316
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
1417
<orderEntry type="sourceFolder" forTests="false" />

example/.gitignore

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# Visual Studio Code related
19+
.vscode/
20+
21+
# Flutter/Dart/Pub related
22+
**/doc/api/
23+
.dart_tool/
24+
.flutter-plugins
25+
.packages
26+
.pub-cache/
27+
.pub/
28+
/build/
29+
30+
# Android related
31+
**/android/**/gradle-wrapper.jar
32+
**/android/.gradle
33+
**/android/captures/
34+
**/android/gradlew
35+
**/android/gradlew.bat
36+
**/android/local.properties
37+
**/android/**/GeneratedPluginRegistrant.java
38+
39+
# iOS/XCode related
40+
**/ios/**/*.mode1v3
41+
**/ios/**/*.mode2v3
42+
**/ios/**/*.moved-aside
43+
**/ios/**/*.pbxuser
44+
**/ios/**/*.perspectivev3
45+
**/ios/**/*sync/
46+
**/ios/**/.sconsign.dblite
47+
**/ios/**/.tags*
48+
**/ios/**/.vagrant/
49+
**/ios/**/DerivedData/
50+
**/ios/**/Icon?
51+
**/ios/**/Pods/
52+
**/ios/**/.symlinks/
53+
**/ios/**/profile
54+
**/ios/**/xcuserdata
55+
**/ios/.generated/
56+
**/ios/Flutter/App.framework
57+
**/ios/Flutter/Flutter.framework
58+
**/ios/Flutter/Generated.xcconfig
59+
**/ios/Flutter/app.flx
60+
**/ios/Flutter/app.zip
61+
**/ios/Flutter/flutter_assets/
62+
**/ios/ServiceDefinitions.json
63+
**/ios/Runner/GeneratedPluginRegistrant.*
64+
65+
# Exceptions to above rules.
66+
!**/ios/**/default.mode1v3
67+
!**/ios/**/default.mode2v3
68+
!**/ios/**/default.pbxuser
69+
!**/ios/**/default.perspectivev3
70+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example/.metadata

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
8+
channel: unknown
9+
10+
project_type: app

example/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# example
2+
3+
A new Flutter project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
13+
14+
For help getting started with Flutter, view our
15+
[online documentation](https://flutter.io/docs), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

0 commit comments

Comments
 (0)