mport ‘package:flutter/material.dart’;
import ‘…/components/grocery_tile.dart’;
import ‘…/models/models.dart’;
import ‘grocery_item_screen.dart’;
import ‘…/models/grocery_item.dart’;
class GroceryListScreen extends StatelessWidget {
final GroceryManager manager;
const GroceryListScreen({Key? key, required this.manager}) : super(key: key);
@override
Widget build(BuildContext context) {
final groceryItems = manager.groceryItems;
return Padding(
padding: const EdgeInsets.all(16.0),
child: ListView.separated(
itemCount: groceryItems.length,
itemBuilder: (context, index) {
final item = groceryItems[index];
//TODO 28: Wrap in a Dismissable
//TODO 27: Wrap in an InkWell
return GroceryTile(
key: Key(item.id), //Problem : The getter id isnt defined for the type GroceryManager
item: item, // Problem : The argument type ‘GroceryManager’ cant be assign to the parameter type ‘GroceryItem’
onComplete: (change){
if (change != null) {
manager.completeItem(index, change!);
}
},
);
},
separatorBuilder: (context, index){
return const SizedBox(height: 16.0);
},
),
);
}
}
I have highlighted the 2 bugs and given the error message that it displays. Any help appreciated thanks!