12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import 'package:flutter/material.dart';
- import 'custom_info_card.dart';
-
- class FavoritesPage extends StatelessWidget {
- final List<Map<String, dynamic>> favoriteCards;
-
- const FavoritesPage({super.key, required this.favoriteCards});
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- flexibleSpace: Padding(
- padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top - 20),
- child: Image.asset(
- 'assets/header_image.png',
- fit: BoxFit.cover,
- ),
- ),
- toolbarHeight: MediaQuery.of(context).size.height * 0.19,
- title: const Text('Mis Favoritos', style: TextStyle(color: Colors.white)),
- ),
- body: Container(
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- colors: [Color.fromARGB(255, 254, 100, 91), Colors.orange],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: favoriteCards.isEmpty
- ? const Center(
- child: Text(
- 'No tienes favoritos aún',
- style: TextStyle(color: Colors.white, fontSize: 18),
- ),
- )
- : ListView.builder(
- padding: const EdgeInsets.only(top: 16),
- itemCount: favoriteCards.length,
- itemBuilder: (context, index) {
- final card = favoriteCards[index];
- return CustomInfoCard(
- imagePath: "assets/icons/${card['image']}",
- title: card['title'],
- subtitle: card['subtitle'],
- texto: card['texto'],
- isFavorite: true,
- );
- },
- ),
- ),
- );
- }
- }
|