import 'package:flutter/material.dart'; import 'package:meals/models/Meal.dart'; import 'package:meals/widgets/MealItem.dart'; class MealsScreen extends StatelessWidget { final String title; final List meals; const MealsScreen({super.key, required this.title, required this.meals}); @override Widget build(BuildContext context) { final Widget content = meals.isEmpty ? Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'Oh, there is no meals right here.', style: Theme.of(context).textTheme.headlineLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, ), ), const SizedBox(height: 16), Text( 'Would you to try something else ?', style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onBackground, ), ), ], ), ) : ListView.builder( itemBuilder: (BuildContext context, int index) { return MealItem(meal: meals[index]); }, itemCount: meals.length, ); return Scaffold( appBar: AppBar( title: Text(title), ), body: content, ); } }