improvement

ui_ux_rollout_merge_notification_settings
Sikander Saleem 6 hours ago
parent 3afcb220a7
commit b1ef110e87

@ -80,8 +80,7 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
return widget.initialValue!.any((init) { return widget.initialValue!.any((init) {
// Try Lookup-specific comparison first (id/value) // Try Lookup-specific comparison first (id/value)
if (element is Lookup && init is Lookup) { if (element is Lookup && init is Lookup) {
return (element.id != null && element.id == init.id) || return (element.id != null && element.id == init.id) || (element.value != null && element.value == init.value);
(element.value != null && element.value == init.value);
} }
// Fallback to identifier comparison // Fallback to identifier comparison
if (element.identifier != null && init.identifier != null) { if (element.identifier != null && init.identifier != null) {
@ -124,8 +123,7 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
return widget.initialValue!.any((init) { return widget.initialValue!.any((init) {
// Try Lookup-specific comparison first (id/value) // Try Lookup-specific comparison first (id/value)
if (element is Lookup && init is Lookup) { if (element is Lookup && init is Lookup) {
return (element.id != null && element.id == init.id) || return (element.id != null && element.id == init.id) || (element.value != null && element.value == init.value);
(element.value != null && element.value == init.value);
} }
// Fallback to identifier comparison // Fallback to identifier comparison
if (element.identifier != null && init.identifier != null) { if (element.identifier != null && init.identifier != null) {
@ -166,8 +164,7 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
final hasMatch = oldWidget.initialValue.any((old) { final hasMatch = oldWidget.initialValue.any((old) {
// Try Lookup-specific comparison first (id/value) // Try Lookup-specific comparison first (id/value)
if (old is Lookup && current is Lookup) { if (old is Lookup && current is Lookup) {
return (old.id != null && old.id == current.id) || return (old.id != null && old.id == current.id) || (old.value != null && old.value == current.value);
(old.value != null && old.value == current.value);
} }
// Fallback to identifier comparison // Fallback to identifier comparison
if (old.identifier != null && current.identifier != null) { if (old.identifier != null && current.identifier != null) {
@ -189,15 +186,11 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
final isEmpty = (X == NullableLoadingProvider ? widget.staticData : provider?.items)?.isEmpty ?? true; final isEmpty = (X == NullableLoadingProvider ? widget.staticData : provider?.items)?.isEmpty ?? true;
// Determine the actual loading state - respect explicit loading prop and enabled state // Determine the actual loading state - respect explicit loading prop and enabled state
final bool isActuallyLoading = widget.enabled final bool isActuallyLoading = widget.enabled ? (widget.loading ?? ((X == NullableLoadingProvider) ? false : provider?.loading ?? false)) : false; // Never show loading when disabled
? (widget.loading ?? ((X == NullableLoadingProvider) ? false : provider?.loading ?? false))
: false; // Never show loading when disabled
// Provide a valid stateCode when disabled to prevent AppLoadingManager from auto-fetching // Provide a valid stateCode when disabled to prevent AppLoadingManager from auto-fetching
// When enabled, use the provider's actual stateCode // When enabled, use the provider's actual stateCode
final int? effectiveStateCode = widget.enabled final int? effectiveStateCode = widget.enabled ? ((X == NullableLoadingProvider) ? 200 : provider?.stateCode) : 200; // Return 200 when disabled to indicate "loaded" state (prevents auto-fetch)
? ((X == NullableLoadingProvider) ? 200 : provider?.stateCode)
: 200; // Return 200 when disabled to indicate "loaded" state (prevents auto-fetch)
return AppLoadingManager( return AppLoadingManager(
isLoading: isActuallyLoading, isLoading: isActuallyLoading,
@ -240,7 +233,7 @@ class _MultipleItemDropDownMenuState<T extends Base, X extends LoadingListNotifi
if (_selectedItem.isEmpty) if (_selectedItem.isEmpty)
Text( Text(
context.translation.select, context.translation.select,
style: Theme.of(context).textTheme.bodyLarge, style: AppTextStyles.bodyText.copyWith(color: AppColor.textStyleColor(context)),
) )
else else
Wrap( Wrap(

Loading…
Cancel
Save