import 'package:flutter/material.dart'; import 'package:outbag_app/backend/room.dart'; class ShoppingListPage extends StatefulWidget { final RoomInfo? info; final Room? room; const ShoppingListPage(this.room, this.info, {super.key}); @override State createState() => _ShoppingListPageState(); } class _ShoppingListPageState extends State { List list = []; void loadData() async { //bool foundData = false; // TODO: 1. load data from disk (if available) // NOTE: errors do not matter, // hopefully the network request will succeed try { //List list = await ShoppingListItem.getAllFromDisk(); //setState(() { // this.list = list; //}) //foundData = true; } catch (_) {} // TODO: 2. load data from web // NOTE: might want to close room // or show snackbar if no data is available } @override void initState() { super.initState(); loadData(); } @override Widget build(BuildContext context) { return ListView.builder( itemBuilder: (ctx, index) { final item = list[index]; return ListTile(); }, itemCount: list.length, ); } }