diff --git a/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart b/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart index 5cfceea8..fa2af925 100644 --- a/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart +++ b/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart @@ -21,22 +21,14 @@ class AddDeviceTypeWidget extends StatelessWidget { backgroundColor: ColorsManager.whiteColors, content: BlocBuilder( builder: (context, state) => switch (state) { - ProductsInitial() => const Center( - child: CircularProgressIndicator(), - ), - ProductsLoading() => const Center( - child: CircularProgressIndicator(), - ), + ProductsInitial() => _buildLoading(context), + ProductsLoading() => _buildLoading(context), ProductsLoaded(:final products) => ProductsGrid( products: products, ), - ProductsFailure(:final errorMessage) => Center( - child: Text( - errorMessage, - style: context.textTheme.bodyMedium?.copyWith( - color: context.theme.colorScheme.error, - ), - ), + ProductsFailure(:final errorMessage) => _buildFailure( + context, + errorMessage, ), }, ), @@ -44,4 +36,25 @@ class AddDeviceTypeWidget extends StatelessWidget { ), ); } + + Widget _buildLoading(BuildContext context) => SizedBox( + width: context.screenWidth * 0.9, + height: context.screenHeight * 0.65, + child: const Center(child: CircularProgressIndicator()), + ); + + Widget _buildFailure(BuildContext context, String errorMessage) { + return SizedBox( + width: context.screenWidth * 0.9, + height: context.screenHeight * 0.65, + child: Center( + child: SelectableText( + errorMessage, + style: context.textTheme.bodyMedium?.copyWith( + color: context.theme.colorScheme.error, + ), + ), + ), + ); + } }