Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/src/firebase_options_selector_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:activout_firebase_options_selector/src/firebase_options_selector.dart';
import 'package:flutter/material.dart';

Expand All @@ -6,6 +8,7 @@ Future<void> showFirebaseOptionsSelectorDialog(
BuildContext context, String titleText,
{String okText = 'OK'}) async {
var selected = await FirebaseOptionsSelector.getCurrentSelection();
var hasChanged = false;

return showDialog<void>(
context: context,
Expand All @@ -23,6 +26,7 @@ Future<void> showFirebaseOptionsSelectorDialog(
groupValue: selected,
onChanged: (String? newValue) async {
if (newValue != null) {
hasChanged = true;
await FirebaseOptionsSelector.select(newValue);
setState(() => selected = newValue);
}
Expand All @@ -36,7 +40,11 @@ Future<void> showFirebaseOptionsSelectorDialog(
TextButton(
child: Text(okText),
onPressed: () {
Navigator.of(context).pop();
if (!hasChanged) {
Navigator.of(context).pop();
} else {
exit(0);
}
Comment on lines +43 to +47
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!hasChanged) {
Navigator.of(context).pop();
} else {
exit(0);
}
if (hasChanged) {
exit(0);
} else {
Navigator.of(context).pop();
}

},
),
],
Expand Down