How to make different font size in one textfield

536 Views Asked by At

How to make different font size in one textfield? I want to make 1 text field but so that different characters on input have different font size/color/style etc. Expamle:

=> TextFieldForm - [ AA BBaS OKEY MAN**!**]

1

There are 1 best solutions below

2
On

You could try this

RichText(
 text: TextSpan(
 text: 'Hello ',
 style: DefaultTextStyle.of(context).style,
 children: const <TextSpan>[
  TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
  TextSpan(text: ' world!'),
  ],
 ),
)

Source: https://api.flutter.dev/flutter/widgets/RichText-class.html