mirror of
https://github.com/Iconica-Development/flutter_image_picker.git
synced 2025-05-18 19:53:45 +02:00
added same image check
This commit is contained in:
parent
7650150cc6
commit
e9f0aaf4c2
1 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_image_picker/image_picker.dart';
|
import 'package:flutter_image_picker/image_picker.dart';
|
||||||
|
|
||||||
|
@ -72,10 +73,15 @@ class _ImagePickerExampleHomePageState
|
||||||
|
|
||||||
void pickImage() async {
|
void pickImage() async {
|
||||||
Uint8List? imageInBytes = await imagePicker.showPickImageDialog(context);
|
Uint8List? imageInBytes = await imagePicker.showPickImageDialog(context);
|
||||||
if (imageInBytes != null) {
|
if (imageInBytes != null && !listEquals(image, imageInBytes)) {
|
||||||
setState(() {
|
setState(() {
|
||||||
image = imageInBytes;
|
image = imageInBytes;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Selected image is already being displayed!')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue