showBackupDialog method
Implementation
showBackupDialog(BuildContext context) {
SizeConfig().init(context);
GlobalKey key = GlobalKey();
BuildContext? myContext;
showDialog(
context: context,
builder: (BuildContext ctxt) {
return ShowCaseWidget(builder: (context) {
myContext = context;
return Dialog(
child: Container(
padding: const EdgeInsets.all(20),
width: (Platform.isMacOS || Platform.isWindows || Platform.isLinux) ? 600 : null,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Expanded(
child: Center(
child: Showcase(
key: key,
description:
'Each atSign has a unique key used to verify ownership and encrypt your data. You will get this key when you first activate your atSign, and you will need it to pair your atSign with other devices and all atPlatform apps.'
'\n\n'
'PLEASE SECURELY SAVE YOUR KEYS. WE DO NOT HAVE ACCESS TO THEM AND CANNOT CREATE A BACKUP OR RESET THEM.',
targetShapeBorder: const CircleBorder(),
disableMovingAnimation: true,
targetBorderRadius: const BorderRadius.all(Radius.circular(40)),
showArrow: false,
targetPadding: const EdgeInsets.all(5),
blurValue: 2,
child: Text(
Strings.backUpKeysTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.toFont,
),
textAlign: TextAlign.center,
),
),
),
),
GestureDetector(
onTap: () {
ShowCaseWidget.of(myContext!).startShowCase([key]);
},
child: Container(
decoration:
BoxDecoration(color: Colors.grey.shade400, borderRadius: BorderRadius.circular(50)),
margin: const EdgeInsets.all(0),
height: 20,
width: 20,
child: const Icon(
Icons.question_mark,
size: 15,
),
),
),
],
),
const SizedBox(
height: 20,
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
Strings.backUpKeysDescription,
textAlign: TextAlign.center,
),
SizedBox(height: 20.toHeight),
Row(
children: [
TextButton(
child:
const Text(Strings.backButtonTitle, style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () async {
var result = await onBackup(context);
if (context.mounted) {
Navigator.pop(ctxt);
}
if (result == false && context.mounted) {
_showAlertDialog(context);
}
}),
const Spacer(),
TextButton(
child: const Text(Strings.cancelButtonTitle, style: TextStyle()),
onPressed: () {
Navigator.pop(context);
})
],
)
],
),
],
),
),
);
});
});
}