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

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

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)),
      ],
    );
  }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744675931a4587326.html

相关推荐

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

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

    1天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信