Lead Detail
Loading preview
Starting the Flutter app
A Flutter CRM lead detail with contact info, deal value, and an activity feed.
import 'package:flutter/material.dart';
class LeadDetail extends StatelessWidget {
const LeadDetail({super.key});
void _notify(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scheme = theme.colorScheme;
return Scaffold(
appBar: AppBar(
title: const Text('Lead'),
actions: [IconButton(tooltip: 'Edit lead', onPressed: () => _showDemo(context, 'Edit (demo)'), icon: const Icon(Icons.edit))],
),
body: ListView(
children: [
Container(
padding: const EdgeInsets.all(20),
child: Column(
children: [
const CircleAvatar(radius: 36, child: Text('AO')),
const SizedBox(height: 12),
Text('Amara Okafor',
style: theme.textTheme.titleLarge
?.copyWith(fontWeight: FontWeight.bold)),
Text('VP Marketing · Northwind Ltd',
style: TextStyle(color: scheme.onSurfaceVariant)),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_action(scheme, Icons.call, 'Call',
() => _notify(context, 'Calling Amara Okafor…')),
_action(scheme, Icons.mail_outline, 'Email',
() => _notify(context, 'New email to Amara Okafor')),
_action(scheme, Icons.event, 'Meet',
() => _notify(context, 'Scheduling a meeting…')),
],
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
Expanded(
child: _stat(scheme, 'Deal value', '\$12,400')),
const SizedBox(width: 12),
Expanded(child: _stat(scheme, 'Stage', 'Proposal')),
],
),
),
const SizedBox(height: 8),
const ListTile(
leading: Icon(Icons.mail_outline),
title: Text('amara@northwind.com')),
const ListTile(
leading: Icon(Icons.phone_outlined),
title: Text('+1 (555) 019-2837')),
const Divider(),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
child: Text('Recent activity',
style: theme.textTheme.titleMedium
?.copyWith(fontWeight: FontWeight.bold)),
),
_activity(scheme, Icons.call, 'Call · 12 min', 'Yesterday'),
_activity(
scheme, Icons.mail, 'Sent proposal v2', '2 days ago'),
_activity(scheme, Icons.note_alt_outlined,
'Note: interested in annual plan', '4 days ago'),
],
),
);
}
Widget _action(
ColorScheme scheme, IconData icon, String label, VoidCallback onTap) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(12),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
child: Column(
children: [
CircleAvatar(
backgroundColor: scheme.primaryContainer,
child: Icon(icon, color: scheme.onPrimaryContainer),
),
const SizedBox(height: 6),
Text(label, style: const TextStyle(fontSize: 12)),
],
),
),
);
}
Widget _stat(ColorScheme scheme, String label, String value) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: scheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(14),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,
style: TextStyle(color: scheme.onSurfaceVariant, fontSize: 12)),
const SizedBox(height: 4),
Text(value,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 18)),
],
),
);
}
Widget _activity(
ColorScheme scheme, IconData icon, String title, String time) {
return ListTile(
leading: CircleAvatar(
backgroundColor: scheme.surfaceContainerHighest,
child: Icon(icon, size: 18, color: scheme.onSurfaceVariant),
),
title: Text(title),
trailing: Text(time,
style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant)),
);
}
}
void _showDemo(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
Add it to your project
Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.
First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.
How it works
All of it is literal: ‘Amara Okafor’, the $12,400 deal and three activity rows are written directly into build, with _action, _stat and _activity as layout helpers. The Call, Email and Meet shortcuts are InkWells that show a SnackBar through _notify, without placing a call or opening anything. The email and phone ListTiles have no onTap.
Adapting it
- Define a lead model and pass it to
LeadDetailin place of the strings. - Replace the
_notifycallbacks with url_launcher fortel:andmailto:links. - Build
_activityrows from a list fetched for this lead, and open your edit form from theIcons.editbutton.