dialog.dart
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import 'package:flutter/material.dart';
import 'package:get/src/routes.dart';
class DialogGet extends StatelessWidget {
final Widget child;
final color;
final double opacity;
const DialogGet({Key key, this.child, this.color, this.opacity = 0.5})
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Get.back(),
child: Container(
color: (color == null)
? Theme.of(context).accentColor.withOpacity(opacity)
: color,
child: GestureDetector(onTap: () => null, child: child),
),
);
}
}
class DefaultDialogGet extends StatelessWidget {
final color;
final double opacity;
final String title;
final Widget content;
final Widget cancel;
final Widget confirm;
const DefaultDialogGet(
{Key key,
this.color,
this.opacity = 0.5,
this.title,
this.content,
this.cancel,
this.confirm})
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Get.back(),
child: Container(
color: (color == null)
? Theme.of(context).accentColor.withOpacity(opacity)
: color,
child: GestureDetector(
onTap: () => null,
child: AlertDialog(
title: Text(title, textAlign: TextAlign.center),
content: content,
actions: <Widget>[cancel, confirm],
),
),
),
);
}
}