barcode_scanner/lib/pages/operation/reception/reception_details_page_model.dart
mandreshope 61047f266d chore: Renames project to e_scan
Performs a comprehensive project rename from 'barcode_scanner' to 'e_scan' (or 'eScan' for user-facing labels). This update spans all relevant files, including:

- Application IDs and bundle identifiers for Android, iOS, macOS, and Linux.
- VS Code launch configurations.
- Dart package import paths.
- Project names and titles in `pubspec.yaml`, `README.md`, and platform-specific configurations (e.g., CMakeLists, Info.plist, AndroidManifest).
2025-07-30 09:19:44 +03:00

46 lines
1.4 KiB
Dart

import 'package:e_scan/backend/api/api_calls.dart';
import 'package:e_scan/backend/schema/stock_picking/stock_picking_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'reception_details_page_model.freezed.dart';
final receptionDetailsPageModelProvider =
StateNotifierProvider.autoDispose<
ReceptionDetailsPageModel,
ReceptionDetailsPageState
>((ref) {
return ReceptionDetailsPageModel();
});
class ReceptionDetailsPageModel
extends StateNotifier<ReceptionDetailsPageState> {
ReceptionDetailsPageModel() : super(const ReceptionDetailsPageState());
Future getReceptionById({required int id}) async {
try {
state = state.copyWith(loading: true);
final res = await ApiCalls.getStockPikingById(id: id);
res.when(
(data) {
state = state.copyWith(loading: false, reception: data);
},
(error) {
state = state.copyWith(loading: false);
},
);
} catch (e) {
state = state.copyWith(loading: false);
}
}
}
@freezed
abstract class ReceptionDetailsPageState with _$ReceptionDetailsPageState {
const factory ReceptionDetailsPageState({
StockPickingRecordModel? reception,
@Default(false) bool loading,
}) = _ReceptionDetailsPageState;
}