2024-09-26 04:30:51 -04:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
class OkButton<T> extends StatelessWidget {
|
|
|
|
|
const OkButton({
|
|
|
|
|
super.key,
|
|
|
|
|
this.onPressed,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
final void Function()? onPressed;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return TextButton(
|
|
|
|
|
onPressed: onPressed,
|
|
|
|
|
child: const Text('OK'),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CancelButton extends StatelessWidget {
|
|
|
|
|
const CancelButton({
|
|
|
|
|
super.key,
|
2024-10-05 10:01:08 -04:00
|
|
|
this.onPressed,
|
2024-09-26 04:30:51 -04:00
|
|
|
});
|
|
|
|
|
|
2024-10-05 10:01:08 -04:00
|
|
|
final void Function()? onPressed;
|
|
|
|
|
|
2024-09-26 04:30:51 -04:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return TextButton(
|
|
|
|
|
onPressed: () {
|
2024-10-05 10:01:08 -04:00
|
|
|
onPressed?.call();
|
2024-09-26 04:30:51 -04:00
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Cancel'),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|