Skip to content

Commit

Permalink
fix onTap bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liranhao committed Aug 10, 2020
1 parent 6284f57 commit c8e1135
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RichTextWidget(
)
```
展示效果如下
![Simulator Screen Shot - iPhone 11 Pro - 2020-08-10 at 10.52.06.png](https://upload-images.jianshu.io/upload_images/1350306-2b5cdcf7b2864f8f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![Simulator Screen Shot - iPhone 11 Pro - 2020-08-10 at 10.52.06.png](https://upload-images.jianshu.io/upload_images/1350306-2b5cdcf7b2864f8f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/310)


参数说明
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MyApp extends StatelessWidget {
BaseRichText(
"button",
style: TextStyle(color: Colors.red),
onTap: () => {print("touch button")},
// onTap: () => {print("touch button")},
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.8"
version: "0.2.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
4 changes: 3 additions & 1 deletion lib/rich_text_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class RichTextWidget extends StatelessWidget {
_resultRichTexts.add(TextSpan(
text: richSubStr,
style: model.richText.style,
recognizer: TapGestureRecognizer()..onTap = model.richText.onTap,
recognizer: model.richText.onTap != null
? (TapGestureRecognizer()..onTap = model.richText.onTap)
: null,
));
start = model.end;
i++;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rich_text_widget
description: 该库属于富文本组件,补充了Flutter富文本只能拼接组件的功能,该库应用于国际化文本非常便利,不用拆分字符串.
version: 0.1.8
version: 0.2.0
homepage: https://github.com/liranhao/rich_text_widget

environment:
Expand Down

0 comments on commit c8e1135

Please sign in to comment.