flutter - 是否可以在文本和下划线之间有一定高度的文本下划线?
问题描述
今天我正在尝试制作sticker.ly 应用程序UI。但我坚持在下划线和文本之间添加空格。这是我的代码
import 'package:flutter/material.dart';
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(13),
margin: MediaQuery.of(context).padding,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Text('For You', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, decoration: TextDecoration.underline,),),
SizedBox(width:8),
Text('Sticker', style: TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 16),),
SizedBox(width:8),
Text('Status', style: TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 16),),
],
),
],
),
),
],
),
);
}
}
在这里我想在underline
和之间添加空格Text('For You')
。有没有办法以更好的方式做到这一点?
解决方案
这是一个简单的hacky方法:
Text(
"Forgot Password?",
style: TextStyle(
shadows: [
Shadow(
color: Colors.red,
offset: Offset(0, -5))
],
color: Colors.transparent,
decoration:
TextDecoration.underline,
decorationColor: Colors.blue,
decorationThickness: 4,
decorationStyle:
TextDecorationStyle.dashed,
),
)
我写了一篇关于文本下划线和其他一些解决方案的文章,但这是我最喜欢的。
推荐阅读
- css - Tailwind 的指令 @apply 不适用于 Nuxt
- php - Softcon indipay 模块显示 ccavenue 网关的参数缺失异常
- c# - 我们可以在 Dispose() 方法中有 GC.Collect() 吗(在其他文章中无法得到很好的解释)
- java - 如何在大师班中正确使用泛型?
- excel - 使用 Find.Cells 检测隐藏和分组单元格中的单元格
- sql - 试图找到正确的物化视图刷新选项
- android - 动态查询参数改造
- android - 如何处理夜间模式的转换?
- angular - 无法读取未定义角度的属性“推送”
- sql - 创建视图,在文本上使用多个符号导致问题