Created
March 21, 2024 01:26
-
-
Save DMRE/f234662ac8e9e32929d4547cf91c4c81 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
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(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
useMaterial3: true, | |
brightness: Brightness.dark, | |
appBarTheme: const AppBarTheme( | |
backgroundColor: Colors.black, | |
titleTextStyle: TextStyle(color: Colors.white, fontSize: 20), | |
), | |
), | |
home: MenuScreen(), | |
); | |
} | |
} | |
class MenuScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
leading: IconButton( | |
icon: Icon(Icons.arrow_back, color: Colors.white), | |
onPressed: () => Navigator.of(context).pop(), | |
), | |
title: Text('Atras...'), | |
elevation: 0, | |
), | |
body: Padding( | |
padding: const EdgeInsets.all(16.0), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
TextField( | |
decoration: InputDecoration( | |
filled: true, | |
fillColor: Colors.white, | |
hintText: 'Buscar en menú', | |
prefixIcon: Icon(Icons.search, color: Colors.black), | |
border: OutlineInputBorder( | |
borderRadius: BorderRadius.circular(30), | |
borderSide: BorderSide.none, | |
), | |
), | |
), | |
SizedBox(height: 32), | |
Text( | |
'Selecciona el platillo', | |
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), | |
), | |
SizedBox(height: 16), | |
MenuItem( | |
category: 'Desayuno', | |
title: 'Burrito de Machaca', | |
description: 'Burrito de machaca y huevo a la mexicana.', | |
price: 146, | |
color: Colors.orange, | |
), | |
MenuItem( | |
category: 'Postres', | |
title: 'Cuernito', | |
description: 'Delicioso cuernito lleno de chocolate', | |
price: 20, | |
color: Colors.blue, | |
), | |
], | |
), | |
), | |
); | |
} | |
} | |
class MenuItem extends StatelessWidget { | |
final String category; | |
final String title; | |
final String description; | |
final int price; | |
final Color color; | |
const MenuItem({ | |
Key? key, | |
required this.category, | |
required this.title, | |
required this.description, | |
required this.price, | |
required this.color, | |
}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
margin: const EdgeInsets.symmetric(vertical: 8), | |
decoration: BoxDecoration( | |
color: color, | |
borderRadius: BorderRadius.circular(8), | |
), | |
child: ListTile( | |
title: Text( | |
title, | |
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), | |
), | |
subtitle: Text(description), | |
trailing: Text( | |
'\$${price.toString()}', | |
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), | |
), | |
onTap: () { | |
// Handle item tap | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment