forked from lxm_flutter/FlutterUnit
代码格式优化完毕
This commit is contained in:
@@ -12,6 +12,8 @@ import '../../../../app/utils/color_utils.dart';
|
||||
// " 其他属性与Text相同,详见之。",
|
||||
// }
|
||||
class CustomRichText extends StatelessWidget {
|
||||
const CustomRichText({Key? key}) : super(key: key);
|
||||
|
||||
final str = " 发光强度简称光强,国际单位是(坎德拉)简写cd。"
|
||||
"1cd是指光源在指定方向的单位立体角内发出的光通量。"
|
||||
"光源辐射是均匀时,则光强为I=F/Ω,Ω为立体角,单位为球面度(sr),F为光通量,"
|
||||
|
||||
@@ -10,12 +10,14 @@ import 'package:flutter/material.dart';
|
||||
// "使用WidgetSpan来承载普通组件,作为RichText的内容",
|
||||
// }
|
||||
class RichTextWithWidget extends StatelessWidget {
|
||||
const RichTextWithWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
text: 'hello ',
|
||||
style: TextStyle(color: Colors.black, fontSize: 18),
|
||||
style: const TextStyle(color: Colors.black, fontSize: 18),
|
||||
children: <InlineSpan>[
|
||||
WidgetSpan(
|
||||
child: Image.asset(
|
||||
@@ -24,29 +26,29 @@ class RichTextWithWidget extends StatelessWidget {
|
||||
),
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
baseline: TextBaseline.ideographic),
|
||||
TextSpan(
|
||||
const TextSpan(
|
||||
text: ' , welcome to ',
|
||||
style: TextStyle(color: Colors.blue, fontSize: 18),
|
||||
),
|
||||
WidgetSpan(
|
||||
const WidgetSpan(
|
||||
child: FlutterLogo(),
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
baseline: TextBaseline.ideographic),
|
||||
TextSpan(
|
||||
const TextSpan(
|
||||
text: ' .\n',
|
||||
),
|
||||
TextSpan(
|
||||
const TextSpan(
|
||||
text: 'focus me on ',
|
||||
style: TextStyle(color: Colors.orange, fontSize: 16),
|
||||
),
|
||||
TextSpan(
|
||||
const TextSpan(
|
||||
text: 'https://github_model.com/toly1994328',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 18,
|
||||
decoration: TextDecoration.underline),
|
||||
),
|
||||
TextSpan(
|
||||
const TextSpan(
|
||||
text: ' .\n',
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user