Skip to content

Commit 0e93d61

Browse files
authored
fix(ui_auth): adaptive AlertDialog for Flutter <3.13 (#152)
1 parent 537d2b3 commit 0e93d61

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

packages/firebase_ui_shared/lib/src/universal_alert.dart

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
import 'package:flutter/cupertino.dart';
66
import 'package:flutter/material.dart';
7+
import 'package:firebase_ui_shared/firebase_ui_shared.dart';
78

8-
class UniversalAlert extends StatelessWidget {
9+
class UniversalAlert extends PlatformWidget {
910
final void Function() onConfirm;
1011
final void Function() onCancel;
1112

@@ -49,8 +50,29 @@ class UniversalAlert extends StatelessWidget {
4950
}
5051

5152
@override
52-
Widget build(BuildContext context) {
53-
return AlertDialog.adaptive(
53+
Widget buildMaterial(BuildContext context) {
54+
return AlertDialog(
55+
title: Text(title),
56+
content: Text(message),
57+
actions: [
58+
adaptiveAction(
59+
context: context,
60+
onPressed: onConfirm,
61+
child: Text(confirmButtonText),
62+
isDestructiveAction: true,
63+
),
64+
adaptiveAction(
65+
context: context,
66+
onPressed: onCancel,
67+
child: Text(cancelButtonText),
68+
),
69+
],
70+
);
71+
}
72+
73+
@override
74+
Widget buildCupertino(BuildContext context) {
75+
return CupertinoAlertDialog(
5476
title: Text(title),
5577
content: Text(message),
5678
actions: [

0 commit comments

Comments
 (0)