From 8eadef3f929f166fea2b0d035d8b6fe8e877268c Mon Sep 17 00:00:00 2001 From: ssbg04 Date: Wed, 19 Aug 2026 00:45:29 +0800 Subject: [PATCH] fix(ui): ensure all button loading indicators render as perfect circles with SizedBox.square and Center --- .../lib/ui/screens/login/login_screen.dart | 5 +++- .../requirements_settings_screen.dart | 13 +++++----- .../ui/screens/students/students_screen.dart | 9 ++++--- .../students/widgets/add_student_modal.dart | 26 ++++++++++--------- .../widgets/bulk_ocr_import_dialog.dart | 10 +++---- .../students/widgets/edit_student_modal.dart | 5 ++-- .../ocr_enrollment_validation_modal.dart | 5 ++-- .../lib/ui/shared/buttons/primary_button.dart | 13 +++++----- .../dialogs/file_save_preview_dialog.dart | 5 ++-- 9 files changed, 47 insertions(+), 44 deletions(-) diff --git a/frontend/lib/ui/screens/login/login_screen.dart b/frontend/lib/ui/screens/login/login_screen.dart index f7c9b32..afadcd5 100644 --- a/frontend/lib/ui/screens/login/login_screen.dart +++ b/frontend/lib/ui/screens/login/login_screen.dart @@ -971,7 +971,10 @@ class _NetworkScanDialogState extends State<_NetworkScanDialog> { title: const Text('Local Network Scan'), content: Row( children: [ - const CircularProgressIndicator(), + const SizedBox.square( + dimension: 24, + child: CircularProgressIndicator(strokeWidth: 2.5), + ), const SizedBox(width: 20), Expanded(child: Text(_status)), ], diff --git a/frontend/lib/ui/screens/settings/requirements_settings_screen.dart b/frontend/lib/ui/screens/settings/requirements_settings_screen.dart index 6a79399..9aac9ed 100644 --- a/frontend/lib/ui/screens/settings/requirements_settings_screen.dart +++ b/frontend/lib/ui/screens/settings/requirements_settings_screen.dart @@ -1640,12 +1640,13 @@ class _BulkEditModalState extends ConsumerState<_BulkEditModal> { ? null : _handleBulkSave, child: _isLoading - ? const SizedBox( - width: 16, - height: 16, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Colors.white, + ? const Center( + child: SizedBox.square( + dimension: 16, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), ), ) : const Text('APPLY'), diff --git a/frontend/lib/ui/screens/students/students_screen.dart b/frontend/lib/ui/screens/students/students_screen.dart index 84b194b..fe1c219 100644 --- a/frontend/lib/ui/screens/students/students_screen.dart +++ b/frontend/lib/ui/screens/students/students_screen.dart @@ -643,10 +643,11 @@ class _StudentsScreenState extends ConsumerState { }, style: TextButton.styleFrom(foregroundColor: AppColors.error), child: isLoading - ? const SizedBox( - width: 16, - height: 16, - child: CircularProgressIndicator(strokeWidth: 2), + ? const Center( + child: SizedBox.square( + dimension: 16, + child: CircularProgressIndicator(strokeWidth: 2), + ), ) : const Text('DELETE'), ), diff --git a/frontend/lib/ui/screens/students/widgets/add_student_modal.dart b/frontend/lib/ui/screens/students/widgets/add_student_modal.dart index 61354ca..457bebc 100644 --- a/frontend/lib/ui/screens/students/widgets/add_student_modal.dart +++ b/frontend/lib/ui/screens/students/widgets/add_student_modal.dart @@ -1245,12 +1245,13 @@ class _AddStudentModalState extends ConsumerState { elevation: 0, ), child: _isLoading && isLastStep - ? const SizedBox( - height: 20, - width: 20, - child: CircularProgressIndicator( - color: Colors.white, - strokeWidth: 2, + ? const Center( + child: SizedBox.square( + dimension: 20, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ), ), ) : Text( @@ -1428,12 +1429,13 @@ class _AddStudentModalState extends ConsumerState { elevation: 0, ), child: _isLoading && isLastStep - ? const SizedBox( - height: 20, - width: 20, - child: CircularProgressIndicator( - color: Colors.white, - strokeWidth: 2, + ? const Center( + child: SizedBox.square( + dimension: 20, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ), ), ) : Text( diff --git a/frontend/lib/ui/screens/students/widgets/bulk_ocr_import_dialog.dart b/frontend/lib/ui/screens/students/widgets/bulk_ocr_import_dialog.dart index 00d9927..24a7dd6 100644 --- a/frontend/lib/ui/screens/students/widgets/bulk_ocr_import_dialog.dart +++ b/frontend/lib/ui/screens/students/widgets/bulk_ocr_import_dialog.dart @@ -1177,9 +1177,8 @@ class _BulkOcrImportDialogState extends ConsumerState { ElevatedButton.icon( onPressed: _isProcessing ? null : _processAll, icon: _isProcessing - ? SizedBox( - width: 16, - height: 16, + ? SizedBox.square( + dimension: 16, child: CircularProgressIndicator( strokeWidth: 2, color: isDark ? Colors.white : Colors.black)) @@ -1217,9 +1216,8 @@ class _BulkOcrImportDialogState extends ConsumerState { ElevatedButton.icon( onPressed: _isImporting ? null : _importAll, icon: _isImporting - ? SizedBox( - width: 16, - height: 16, + ? SizedBox.square( + dimension: 16, child: CircularProgressIndicator( strokeWidth: 2, color: isDark ? Colors.white : Colors.black)) diff --git a/frontend/lib/ui/screens/students/widgets/edit_student_modal.dart b/frontend/lib/ui/screens/students/widgets/edit_student_modal.dart index 601424c..669c195 100644 --- a/frontend/lib/ui/screens/students/widgets/edit_student_modal.dart +++ b/frontend/lib/ui/screens/students/widgets/edit_student_modal.dart @@ -708,9 +708,8 @@ class _EditStudentModalState extends ConsumerState { final ocrButton = OutlinedButton.icon( onPressed: _isOcrScanning ? null : _handleScanEnrollmentFromSF, icon: _isOcrScanning - ? const SizedBox( - width: 16, - height: 16, + ? const SizedBox.square( + dimension: 16, child: CircularProgressIndicator(strokeWidth: 2), ) : const Icon(Icons.document_scanner, size: 18), diff --git a/frontend/lib/ui/screens/students/widgets/ocr_enrollment_validation_modal.dart b/frontend/lib/ui/screens/students/widgets/ocr_enrollment_validation_modal.dart index 4092fba..9bd1935 100644 --- a/frontend/lib/ui/screens/students/widgets/ocr_enrollment_validation_modal.dart +++ b/frontend/lib/ui/screens/students/widgets/ocr_enrollment_validation_modal.dart @@ -406,9 +406,8 @@ class _OcrEnrollmentValidationModalState padding: EdgeInsets.zero, constraints: const BoxConstraints(), icon: _acceptingIndex == index - ? const SizedBox( - width: 18, - height: 18, + ? const SizedBox.square( + dimension: 18, child: CircularProgressIndicator(strokeWidth: 2), ) : const Icon( diff --git a/frontend/lib/ui/shared/buttons/primary_button.dart b/frontend/lib/ui/shared/buttons/primary_button.dart index d0d461f..870d730 100644 --- a/frontend/lib/ui/shared/buttons/primary_button.dart +++ b/frontend/lib/ui/shared/buttons/primary_button.dart @@ -29,12 +29,13 @@ class PrimaryButton extends StatelessWidget { elevation: 0, ), child: isLoading - ? const SizedBox( - height: 24, - width: 24, - child: CircularProgressIndicator( - color: Colors.white, - strokeWidth: 2.5, + ? const Center( + child: SizedBox.square( + dimension: 22, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2.5, + ), ), ) : Text( diff --git a/frontend/lib/ui/shared/dialogs/file_save_preview_dialog.dart b/frontend/lib/ui/shared/dialogs/file_save_preview_dialog.dart index edd00c8..d5204cc 100644 --- a/frontend/lib/ui/shared/dialogs/file_save_preview_dialog.dart +++ b/frontend/lib/ui/shared/dialogs/file_save_preview_dialog.dart @@ -666,9 +666,8 @@ class _FileSavePreviewDialogState extends State<_FileSavePreviewDialog> { child: ElevatedButton.icon( onPressed: _isSaving ? null : _save, icon: _isSaving - ? const SizedBox( - width: 16, - height: 16, + ? const SizedBox.square( + dimension: 16, child: CircularProgressIndicator( strokeWidth: 2, color: Colors.white,