Files
FlutterUnit/lib/views/widgets/MultiChildRenderObjectWidget/RichText/node1_base.dart
2020-05-03 14:19:11 +08:00

43 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import '../../../../app/utils/color_utils.dart';
/// create by 张风捷特烈 on 2020-03-30
/// contact me by email 1981462002@qq.com
/// 说明:
// {
// "widgetId": 101,
// "name": 'RichText基本使用',
// "priority": 1,
// "subtitle":
// "【text】 : 文字 【TextSpan】\n"
// " 其他属性与Text相同,详见之。",
// }
class CustomRichText extends StatelessWidget {
final str = " 发光强度简称光强国际单位是坎德拉简写cd。"
"1cd是指光源在指定方向的单位立体角内发出的光通量。"
"光源辐射是均匀时则光强为I=F/ΩΩ为立体角单位为球面度sr,F为光通量"
"单位是流明对于点光源由I=F/4π 。光亮度是表示发光面明亮程度的,"
"指发光表面在指定方向的发光强度与垂直且指定方向的发光面的面积之比,"
"单位是坎德拉/平方米。对于一个漫散射面,尽管各个方向的光强和光通量不同,"
"但各个方向的亮度都是相等的。电视机的荧光屏就是近似于这样的漫散射面,"
"所以从各个方向上观看图像,都有相同的亮度感。";
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 10.0,
right: 10,
),
child: RichText(
text: TextSpan(
children: str
.split("")
.map((str) => TextSpan(
text: str,
style: TextStyle(
fontSize: 14, color: ColorUtils.randomColor())))
.toList())),
);
}
}