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(),
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/// Created with Android Studio.
|
||||
/// User: 三帆
|
||||
/// Date: 20/01/2019
|
||||
/// Time: 22:28
|
||||
/// email: sanfan.hx@alibaba-inc.com
|
||||
/// target: CupertinoTabBar
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class TextDemo extends StatefulWidget {
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<TextDemo> {
|
||||
int index = 0;
|
||||
Duration timer = new Duration(minutes: 50);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text("i'm a text");
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_go/components/widget_demo.dart';
|
||||
import 'demo.dart';
|
||||
|
||||
const String intro = """
|
||||
### **简介**
|
||||
|
||||
> 具有某个单一样式的文本显示的widget组件, 显示支持一行或者多行. 默认样式会继承层级最为接近的 *DefaultStyle*
|
||||
当然, 你也可以重新他的样式 将 *DefaultStyle.inherit 设置为 false*
|
||||
|
||||
是最基本的文本显示组件
|
||||
|
||||
### **基本用法**
|
||||
在这里介绍一下他的基本属性说明.
|
||||
|
||||
- data Text显示的文本,必填参数 String
|
||||
- textAlign 文本的对齐方式,可以选择左对齐、右对齐还是居中对齐 TextAlign
|
||||
- maxLines 文本显示的最大行数 int
|
||||
- overflow 文本显示的截断方式 TextOverflow
|
||||
- textScaleFactor 文本的缩放比例 double
|
||||
- style 用于指定文本显示的样式如颜色、字体、粗细、背景等
|
||||
|
||||
|
||||
### **基本示例**
|
||||
|
||||
""";
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
static const String routeName = '/element/Form/Text/Text';
|
||||
_Demo createState() => _Demo();
|
||||
}
|
||||
|
||||
class _Demo extends State<Demo> {
|
||||
onButtonTap() {
|
||||
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: "Text",
|
||||
docUrl: 'flutter/widgets/Text-class.html',
|
||||
codeUrl: 'elements/Form/Text/Text/demo.dart',
|
||||
contentList: [
|
||||
intro,
|
||||
TextDemo(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import '../../../../model/widget.dart';
|
||||
import 'RichText/index.dart' as RichText;
|
||||
import 'Text/index.dart' as Text;
|
||||
|
||||
|
||||
List<WidgetPoint> widgetPoints = [
|
||||
WidgetPoint(
|
||||
name: 'RichText',
|
||||
routerName: RichText.Demo.routeName,
|
||||
buildRouter: (BuildContext context) => RichText.Demo(),
|
||||
),
|
||||
WidgetPoint(
|
||||
name: 'Text',
|
||||
routerName: Text.Demo.routeName,
|
||||
buildRouter: (BuildContext context) => Text.Demo(),
|
||||
),
|
||||
];
|
Reference in New Issue
Block a user