fix localprofile button
This commit is contained in:
parent
b8c2aab73c
commit
6e100c84ce
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue