Initial commit: Penyerahan final Source code Tugas Akhir

This commit is contained in:
ferdiakhh
2025-07-10 19:15:14 +07:00
commit e1f2206b8a
687 changed files with 80132 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:initial_folder/models/detail_invoice_model.dart';
import 'package:initial_folder/services/detail_invoice_service.dart';
import 'package:provider/provider.dart';
enum ResultState { loading, noData, hasData, error }
class DetailInvoiceProvider extends ChangeNotifier {
final DetailInvoiceService _detailInvoiceService = DetailInvoiceService();
List<DataDetailInvoiceModel>? _detailInvoice;
String? _message;
String? _thumbnail;
ResultState? _state;
String? get message => _message;
String? get thumbnail => _thumbnail;
List<DataDetailInvoiceModel>? get detailInvoice => _detailInvoice;
ResultState? get state => _state;
set selectedThumbnail(String? value) {
_thumbnail = value;
notifyListeners();
}
Future<dynamic> fetchDetailInvoice(String? orderId) async {
try {
_state = ResultState.loading;
notifyListeners();
final data = await _detailInvoiceService.detailInvoice(orderId);
if (data.isEmpty) {
_state = ResultState.noData;
_message = 'Invoice Detail is Empty';
} else {
_state = ResultState.hasData;
_detailInvoice = data;
}
} catch (e) {
_state = ResultState.error;
_message = 'Error -> $e';
}
notifyListeners();
}
}