初步优化项目结构

This commit is contained in:
toly
2021-09-26 20:50:13 +08:00
parent f16d031417
commit 29a985e1b1
535 changed files with 366 additions and 359 deletions

View File

@@ -0,0 +1,42 @@
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())),
);
}
}

View File

@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
/// create by 张风捷特烈 on 2020-03-30
/// contact me by email 1981462002@qq.com
/// 说明:
// {
// "widgetId": 101,
// "name": 'RichText包含其他组件',
// "priority": 2,
// "subtitle":
// "使用WidgetSpan来承载普通组件作为RichText的内容",
// }
class RichTextWithWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RichText(
text: TextSpan(
text: 'hello ',
style: TextStyle(color: Colors.black, fontSize: 18),
children: <InlineSpan>[
WidgetSpan(
child: Image.asset(
'assets/images/icon_head.webp',
width: 30,
),
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.ideographic),
TextSpan(
text: ' , welcome to ',
style: TextStyle(color: Colors.blue, fontSize: 18),
),
WidgetSpan(
child: FlutterLogo(),
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.ideographic),
TextSpan(
text: ' .\n',
),
TextSpan(
text: 'focus me on ',
style: TextStyle(color: Colors.orange, fontSize: 16),
),
TextSpan(
text: 'https://github_model.com/toly1994328',
style: TextStyle(
color: Colors.blue,
fontSize: 18,
decoration: TextDecoration.underline),
),
TextSpan(
text: ' .\n',
),
],
),
);
}
}