Skip to content

Commit b8b452b

Browse files
committed
Mobile: avatar left with name to right in 45% height banner
1 parent 74be3f7 commit b8b452b

1 file changed

Lines changed: 19 additions & 22 deletions

File tree

lib/main.dart

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ class HomePage extends StatelessWidget {
3030
children: [
3131
Container(
3232
width: double.infinity,
33-
height: isMobile ? null : MediaQuery.of(context).size.height,
33+
height: isMobile
34+
? MediaQuery.of(context).size.height * 0.45
35+
: MediaQuery.of(context).size.height,
3436
color: const Color(0xFF3A3A3A),
3537
padding: isMobile
36-
? EdgeInsets.zero
38+
? const EdgeInsets.symmetric(horizontal: 24, vertical: 24)
3739
: const EdgeInsets.symmetric(horizontal: 46, vertical: 46),
38-
alignment: isMobile ? null : Alignment.centerLeft,
40+
alignment: Alignment.centerLeft,
3941
child: isMobile ? const _MobileHeader() : const _DesktopHeader(),
4042
),
4143
Container(
@@ -69,32 +71,27 @@ class _MobileHeader extends StatelessWidget {
6971

7072
@override
7173
Widget build(BuildContext context) {
72-
final screenHeight = MediaQuery.of(context).size.height;
74+
final avatarRadius = MediaQuery.of(context).size.height * 0.45 * 0.4;
7375

74-
return Column(
75-
crossAxisAlignment: CrossAxisAlignment.start,
76+
return Row(
77+
crossAxisAlignment: CrossAxisAlignment.center,
7678
children: [
77-
SizedBox(
78-
width: double.infinity,
79-
height: screenHeight * 0.45,
80-
child: Image.network(
79+
CircleAvatar(
80+
radius: avatarRadius,
81+
backgroundImage: const NetworkImage(
8182
'https://avatars.githubusercontent.com/will-ch-h',
82-
fit: BoxFit.cover,
8383
),
8484
),
85-
const Padding(
86-
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 20),
87-
child: Text(
88-
'will-ch-h',
89-
style: TextStyle(
90-
color: Colors.white,
91-
fontSize: 28,
92-
fontWeight: FontWeight.bold,
93-
letterSpacing: 1.2,
94-
),
85+
const SizedBox(width: 20),
86+
const Text(
87+
'will-ch-h',
88+
style: TextStyle(
89+
color: Colors.white,
90+
fontSize: 28,
91+
fontWeight: FontWeight.bold,
92+
letterSpacing: 1.2,
9593
),
9694
),
97-
// information goes here
9895
],
9996
);
10097
}

0 commit comments

Comments
 (0)