Home > Mobile >  Multiple Text Styles in TextField in Flutter
Multiple Text Styles in TextField in Flutter

Time:11-13

Is there a way to take input in multiple text styles in a textfield in Flutter like this?

enter image description here

Where the user can select a part of the text and edit its style like he wants

CodePudding user response:

You can try use RichText

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

RichText

Source: Source on api.flutter.dev

CodePudding user response:

You can use this https://pub.dev/packages/flutter_social_textfield. You can add different styles too.

  • Related