areYouSureUpdateNotSaved static method

Future<bool> areYouSureUpdateNotSaved(
  1. BuildContext context
)

Implementation

static Future<bool> areYouSureUpdateNotSaved(BuildContext context) async {
  return await showDialog(
        context: context,
        builder: (BuildContext context) {
          return AlertDialog(
            title: const Text('Modifications non sauvegardées'),
            content: const Text(
                'Êtes-vous sûr de quitter la page sans enregister ?'),
            actions: <Widget>[
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  TextButton(
                    child: const Text(
                      'Non je n\'ai pas fini !',
                      overflow: TextOverflow.ellipsis,
                    ),
                    onPressed: () {
                      Navigator.of(context).pop(false);
                    },
                  ),
                  TextButton(
                    child: const Text('Oui', overflow: TextOverflow.ellipsis),
                    style: ButtonStyle(
                      foregroundColor:
                          MaterialStateProperty.all<Color>(Colors.blue),
                    ),
                    onPressed: () {
                      Navigator.of(context).pop(true);
                    },
                  ),
                ],
              ),
            ],
          );
        },
      ) ??
      false;
}