最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I display a number with a caret on top in Flutter? - Stack Overflow

programmeradmin2浏览0评论

I am looking for something like 1̂.
I have tried this but it only works for letters, not numbers.

This works just fine.
Text('a\u0302')

This displays the caret after the number 7.
Text('7\u0302')

I am looking for something like 1̂.
I have tried this but it only works for letters, not numbers.

This works just fine.
Text('a\u0302')

This displays the caret after the number 7.
Text('7\u0302')

Share Improve this question asked Mar 14 at 2:38 Aykut UcarAykut Ucar 6969 silver badges17 bronze badges 1
  • can you share the screenshot or something how you want it to be displayed? – Munsif Ali Commented Mar 14 at 4:50
Add a comment  | 

1 Answer 1

Reset to default 1

Maybe a stacked widget like this?

Row(
  mainAxisAlignment: MainAxisAlignment.center,
  crossAxisAlignment: CrossAxisAlignment.end,
  children: [
    Text('this '),
    CaretLetter('7'),
    Text(' is custom'),
  ],
),
class CaretLetter extends StatelessWidget {
  final String s;
  const CaretLetter(this.s, {super.key});

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: AlignmentDirectional.topCenter,
      children: [
        Text('\u0302'),
        Padding(padding: const EdgeInsets.fromLTRB(0, 4, 0, 0), child: Text(s)),
      ],
    );
  }
}
发布评论

评论列表(0)

  1. 暂无评论