Reputation: 23
How can I add the iconbutton at the end of the text like this ?
I use Row widget but the iconbutton is not in the right place, it is not at the end of the text
This is my code:
Row(
children: [
Expanded(
child: Text(
'All about marketing, lead generation, content marketing and growth hacks',
style: const TextStyle(
fontSize: 12.0, fontWeight: FontWeight.w500),
),
),
IconButton(
icon: Icon(Icons.info),
iconSize: 12.0,
color: Palette.appbar,
onPressed: () {},
),
],
),
Upvotes: 2
Views: 884
Reputation: 564
Use RichText with TextSpan
and WidgetSpan.
WidgetSpan
allow to add your own widget as a part of text.
like this :
RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(text: _text, style: _style),
WidgetSpan(
child: _child
)
],
),
Upvotes: 4