Skip to content

Commit

Permalink
Add icon overlap.
Browse files Browse the repository at this point in the history
  • Loading branch information
TammiLion committed Sep 25, 2024
1 parent 67cb06c commit fa22a18
Showing 1 changed file with 38 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,21 @@ class GameProfileItem extends StatelessWidget {
),
Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: List.generate(
profile.roles.length,
(i) => Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: profile.roles[i].color,
child: profile.roles.length == 2 ? SizedBox(
height: 36,width: (36*2)-4,
child: Stack(
children: [
Positioned(
right: 0,
child: _icon(profile.roles[1]),
),
child: Icon(
_getIconPerRole(profile.roles[i]),
color: FamilyAppTheme.primary20,
Positioned(
left: 0,
child: _icon(profile.roles[0]),
),
),
],
),
),
) : _iconRow(),
),
],
),
Expand All @@ -86,6 +82,32 @@ class GameProfileItem extends StatelessWidget {
);
}

Row _iconRow() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
profile.roles.length,
(i) => _icon(profile.roles[i]),
),
);
}

Container _icon(Role role) {
return Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: role.color,
),
child: Icon(
_getIconPerRole(role),
size: 16,
color: FamilyAppTheme.primary20,
),
);
}

IconData _getIconPerRole(Role? role) {
switch (role.runtimeType) {
case SuperHero:
Expand Down

0 comments on commit fa22a18

Please sign in to comment.