Feature Comparison
Loading preview
Starting the Flutter app
A showcase of Flutter's feature comparison functionality
import 'package:flutter/material.dart';
const _features = [
{'name': 'Projects', 'free': '3', 'pro': 'Unlimited', 'enterprise': 'Unlimited'},
{'name': 'Storage', 'free': '1 GB', 'pro': '10 GB', 'enterprise': '100 GB'},
{'name': 'Support', 'free': 'Email', 'pro': 'Priority', 'enterprise': 'Dedicated'},
{'name': 'API Access', 'free': '—', 'pro': '✓', 'enterprise': '✓'},
];
class FeatureComparison extends StatelessWidget {
const FeatureComparison({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Compare Plans')),
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: const [
DataColumn(label: Text('Feature')),
DataColumn(label: Text('Free')),
DataColumn(label: Text('Pro')),
DataColumn(label: Text('Enterprise')),
],
rows: _features.map((f) => DataRow(
cells: [
DataCell(Text(f['name'] as String)),
DataCell(Text(f['free'] as String)),
DataCell(Text(f['pro'] as String)),
DataCell(Text(f['enterprise'] as String)),
],
)).toList(),
),
),
);
}
}
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
A DataTable built from the const _features list, inside a horizontal SingleChildScrollView so narrow screens can pan sideways. All cells are strings, including the dash and check mark for API access. There’s no vertical scrolling, so a much longer table would be cut off. Neither the column headers nor the rows have any interaction, and no plan can be chosen here.
Adapting it
- Update
_featureswith your plan limits, or generate it from pricing config shared with your paywall. - Wrap the scroll view in a vertical
SingleChildScrollViewonce rows grow. - Show
Icons inDataCellwhere'✓'is used now.