showPhotoSelector function

Future<String?> showPhotoSelector(
  1. BuildContext context
)

Implementation

Future<String?> showPhotoSelector(BuildContext context) async {
  var style = const TextStyle(fontSize: 16, color: CommonColors.color_333333);
  var select = await showBottomChoose<int>(
      context: context,
      actions: [
        CupertinoActionSheetAction(
          onPressed: () {
            Navigator.pop(context, 1);
          },
          child: Text(
            S.of(context).takePhoto,
            style: style,
          ),
        ),
        CupertinoActionSheetAction(
          onPressed: () {
            Navigator.pop(context, 2);
          },
          child: Text(
            S.of(context).choosePhoto,
            style: style,
          ),
        ),
      ],
      showCancel: true);
  if (select == 1) {
    return pickPhoto(true);
  } else if (select == 2) {
    return pickPhoto(false);
  }
  return null;
}