Improve _handleCameraButtonTap()

pull/1428/head
Ahmed Hnewa 2 years ago
parent 23b3fd05ba
commit c8941e9963
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 13
      flutter_quill_extensions/lib/embeds/toolbar/camera_button.dart
  2. 3
      flutter_quill_extensions/lib/embeds/utils.dart

@ -85,15 +85,6 @@ class CameraButton extends StatelessWidget {
'onImagePickCallback and onVideoPickCallback are both null',
);
}
var shouldShowPickPhotoByCamera = false;
var shouldShowRecordVideoByCamera = false;
if (onImagePickCallback != null) {
shouldShowPickPhotoByCamera = true;
}
if (onVideoPickCallback != null) {
shouldShowRecordVideoByCamera = true;
}
final selector = cameraPickSettingSelector ??
(context) => showDialog<MediaPickSetting>(
context: context,
@ -103,7 +94,7 @@ class CameraButton extends StatelessWidget {
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (shouldShowPickPhotoByCamera)
if (onImagePickCallback != null)
TextButton.icon(
icon: const Icon(
Icons.camera,
@ -113,7 +104,7 @@ class CameraButton extends StatelessWidget {
onPressed: () =>
Navigator.pop(ctx, MediaPickSetting.Camera),
),
if (shouldShowRecordVideoByCamera)
if (onVideoPickCallback != null)
TextButton.icon(
icon: const Icon(
Icons.video_call,

@ -1,6 +1,6 @@
import 'dart:io' show File;
import 'package:flutter/foundation.dart' show Uint8List;
import 'package:flutter/foundation.dart' show Uint8List, immutable;
import 'package:gal/gal.dart';
import 'package:http/http.dart' as http;
@ -41,6 +41,7 @@ bool isImageBase64(String imageUrl) {
enum SaveImageResultMethod { network, localStorage }
@immutable
class _SaveImageResult {
const _SaveImageResult({required this.isSuccess, required this.method});

Loading…
Cancel
Save