wrongCodeId function
- ButtonsProvider bp,
- BuildContext context
This function is called when the validated reference code is not valid.
It sets the value of the control variables ButtonsProvider.wrongCodeId, ButtonsProvider.isCodeValidated and ButtonsProvider.isReadOnly and displays an error message. The user must click OK on the screen to close the error message.
The arguments are bp,which is the ButtonsProvider that hosts the control variables
and the context.
Implementation
void wrongCodeId(ButtonsProvider bp, BuildContext context){
bp.setIsCodeValidated(false);
bp.setWrongCodeid(true);
bp.setIsReadOnly(false);
showDialog(
context: context,
builder: (context) =>
AlertDialog(
title: Text(
AppLocalizations.of(context)!.error_title,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.red),
),
content: Text(
AppLocalizations.of(context)!.error_text,
style: const TextStyle(
fontSize: 20,
color: AppColors.blueText
),
),
actions: [
TextButton(
onPressed: () =>
Navigator.of(context).pop(),
child: const Text('OK',
style: TextStyle(
fontSize: 20)
),
),
],
),
);
}