class MyHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 100,
maxWidth: 100,
),
child: Icon(
Icons.backup,
size: 200,
),
),
));
}
}
in the above code, if i replace icon widget with image or text they stay at ConstrainedBox boundaries, but icon get full size! why?
You can copy paste run full code below
Because in
Icon
's source code, it's actually useRichText
andTextOverflow.visible
source code link https://github.com/flutter/flutter/blob/8df56056b4914060784e68e6b149a30319b75d3d/packages/flutter/lib/src/widgets/icon.dart#L174
code snippet of souce code
working demo use
RichText
full code use
RichText