buildDialogOption method

Widget buildDialogOption(
  1. int index,
  2. {bool isForStorage = true,
  3. bool isForRemovePhoto = false}
)

Implementation

Widget buildDialogOption(int index,
    {bool isForStorage = true, bool isForRemovePhoto = false}) {
  return FlatButton(
      onPressed: () {
        dismissDialog();
        isForRemovePhoto
            ? imageListBloc.dispatchRemovePhotoEvent(index)
            : imageListBloc.dispatchCheckPermissionEvent(
            permissionType: isForStorage
                ? PermissionType.Storage
                : PermissionType.Camera,
            index: index,
            isFromPicker: true);
      },
      child: Padding(
        padding: const EdgeInsets.all(10),
        child: Row(
          mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.only(right: 16),
              child: Icon(
                isForRemovePhoto
                    ? Icons.clear
                    : isForStorage ? Icons.photo_album : Icons.add_a_photo,
                color: isForRemovePhoto
                    ? Colors.red
                    : isForStorage ? Colors.amber : Colors.blue,
              ),
            ),
            Text(isForRemovePhoto
                ? "Remove"
                : isForStorage ? "Gallery" : "Camera")
          ],
        ),
      ));
}