fix localprofile button

This commit is contained in:
J. A. Messias 2024-12-04 17:02:17 -03:00
parent b8c2aab73c
commit 6e100c84ce
1 changed files with 82 additions and 82 deletions

View File

@ -21,13 +21,18 @@ class LocalProfileComponentWidget extends StatefulWidget {
} }
class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidget> { class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidget> {
bool _isLoading = false;
Future retrieveProfileInfo() async {
setState(() {_isLoading = true;});
Future callback() async {
await StorageHelper().set(KeychainStorageKey.clientUUID.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
LocalsRepositoryImpl.license.add(false); LocalsRepositoryImpl.license.add(false);
final response = await LocalsRepositoryImpl().update(context); final response = await LocalsRepositoryImpl().update(context);
LocalsRepositoryImpl.license.add(response); LocalsRepositoryImpl.license.add(response);
setState(() {_isLoading = false;});
} }
@override @override
@ -58,7 +63,7 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
return BlocBuilder<LocalProfileBloc, LocalProfileState>( return BlocBuilder<LocalProfileBloc, LocalProfileState>(
builder: (context, state) { builder: (context, state) {
return _buildAsyncLocalProfile(context, state, limitedFontSize, callback); return _buildAsyncLocalProfile(context, state, limitedFontSize);
}, },
); );
@ -96,12 +101,7 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: _isLoading ? null : retrieveProfileInfo,
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
LocalsRepositoryImpl.license.add(false);
final response = await LocalsRepositoryImpl().update(context);
LocalsRepositoryImpl.license.add(response);
},
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),
child: CachedNetworkImage( child: CachedNetworkImage(
@ -157,7 +157,7 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
); );
} }
Container _buildAsyncLocalProfile(BuildContext context, LocalProfileState state, double limitedFontSize, Future Function() callback) { Container _buildAsyncLocalProfile(BuildContext context, LocalProfileState state, double limitedFontSize) {
return Container( return Container(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Align( child: Align(
@ -186,7 +186,7 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: callback, onTap: _isLoading ? null : retrieveProfileInfo,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),
child: CachedNetworkImage( child: CachedNetworkImage(