Last active
April 3, 2025 05:11
-
-
Save xster/233f00270c546620ba831ec2c59af494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | |
title: 'Restaurant Card', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: const RestaurantCard(), | |
); | |
} | |
} | |
class RestaurantCard extends StatelessWidget { | |
const RestaurantCard({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Card( | |
elevation: 5, | |
margin: const EdgeInsets.all(16), | |
child: Padding( | |
padding: const EdgeInsets.all(16), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
const Text( | |
'Bestia', | |
style: TextStyle( | |
fontSize: 24, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
Row( | |
children: [ | |
const Text( | |
'4.6', | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
), | |
), | |
const Icon(Icons.star, color: Colors.amber, size: 16), | |
const Icon(Icons.star, color: Colors.amber, size: 16), | |
const Icon(Icons.star, color: Colors.amber, size: 16), | |
const Icon(Icons.star, color: Colors.amber, size: 16), | |
const Icon(Icons.star_border, color: Colors.amber, size: 16), | |
const SizedBox(width: 4), | |
Text('(7,539) • 22.9 mi', | |
style: TextStyle(color: Colors.grey[600])), | |
], | |
), | |
Text('Italian • \$100+', | |
style: TextStyle(color: Colors.grey[600])), | |
const Text('Open • Closes 10 PM', | |
style: TextStyle(color: Colors.green)), | |
const SizedBox(height: 12), | |
SingleChildScrollView( | |
scrollDirection: Axis.horizontal, | |
child: Row( | |
children: [ | |
SizedBox( | |
width: 100, | |
height: 100, | |
child: ClipRRect( | |
borderRadius: BorderRadius.circular(8.0), | |
child: Image.network( | |
'https://www.gstatic.com/flutter-onestack-prototype/genui/example_1.jpg', | |
fit: BoxFit.cover, | |
), | |
), | |
), | |
const SizedBox(width: 8), | |
SizedBox( | |
width: 100, | |
height: 100, | |
child: ClipRRect( | |
borderRadius: BorderRadius.circular(8.0), | |
child: Image.network( | |
'https://www.gstatic.com/flutter-onestack-prototype/genui/example_1.jpg', | |
fit: BoxFit.cover, | |
), | |
), | |
), | |
const SizedBox(width: 8), | |
SizedBox( | |
width: 100, | |
height: 100, | |
child: ClipRRect( | |
borderRadius: BorderRadius.circular(8.0), | |
child: Image.network( | |
'https://www.gstatic.com/flutter-onestack-prototype/genui/example_1.jpg', | |
fit: BoxFit.cover, | |
), | |
), | |
), | |
], | |
), | |
), | |
const SizedBox(height: 12), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.start, | |
spacing: 16, | |
children: [ | |
ElevatedButton.icon( | |
onPressed: () {}, | |
icon: const Icon(Icons.directions, size: 16), | |
label: const Text('Directions'), | |
style: ElevatedButton.styleFrom( | |
foregroundColor: Colors.blue, | |
backgroundColor: Colors.white, | |
elevation: 0, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(20), | |
side: const BorderSide(color: Colors.blue), | |
), | |
), | |
), | |
ElevatedButton.icon( | |
onPressed: () {}, | |
icon: const Icon(Icons.restaurant, size: 16), | |
label: const Text('Make reservation'), | |
style: ElevatedButton.styleFrom( | |
backgroundColor: Colors.blue, | |
foregroundColor: Colors.white, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(20), | |
), | |
), | |
), | |
], | |
), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment