mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
Add:创建 flutter go web 版
This commit is contained in:
@ -1,31 +0,0 @@
|
||||
/// Created with Android Studio.
|
||||
/// User: 三帆
|
||||
/// Date: 14/01/2019
|
||||
/// Time: 19:02
|
||||
/// email: sanfan.hx@alibaba-inc.com
|
||||
/// target: xxx
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RichTextDemo extends StatefulWidget {
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<RichTextDemo> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Color(0xff000000),
|
||||
width: 750.0,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Hello ',
|
||||
children: <TextSpan>[
|
||||
TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold, color: Color(0xfffffc42))),
|
||||
TextSpan(text: ' world!', style: TextStyle(fontStyle: FontStyle.italic)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_go/components/widget_demo.dart';
|
||||
import 'package:flutter_go/widgets/elements/Form/Text/RichText/demo.dart';
|
||||
|
||||
const String intro = """
|
||||
### **简介**
|
||||
|
||||
> 具有复杂样式的文本显示组件
|
||||
|
||||
在富文本使用多个不同风格的widget显示文本。要显示的文本使用TextSpan对象树来描述,每个对象都有一个用于该子树的关联样式。文本可能会跨越多行,也可能全部显示在同一行上,具体取决于布局约束。
|
||||
|
||||
无论是Text或者Text.rich, 查看源代码发现. 都是由RichText构建出来
|
||||
|
||||
|
||||
### **基本用法**
|
||||
我们可以让一段文本通过使用不同的TextSpan显示不同的样式。比如我们让"Hello beautiful world"的每个单词都显示不同的样式.
|
||||
|
||||
""";
|
||||
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
static const String routeName = '/element/Form/Text/RichText';
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<Demo> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: 'Rich Text',
|
||||
docUrl: 'https://docs.flutter.io/flutter/widgets/RichText-class.html',
|
||||
codeUrl: 'elements/Form/Text/RichText/index.dart',
|
||||
contentList: [
|
||||
intro,
|
||||
RichTextDemo(),
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user