yourWidget method
Implementation
@override
Widget yourWidget(BuildContext context, OrderOverviewModel? value) {
return BlocBuilder<AccessBloc, AccessState>(
builder: (context, accessState) {
if (accessState is AccessDetermined) {
if (accessState.memberIsOwner(app.documentID)) {
// allow owner of the app to see ALL orders and update shipment details
return BlocProvider<OrderListBloc>(
create: (context) => OrderListBloc(
orderRepository: AbstractRepositorySingleton.singleton
.orderRepository(app.documentID)!,
)..add(LoadOrderList()),
child: OrderListWidget(
app: app, readOnly: false, form: 'OrderShipmentForm'),
);
} else {
// allow member to view his own orders
return BlocProvider<OrderListBloc>(
create: (context) => OrderListBloc(
orderRepository: AbstractRepositorySingleton.singleton
.orderRepository(app.documentID)!,
)..add(LoadOrderList()),
child: OrderListWidget(app: app, readOnly: true),
);
}
} else {
return progressIndicator(app, context);
}
});
}