Nal*_*ant 7 flutter flutter-layout
今天我正在尝试快速制作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),),
],
),
],
),
),
],
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
在这里我想在underline和之间添加空格Text('For You')。有没有办法以更好的方式做到这一点?
Ani*_*gri 16
你可以尝试这样的事情:
Container(
padding: EdgeInsets.only(
bottom: 3, // This can be the space you need between text and underline
),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(
color: Colors.black,
width: 1.0, // This would be the width of the underline
))
),
child: Text(
"For You",style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, decoration: TextDecoration.underline,)
,),)
Run Code Online (Sandbox Code Playgroud)
Joe*_*ler 12
这是一个简单的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,
),
)
Run Code Online (Sandbox Code Playgroud)
我写了一篇关于文本下划线和其他一些解决方案的文章,但这是我最喜欢的。
| 归档时间: |
|
| 查看次数: |
4111 次 |
| 最近记录: |