Enhance AnalyticsDeviceDropdown to show loading indicator during loading state.

This commit is contained in:
Faris Armoush
2025-06-27 11:56:43 +03:00
parent 9c02bed4c0
commit 11e2853403

View File

@ -27,16 +27,30 @@ class AnalyticsDeviceDropdown extends StatelessWidget {
width: 1, width: 1,
), ),
), ),
child: Visibility(
visible: state.status != AnalyticsDevicesStatus.loading,
replacement: _buildLoadingIndicator(),
child: Visibility( child: Visibility(
visible: state.devices.isNotEmpty, visible: state.devices.isNotEmpty,
replacement: _buildNoDevicesFound(context), replacement: _buildNoDevicesFound(context),
child: _buildDevicesDropdown(context, state), child: _buildDevicesDropdown(context, state),
), ),
),
); );
}, },
); );
} }
Widget _buildLoadingIndicator() {
return const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(strokeWidth: 3),
),
);
}
static const _defaultPadding = EdgeInsetsDirectional.symmetric( static const _defaultPadding = EdgeInsetsDirectional.symmetric(
horizontal: 20, horizontal: 20,
vertical: 2, vertical: 2,