Added Streams to TourRepository
This commit is contained in:
@ -1,12 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/presentation/delivery_detail_page.dart';
|
||||
|
||||
import '../../../../bloc/app_bloc.dart';
|
||||
import '../../../../bloc/app_states.dart';
|
||||
import '../../../../widget/operations/bloc/operation_bloc.dart';
|
||||
import '../../detail/bloc/note_bloc.dart';
|
||||
import '../../detail/repository/note_repository.dart';
|
||||
import '../../detail/service/notes_service.dart';
|
||||
|
||||
class DeliveryListItem extends StatelessWidget {
|
||||
final Delivery delivery;
|
||||
final double distance;
|
||||
|
||||
const DeliveryListItem({super.key, required this.delivery, required this.distance});
|
||||
const DeliveryListItem({
|
||||
super.key,
|
||||
required this.delivery,
|
||||
required this.distance,
|
||||
});
|
||||
|
||||
Widget _leading(BuildContext context) {
|
||||
if (delivery.state == DeliveryState.finished) {
|
||||
@ -17,6 +29,10 @@ class DeliveryListItem extends StatelessWidget {
|
||||
return Icon(Icons.cancel_rounded, color: Colors.red);
|
||||
}
|
||||
|
||||
if (delivery.state == DeliveryState.onhold) {
|
||||
return Icon(Icons.pause_circle, color: Colors.orange);
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
@ -29,7 +45,19 @@ class DeliveryListItem extends StatelessWidget {
|
||||
void _goToDelivery(BuildContext context) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DeliveryDetail(delivery: delivery),
|
||||
builder:
|
||||
(context) => BlocProvider(
|
||||
create:
|
||||
(context) => NoteBloc(
|
||||
deliveryId: delivery.id,
|
||||
opBloc: context.read<OperationBloc>(),
|
||||
repository: NoteRepository(
|
||||
service: NoteService(),
|
||||
),
|
||||
),
|
||||
|
||||
child: DeliveryDetail(deliveryId: delivery.id),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user