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> {
bool _isLoading = false;
Future retrieveProfileInfo() async {
setState(() {_isLoading = true;});
Future callback() async {
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
LocalsRepositoryImpl.license.add(false);
final response = await LocalsRepositoryImpl().update(context);
LocalsRepositoryImpl.license.add(response);
setState(() {_isLoading = false;});
}
@override
@ -58,7 +63,7 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
return BlocBuilder<LocalProfileBloc, LocalProfileState>(
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,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '');
LocalsRepositoryImpl.license.add(false);
final response = await LocalsRepositoryImpl().update(context);
LocalsRepositoryImpl.license.add(response);
},
onTap: _isLoading ? null : retrieveProfileInfo,
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: CachedNetworkImage(
@ -157,96 +157,96 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
);
}
Container _buildAsyncLocalProfile(BuildContext context, LocalProfileState state, double limitedFontSize, Future Function() callback) {
return Container(
decoration: const BoxDecoration(),
child: Align(
alignment: const AlignmentDirectional(0.0, -1.0),
child: Material(
color: Colors.transparent,
elevation: 0.0,
child: Container(
width: double.infinity,
height: 119.0,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primary,
border: Border.all(
Container _buildAsyncLocalProfile(BuildContext context, LocalProfileState state, double limitedFontSize) {
return Container(
decoration: const BoxDecoration(),
child: Align(
alignment: const AlignmentDirectional(0.0, -1.0),
child: Material(
color: Colors.transparent,
elevation: 0.0,
child: Container(
width: double.infinity,
height: 119.0,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primary,
border: Border.all(
color: FlutterFlowTheme.of(context).primary,
),
),
),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: const AlignmentDirectional(-1.0, 0.0),
child: Padding(
padding: const EdgeInsets.all(2.0),
child: InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: callback,
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: CachedNetworkImage(
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: const AlignmentDirectional(-1.0, 0.0),
child: Padding(
padding: const EdgeInsets.all(2.0),
child: InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: _isLoading ? null : retrieveProfileInfo,
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: CachedNetworkImage(
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
imageUrl: valueOrDefault('https://freaccess.com.br/freaccess/Images/Clients/${state.cliUUID}.png', 'assets/images/home.png'),
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0),
placeholder: (context, url) => Image.asset('assets/images/home.png'),
errorListener: (_) => Image.asset('assets/images/home.png'),
errorWidget: (_, __, ___) => Image.asset('assets/images/home.png'),
),
imageUrl: valueOrDefault('https://freaccess.com.br/freaccess/Images/Clients/${state.cliUUID}.png', 'assets/images/home.png'),
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0),
placeholder: (context, url) => Image.asset('assets/images/home.png'),
errorListener: (_) => Image.asset('assets/images/home.png'),
errorWidget: (_, __, ___) => Image.asset('assets/images/home.png'),
),
)),
),
),
Expanded(
child: Tooltip(
message: valueOrDefault<String>(
convertToUppercase(state.cliName),
FFLocalizations.of(context).getVariableText(
ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
),
)),
),
child: Text(
valueOrDefault<String>(
),
Expanded(
child: Tooltip(
message: valueOrDefault<String>(
convertToUppercase(state.cliName),
FFLocalizations.of(context).getVariableText(
ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
),
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: limitedFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
child: Text(
valueOrDefault<String>(
convertToUppercase(state.cliName),
FFLocalizations.of(context).getVariableText(
ptText: 'SEM LOCAL VINCULADO',
enText: 'NO LINKED LOCAL',
),
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: limitedFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
),
),
),
),
),
].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 20.0)).addToEnd(const SizedBox(width: 20.0)),
].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 20.0)).addToEnd(const SizedBox(width: 20.0)),
),
),
),
),
),
);
}
);
}
}