How do I stretch an icon to fill the parent element?
I need an icon that will dynamically stretch to fill the parent container.
I don't think this is possible directly on the icon (since it only has a size property ), but is there any other solution I'm missing?
+3
Paul
source
to share
1 answer
I believe you can use the box installed with advanced
https://docs.flutter.io/flutter/widgets/Expanded-class.html
https://groups.google.com/forum/#!msg/flutter-dev/lsgdU1yl7xc/0pYS2qrzBQAJ
https://docs.flutter.io/flutter/widgets/FittedBox-class.html
https://docs.flutter.io/flutter/painting/BoxFit-class.html
new Expanded(
child: new FittedBox(
fit: BoxFit.fill,
child: new Icon(Icons.home),
),
),
Please note that in documents that are Expanded, must be wrapped in a Colium, row or flex widget.
+4
user1462442
source
to share