Business Card: Contacts
Part of the Your First App section of Coddy's Flutter journey. Lesson 32 of 32.
A business card is for getting in touch, so the last part is the contact details: a phone number and an email, each with its icon, on a white panel.
Each contact line is a Row of an icon, a small gap and a text. The two rows go in a Column, inside a Container with padding and rounded corners. A light background on the whole screen makes the white panel stand out:
Scaffold(
backgroundColor: Colors.indigo.shade50,
body: ...,
)Colors.indigo.shade50 is the lightest shade of indigo. Every color in Colors has shades from shade50 to shade900.
Challenge
EasyFinish the card:
- give the
ScaffoldabackgroundColor:ofColors.indigo.shade50 - under the job, after a
SizedBox(height: 24), add aContainerwith16pixels of padding and a whiteBoxDecorationwith rounded corners - inside it, a
Columnof two rows:Icons.phonewith+1 555 0100, and under itIcons.emailwithjordan@example.com
Try it yourself
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
CircleAvatar(
radius: 48,
backgroundColor: Colors.indigo,
child: Text('JD', style: TextStyle(fontSize: 32, color: Colors.white)),
),
SizedBox(height: 16),
Text(
'Jordan Diaz',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
Text(
'Flutter Developer',
style: TextStyle(color: Colors.blueGrey),
),
],
),
),
),
);
}
}
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Your First App
Practice on your own: Online Flutter compiler