diff --git a/lib/widgets/elements/Form/Text/RichText/demo.dart b/lib/widgets/elements/Form/Text/RichText/demo.dart new file mode 100644 index 00000000..559743de --- /dev/null +++ b/lib/widgets/elements/Form/Text/RichText/demo.dart @@ -0,0 +1,33 @@ +/** + * Created with Android Studio. + * User: 三帆 + * Date: 14/01/2019 + * Time: 19:02 + * email: sanfan.hx@alibaba-inc.com + * tartget: xxx + */ + +import 'package:flutter/material.dart'; + +class Demo extends StatefulWidget { + _Demo createState() => _Demo(); +} + +class _Demo extends State { + + Widget build(BuildContext context) { + return Container( + color: Color(0xff000000), + width: 750.0, + child: RichText( + text: TextSpan( + text: 'Hello ', + children: [ + TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold, color: Color(0xfffffc42))), + TextSpan(text: ' world!', style: TextStyle(fontStyle: FontStyle.italic)), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/elements/Form/Text/RichText/index.dart b/lib/widgets/elements/Form/Text/RichText/index.dart index 6b3c9f98..11f7118b 100644 --- a/lib/widgets/elements/Form/Text/RichText/index.dart +++ b/lib/widgets/elements/Form/Text/RichText/index.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import '../../../../../common/widget_demo.dart'; - +import 'demo.dart'; const String intro = """ # 富文本显示 @@ -70,20 +70,7 @@ class _Demo extends State { contentList: [new Column( children: [ MarkdownBody(data: markDesc['intro']), - Container( - color: Color(0xff000000), - width: 750.0, - child: RichText( - text: TextSpan( - text: 'Hello ', -// style: TextStyle(fontWeight: FontWeight.normal, inherit: true, fontSize: 44), - children: [ - TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold, color: Color(0xfffffc42))), - TextSpan(text: ' world!', style: TextStyle(fontStyle: FontStyle.italic)), - ], - ), - ), - ), + Demo(), MarkdownBody(data: markDesc['diff']), ], ),