From f3ac4a502cc8e05c32843b9ddb474ae4eefc2735 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Mar 2023 21:16:00 +0100 Subject: [PATCH] Added stub screens Used as a placeholder, whilst other screens are currently worked on. NOTE: there is no finished specification for Products and Shopping List Items --- lib/screens/room/categories.dart | 19 ++++++++++ lib/screens/room/products.dart | 19 ++++++++++ lib/screens/room/shopping_list.dart | 56 +++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 lib/screens/room/categories.dart create mode 100644 lib/screens/room/products.dart create mode 100644 lib/screens/room/shopping_list.dart diff --git a/lib/screens/room/categories.dart b/lib/screens/room/categories.dart new file mode 100644 index 0000000..f89771a --- /dev/null +++ b/lib/screens/room/categories.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:outbag_app/backend/room.dart'; + +class RoomCategoriesPage extends StatefulWidget { + final RoomInfo? info; + final Room? room; + + const RoomCategoriesPage(this.room, this.info, {super.key}); + + @override + State createState() => _RoomCategoriesPageState(); +} + +class _RoomCategoriesPageState extends State { + @override + Widget build(BuildContext context) { + return const Text('Categories'); + } +} diff --git a/lib/screens/room/products.dart b/lib/screens/room/products.dart new file mode 100644 index 0000000..c4b24c8 --- /dev/null +++ b/lib/screens/room/products.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:outbag_app/backend/room.dart'; + +class RoomProductsPage extends StatefulWidget { + final RoomInfo? info; + final Room? room; + + const RoomProductsPage(this.room, this.info, {super.key}); + + @override + State createState() => _RoomProductsPageState(); +} + +class _RoomProductsPageState extends State { + @override + Widget build(BuildContext context) { + return const Text('Products'); + } +} diff --git a/lib/screens/room/shopping_list.dart b/lib/screens/room/shopping_list.dart new file mode 100644 index 0000000..4eab83c --- /dev/null +++ b/lib/screens/room/shopping_list.dart @@ -0,0 +1,56 @@ +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, + ); + } +}