2020-05-02 13:30:19 +00:00
|
|
|
import 'package:comunic/utils/intl_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
/// Confirm dialog button
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
|
|
|
class ConfirmDialogButton<T> extends StatelessWidget {
|
|
|
|
final bool enabled;
|
|
|
|
final T value;
|
|
|
|
|
|
|
|
const ConfirmDialogButton({
|
2022-03-10 18:39:57 +00:00
|
|
|
Key? key,
|
2020-05-02 13:30:19 +00:00
|
|
|
this.enabled = true,
|
2022-03-10 18:39:57 +00:00
|
|
|
required this.value,
|
2020-05-02 13:30:19 +00:00
|
|
|
}) : assert(enabled != null),
|
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialButton(
|
|
|
|
onPressed: enabled ? () => Navigator.of(context).pop(value) : null,
|
2022-03-10 18:39:57 +00:00
|
|
|
child: Text(tr("Confirm")!.toUpperCase()),
|
2020-05-02 13:30:19 +00:00
|
|
|
textColor: Colors.green,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|