Restaurant List
Loading preview
Starting the Flutter app
A showcase of Flutter's restaurant list functionality
import 'package:flutter/material.dart';
const _restaurants = [
{'name': 'Pizza Palace', 'cuisine': 'Italian', 'rating': 4.5, 'delivery': '25-35 min'},
{'name': 'Sushi Bar', 'cuisine': 'Japanese', 'rating': 4.8, 'delivery': '30-45 min'},
{'name': 'Taco Fiesta', 'cuisine': 'Mexican', 'rating': 4.2, 'delivery': '20-30 min'},
{'name': 'Ember & Bun', 'cuisine': 'American', 'rating': 4.0, 'delivery': '15-25 min'},
{'name': 'Thai Garden', 'cuisine': 'Thai', 'rating': 4.6, 'delivery': '35-45 min'},
];
class RestaurantList extends StatelessWidget {
const RestaurantList({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Restaurants')),
body: ListView.builder(
padding: const EdgeInsets.all(16),
itemCount: _restaurants.length,
itemBuilder: (context, i) {
final r = _restaurants[i];
return Card(
margin: const EdgeInsets.only(bottom: 12),
child: Padding(
padding: const EdgeInsets.all(12),
child: Row(
children: [
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.primaries[i % Colors.primaries.length]
.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(12),
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(r['name'] as String,
style: Theme.of(context).textTheme.titleMedium),
Text(r['cuisine'] as String,
style: Theme.of(context).textTheme.bodySmall),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.star, size: 14, color: Colors.amber[700]),
Text(' ${r['rating']}', style: Theme.of(context).textTheme.bodySmall),
Text(' • ${r['delivery']}',
style: Theme.of(context).textTheme.bodySmall),
],
),
],
),
),
const Icon(Icons.chevron_right),
],
),
),
);
},
),
);
}
}
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
Rather than ListTile, every card uses a hand-built Row, which leaves room for an 80px thumbnail. That thumbnail is a tinted Container picked from Colors.primaries with a modulo, and the rating line is a Wrap, so large text breaks onto a second line. All five _restaurants are const maps. A chevron_right implies navigation, but the cards have no tap handler.
Adapting it
- Wrap the
Cardcontents in anInkWelland push your detail route. - Replace the
Containerwith a photo clipped to the same 12px radius. deliveryis a preformatted range such as25-35 min; keep numeric minutes too if you want to sort by speed, and fetch_restaurantsfrom your API.