On this pic is my step1
And when I use Column(), my design isn't a center :( Watch it -> step2
also I cant press on it when I wrapped in Column() and I dont see any mistakes:
Expanded(
child: Padding(
padding: const EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: colorMars,
),
height: 200,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon: const FaIcon(
FontAwesomeIcons.mars,
size: 80,
),
onPressed: () {
colorMars = active;
if (colorMars == active) {
colorVenus = inActive;
} else {
colorMars = inActive;
}
setState(() {});
}),
],
),
),
),
),
PS For icons I use this package font_awesome_flutter In pubspec.yaml:
dependencies:
flutter:
sdk: flutter
font_awesome_flutter: ^10.1.0
Full of code here -> full_code
Add
iconSize: 80
in yourIconButton
. And full code will beBased on the
IconButton
documentationIf you override
FaIcon
with size 80 without addingIconButton
size, theFaIcon
will be bigger than its parent (IconButton
) and you get unexpected layout.