|
|
|
|
@ -7,7 +7,7 @@ import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart';
|
|
|
|
|
import '../../../../models/new_models/assistant_employee.dart';
|
|
|
|
|
|
|
|
|
|
class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
|
|
|
|
|
class ServiceReportAssistantEmployeeMenu extends StatefulWidget {
|
|
|
|
|
final Function(AssistantEmployees) onSelect;
|
|
|
|
|
final AssistantEmployees initialValue;
|
|
|
|
|
final String title;
|
|
|
|
|
@ -16,6 +16,28 @@ class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
const ServiceReportAssistantEmployeeMenu({Key key, this.enabled = true, @required this.onSelect, @required this.assetId, this.title, this.initialValue}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<ServiceReportAssistantEmployeeMenu> createState() => _ServiceReportAssistantEmployeeMenuState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ServiceReportAssistantEmployeeMenuState extends State<ServiceReportAssistantEmployeeMenu> {
|
|
|
|
|
AssistantEmployees _initialValue;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_initialValue = widget.initialValue;
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didUpdateWidget(covariant ServiceReportAssistantEmployeeMenu oldWidget) {
|
|
|
|
|
if (widget.initialValue != oldWidget.initialValue) {
|
|
|
|
|
_initialValue = widget.initialValue;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
super.didUpdateWidget(oldWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ServiceReportAssistantsEmployeeProvider menuProvider = Provider.of<ServiceReportAssistantsEmployeeProvider>(context);
|
|
|
|
|
@ -24,15 +46,15 @@ class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
|
|
|
|
|
isFailedLoading: menuProvider.assistantEmployees == null,
|
|
|
|
|
stateCode: menuProvider.stateCode,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
await menuProvider.getAssistantEmployees(assetId);
|
|
|
|
|
await menuProvider.getAssistantEmployees(widget.assetId);
|
|
|
|
|
},
|
|
|
|
|
child: SingleItemDropDownMenu<AssistantEmployees, NullableLoadingProvider>(
|
|
|
|
|
title: title,
|
|
|
|
|
title: widget.title,
|
|
|
|
|
context: context,
|
|
|
|
|
enabled: enabled,
|
|
|
|
|
initialValue: initialValue,
|
|
|
|
|
enabled: widget.enabled,
|
|
|
|
|
initialValue: _initialValue,
|
|
|
|
|
staticData: menuProvider.assistantEmployees,
|
|
|
|
|
onSelect: onSelect,
|
|
|
|
|
onSelect: widget.onSelect,
|
|
|
|
|
),
|
|
|
|
|
// child: AssistantEmployeeMenu(
|
|
|
|
|
// title: title,
|
|
|
|
|
|