admin管理员组

文章数量:1389861

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

本文标签: How do I display a number with a caret on top in FlutterStack Overflow