123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- import 'package:flutter/material.dart';
- import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
- import 'package:turquessa_mesas_hoster/mvvm/views/home/categorias_navbar.dart';
- const List<Map<String, dynamic>> items = [
- {
- 'titulo': 'Hamburguesa de res',
- 'descripcion': 'Hamburguesa de res con queso cheddar',
- 'precio': '\$ 120.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de res',
- 'descripcion': 'Hamburguesa de res con queso cheddar',
- 'precio': '\$ 120.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- {
- 'titulo': 'Hamburguesa de pollo',
- 'descripcion': 'Hamburguesa de pollo con queso cheddar',
- 'precio': '\$ 100.00',
- 'imageUrl':
- 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
- },
- ];
- class HomeScreen extends StatefulWidget {
- const HomeScreen({Key? key}) : super(key: key);
- @override
- State<HomeScreen> createState() => _HomeScreenState();
- }
- class _HomeScreenState extends State<HomeScreen> {
- @override
- void initState() {
- super.initState();
- }
- handleTap() {
- print('Tapped');
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: CustomScrollView(
- slivers: [
- SliverToBoxAdapter(
- child: Container(),
- ),
- SliverAppBar(
- floating: true,
- expandedHeight: 200, // Ajusta la altura para acomodar la imagen
- flexibleSpace: FlexibleSpaceBar(
- background: Image.asset(
- 'assets/Turquessa.png',
- fit: BoxFit.cover,
- ),
- ),
- bottom: PreferredSize(
- preferredSize:
- Size.fromHeight(120), // Altura del contenido adicional
- child: Container(
- color: Color.fromARGB(255, 47, 208, 229),
- padding:
- const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
- child: Row(
- children: [
- Container(
- width: 80,
- height: 80,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Center(
- child: Image.asset('assets/Turquessa.png'),
- ),
- ),
- const SizedBox(width: 20),
- const Text(
- 'Turquessa',
- style: TextStyle(
- color: Colors.black,
- fontSize: 26,
- fontWeight: FontWeight.bold,
- ),
- ),
- const SizedBox(width: 15),
- Container(
- padding: const EdgeInsets.all(8),
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(color: Colors.white, width: 2),
- ),
- child: const Icon(Icons.info,
- color: Colors.white, size: 20),
- ),
- ],
- ),
- ),
- ),
- ),
- SliverPersistentHeader(
- delegate: CategoriasSliverChild(),
- pinned: true,
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index < items.length) {
- return Column(
- children: [
- _buildBurgerItem(
- items[index]['titulo'],
- items[index]['descripcion'],
- items[index]['precio'],
- items[index]['imageUrl']),
- const Divider(
- color: Colors.black,
- height: 2,
- )
- ],
- );
- } else {
- return _buildBurgerItem(
- items[index]['titulo'],
- items[index]['descripcion'],
- items[index]['precio'],
- items[index]['imageUrl']);
- }
- },
- childCount: items.length,
- ))
- ],
- ));
- }
- }
- class CategoriasSliverChild extends SliverPersistentHeaderDelegate {
- @override
- Widget build(
- BuildContext context, double shrinkOffset, bool overlapsContent) {
- return SingleChildScrollView(
- scrollDirection: Axis.horizontal, child: CategoriasNavBar());
- }
- @override
- double get maxExtent => 120.0;
- @override
- double get minExtent => 120.0;
- @override
- bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
- return false;
- }
- }
- Widget _buildBurgerItem(
- String titulo, String descripcion, String precio, String imageUrl) {
- return Padding(
- padding: const EdgeInsets.symmetric(vertical: 20),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(width: 20),
- ClipRRect(
- borderRadius: BorderRadius.circular(8),
- child: Image.network(
- imageUrl,
- width: 120,
- height: 120,
- fit: BoxFit.cover,
- ),
- ),
- const SizedBox(width: 20),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- titulo,
- style: const TextStyle(
- color: Colors.black,
- fontSize: 22,
- fontWeight: FontWeight.bold,
- ),
- ),
- const SizedBox(height: 10),
- Text(
- descripcion,
- style: const TextStyle(
- color: Colors.grey,
- fontSize: 16,
- ),
- ),
- const SizedBox(height: 20),
- Text(
- precio,
- style: const TextStyle(
- color: Colors.black,
- fontSize: 24,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ),
- const SizedBox(width: 20),
- ],
- ),
- );
- }
|