mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 12:58:56 +03:30
'3.1.1'
This commit is contained in:
@@ -105,7 +105,7 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await loadAssets(context);
|
||||
await loadAssetsFromFilePicker(context);
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width - 40,
|
||||
@@ -570,34 +570,33 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
profileProviderObject.setImages();
|
||||
}
|
||||
|
||||
Future<void> loadAssets(BuildContext context) async {
|
||||
var profileProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<PlatformFile> files = profileProviderObject.catchImages;
|
||||
try {
|
||||
var datas = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
|
||||
withData: true,
|
||||
withReadStream: true,
|
||||
);
|
||||
files += datas!.files;
|
||||
// files +=
|
||||
|
||||
// print(files);
|
||||
} catch (_) {}
|
||||
|
||||
profileProviderObject.setCatchImages(files);
|
||||
profileProviderObject.setImages();
|
||||
// profileProviderObject.addImage();
|
||||
Future<void> loadAssetsFromFilePicker(BuildContext context) async {
|
||||
var providerObject = Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<PlatformFile> files = providerObject.catchImages;
|
||||
var image = await ImagePicker.platform.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
imageQuality: 25,
|
||||
);
|
||||
if (image != null) {
|
||||
files.add(
|
||||
PlatformFile(
|
||||
path: image.path,
|
||||
name: "item_image",
|
||||
bytes: File(image.path).readAsBytesSync(),
|
||||
size: File(image.path).lengthSync(),
|
||||
),
|
||||
);
|
||||
providerObject.setCatchImages(files);
|
||||
providerObject.setImages();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadAssetsFromCamera(BuildContext context) async {
|
||||
var providerObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
var providerObject = Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<PlatformFile> _catchImages = providerObject.catchImages;
|
||||
var image = await ImagePicker.platform.pickImage(
|
||||
source: ImageSource.camera,
|
||||
imageQuality: 25,
|
||||
);
|
||||
if (image != null) {
|
||||
_catchImages.add(
|
||||
|
||||
Reference in New Issue
Block a user