showDisconnectPrompt method

void showDisconnectPrompt(
  1. {required BuildContext context,
  2. required WidgetRef ref,
  3. required AppModel appModel}
)

Shows when the close button is pressed.

Implementation

void showDisconnectPrompt(
    {required BuildContext context,
    required WidgetRef ref,
    required AppModel appModel}) async {
  Widget alertDialog = AlertDialog(
    title: Text(t.close_connection_title),
    content: Text(
      t.close_connection_description,
    ),
    actions: <Widget>[
      TextButton(
        child: Text(
          t.dialog_close,
          style: TextStyle(
            color: Theme.of(context).colorScheme.primary,
          ),
        ),
        onPressed: () async {
          clearServerAddress();
          mediaType.refreshTab();

          Navigator.pop(context);
        },
      ),
      TextButton(
        child: Text(t.dialog_cancel),
        onPressed: () => Navigator.pop(context),
      ),
    ],
  );

  await showDialog(
    context: context,
    builder: (context) => alertDialog,
  );
}