You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
921 B
28 lines
921 B
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:thesis_shop/stores/product_list_provider.dart';
|
|
import 'package:thesis_shop/widgets/user_switch.dart';
|
|
|
|
import 'cart_button_overlay.dart';
|
|
import 'product_list.dart';
|
|
|
|
class ProductListScreen extends ConsumerWidget {
|
|
const ProductListScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Thesis Shop'),
|
|
actions: const [UserSwitch()],
|
|
),
|
|
body: ref.watch(productListProvider).when(
|
|
data: (products) => CartButtonOverlay(
|
|
child: ProductList(products: products),
|
|
),
|
|
error: (error, _) => Center(child: Text(error.toString())),
|
|
loading: () => const Center(child: CircularProgressIndicator()),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|