selectedImage method
Implementation
Widget selectedImage() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'IDENTITY VERIFICATION',
style: GoogleFonts.rajdhani(
color: appColors.primary,
fontSize: 20,
fontWeight: FontWeight.w700,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
Text(
'Kindly confirm if you\'d like to proceed with this photo.',
style: GoogleFonts.rajdhani(
color: appColors.wildSand800,
fontSize: 15,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
SizedBox(
width: 250,
height: 350,
child: ClipOval(
child: Image.file(
File(imagePath),
width: 250,
height: 300,
fit: BoxFit.cover,
),
),
),
if (loading) ...[
const SizedBox(height: 40),
LinearProgressIndicator(
value: loading ? progress : null,
minHeight: 10.0,
backgroundColor: appColors.accent,
valueColor: _animationController.drive(
ColorTween(
begin: appColors.primary.withOpacity(.5),
end: appColors.secondary.withOpacity(.7),
),
),
),
const SizedBox(height: 20),
Text(
"${percentage.toStringAsFixed(1)}%",
style: GoogleFonts.rajdhani(
color: appColors.wildSand700,
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
] else ...[
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: OutlinedButton(
onPressed: () async => setState(() {
selected = false;
loading = false;
isError = false;
isSuccess = false;
imagePath = "";
errorMessage = "";
successData = "";
}),
style: OutlinedButton.styleFrom(
side: BorderSide(
color: appColors.secondary.withOpacity(.7),
width: 2,
),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 15,
),
),
child: Text(
'TRY AGAIN',
style: GoogleFonts.exo2(
color: appColors.secondary.withOpacity(.7),
fontSize: 15,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
const SizedBox(width: 10),
Expanded(
child: ElevatedButton(
onPressed: () async {
final theFile = await fileToBase64Uri(File(imagePath));
await validatePassport(theFile);
},
style: ElevatedButton.styleFrom(
backgroundColor: appColors.secondary.withOpacity(.7),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 15,
),
),
child: Text(
'PROCEED',
style: GoogleFonts.exo2(
color: appColors.white,
fontSize: 15,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
],
);
}