diff --git a/lib/ui/views/projects/project_details_view.dart b/lib/ui/views/projects/project_details_view.dart index 979e0d41..9097c56a 100644 --- a/lib/ui/views/projects/project_details_view.dart +++ b/lib/ui/views/projects/project_details_view.dart @@ -34,6 +34,7 @@ class _ProjectDetailsViewState extends State { final DialogService _dialogService = locator(); late ProjectDetailsViewModel _model; final _formKey = GlobalKey(); + bool _isBeingStarred = false; late String _emails; late Project _recievedProject; final GlobalKey addButtonGlobalKey = @@ -288,6 +289,7 @@ class _ProjectDetailsViewState extends State { } Future onStarProjectPressed() async { + _isBeingStarred = true; await _model.toggleStarForProject(_recievedProject.id); if (_model.isSuccess(_model.TOGGLE_STAR)) { @@ -301,23 +303,30 @@ class _ProjectDetailsViewState extends State { _model.errorMessageFor(_model.TOGGLE_STAR), ); } + _isBeingStarred = false; } Widget _buildStarProjectButton() { - return InkWell( - onTap: onStarProjectPressed, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: CVTheme.primaryColor, - borderRadius: BorderRadius.circular(4), - ), - child: Icon( - _model.isProjectStarred ? Icons.star : Icons.star_border, - color: Colors.white, - ), - ), - ); + return _isBeingStarred + ? const SizedBox( + height: 30, + width: 30, + child: CircularProgressIndicator(), + ) + : InkWell( + onTap: onStarProjectPressed, + child: Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: CVTheme.primaryColor, + borderRadius: BorderRadius.circular(4), + ), + child: Icon( + _model.isProjectStarred ? Icons.star : Icons.star_border, + color: Colors.white, + ), + ), + ); } Future onAddCollaboratorsPressed(BuildContext context) async {