-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stripe' of https://github.com/mo7amedaliEbaid/garcon
- Loading branch information
Showing
13 changed files
with
322 additions
and
197 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
import '../../../models/models.dart'; | ||
import 'package:garcon/repositories/repositories.dart'; | ||
|
||
part 'get_orders_state.dart'; | ||
|
||
class GetOrdersCubit extends Cubit<GetOrdersState> { | ||
final BaseOrdersRepository ordersRepository; | ||
|
||
GetOrdersCubit({required this.ordersRepository}) : super(GetOrdersInitial()); | ||
|
||
void getOrders(String userId) { | ||
emit(GetOrdersLoading()); | ||
ordersRepository.getOrders(userId).listen( | ||
(orders) { | ||
emit(GetOrdersLoaded(orders: orders)); | ||
}, | ||
onError: (error) { | ||
emit(GetOrdersError(errorMessage: error.toString())); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
part of 'get_orders_cubit.dart'; | ||
|
||
abstract class GetOrdersState extends Equatable { | ||
const GetOrdersState(); | ||
|
||
@override | ||
List<Object?> get props => []; | ||
} | ||
|
||
class GetOrdersInitial extends GetOrdersState {} | ||
|
||
class GetOrdersLoading extends GetOrdersState {} | ||
|
||
class GetOrdersLoaded extends GetOrdersState { | ||
final List<PickupsOrder> orders; | ||
|
||
const GetOrdersLoaded({required this.orders}); | ||
|
||
@override | ||
List<Object?> get props => [orders]; | ||
} | ||
|
||
class GetOrdersError extends GetOrdersState { | ||
final String errorMessage; | ||
|
||
const GetOrdersError({required this.errorMessage}); | ||
|
||
@override | ||
List<Object?> get props => [errorMessage]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.