How to wrap a widget inside a multiline text in flutter.
CodePudding user response:
You can achieve this with RichText and WidgetSpan. Example from this link:
const Text.rich(
TextSpan(
children: <InlineSpan>[
TextSpan(text: 'Flutter is'),
WidgetSpan(
child: SizedBox(
width: 120,
height: 50,
child: Card(
child: Center(
child: Text('Hello World!')
)
),
)
),
TextSpan(text: 'the best!'),
],
)
)