cupertinoButtonFunction function
Widget
cupertinoButtonFunction(
- BuildContext context,
- Widget widget,
- VoidCallback? callback,
- int? enablePop,
- int widgetType,
Implementation
Widget cupertinoButtonFunction(
BuildContext context,
Widget widget,
VoidCallback? callback,
int? enablePop,
int widgetType,
) {
return CupertinoButton(
onPressed: (() {
//0:cancel widget,1:ensure widget
if (widgetType == 1) {
if (enablePop == 1) {
return () async {
Navigator.of(context).pop();
if (callback != null) {
callback();
}
};
} else {
if (callback != null) {
return () async {
callback();
};
}
}
} else {
return () async {
Navigator.of(context).pop();
if (callback != null) {
callback();
}
};
}
})(),
child: widget,
);
}