【发布时间】:2021-08-21 19:46:42
【问题描述】:
我想使用 RichText 小部件在颤振中创建类似这样的 UI。你能帮我写代码吗?我不明白如何设计这样的用户界面?
【问题讨论】:
-
重新创建此 UI 有什么问题?你能提供更多信息吗?
我想使用 RichText 小部件在颤振中创建类似这样的 UI。你能帮我写代码吗?我不明白如何设计这样的用户界面?
【问题讨论】:
使用WidgetSpan 提供偏移量以获得上标。执行以下操作:
Container(
padding: EdgeInsets.all(10),
child: Center(
child: RichText(
text: TextSpan(children: [
WidgetSpan(
child: Transform.translate(
offset: const Offset(0.0, -7.0), child:
Text("Rs"))),
TextSpan(
text: '1,500',
style: TextStyle(color: Colors.black,
fontSize: 18,fontWeight:FontWeight.bold),
recognizer: TapGestureRecognizer()
..onTap = () {
// navigate to desired screen
})
]),
),
))
【讨论】: