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.
31 lines
1.0 KiB
31 lines
1.0 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
import 'package:thesis_shop/redux/state.dart';
|
|
import 'package:thesis_shop/widgets/user_switch.dart';
|
|
|
|
import 'cart_button_overlay.dart';
|
|
import 'product_list.dart';
|
|
|
|
class ProductListScreen extends StatelessWidget {
|
|
const ProductListScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Thesis Shop'),
|
|
actions: [UserSwitch(isOn: true, onChanged: (_) {})],
|
|
),
|
|
body: StoreConnector<AppState, RemoteProducts>(
|
|
converter: (store) => store.state.remoteProductsWithDiscount,
|
|
builder: (context, remoteProducts) => remoteProducts.when(
|
|
finished: (products) => CartButtonOverlay(
|
|
child: ProductList(products: products),
|
|
),
|
|
error: (errorMessage) => Center(child: Text(errorMessage)),
|
|
loading: () => const Center(child: CircularProgressIndicator()),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|