45 lines
1.4 KiB
Dart
45 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
Future showGenericDialog(dynamic object, BuildContext parentContext) {
|
|
return showGeneralDialog(
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
transitionDuration: const Duration(milliseconds: 220),
|
|
transitionBuilder: (BuildContext context, Animation<double> animation,
|
|
Animation<double> secondaryAnimation, Widget child) {
|
|
Animation<Offset> custom = Tween<Offset>(
|
|
begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0))
|
|
.animate(animation);
|
|
return SlideTransition(
|
|
position: custom, child: Dialog.fullscreen(child: object));
|
|
},
|
|
barrierDismissible: true,
|
|
barrierLabel: '',
|
|
context: parentContext,
|
|
pageBuilder: (context, animation1, animation2) {
|
|
return Container();
|
|
});
|
|
}
|
|
|
|
Future showRemovalDialog(String title, String content, BuildContext context,
|
|
dynamic dao, dynamic object) {
|
|
return showAdaptiveDialog(
|
|
context: context,
|
|
builder: (BuildContext context) => AlertDialog(
|
|
title: Text(title),
|
|
content: Text(content),
|
|
actions: <Widget>[
|
|
TextButton(
|
|
onPressed: () => {
|
|
Navigator.pop(context, 'Cancel'),
|
|
},
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => {dao.remove(object), Navigator.pop(context, 'OK')},
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|