TchatchoKemajou / custom_story_editor

MIT License
0 stars 0 forks source link

I/ffmpeg-kit-flutter(25542): FFmpegKitFlutterPlugin ignored unsupported activity result for requestCode: 2342. #2

Open jtaxiexpress opened 3 months ago

jtaxiexpress commented 3 months ago

Issue

If Tap center icon , come this error to me .

スクリーンショット 2024-08-08 23 21 09

Error

FFmpegKitFlutterPlugin ignored unsupported activity result for requestCode: 2342.

Code

import 'package:custom_story_editor/custom_story_editor.dart';
import 'package:custom_story_editor/src/controller/controller.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final imagePicker = ImagePicker();

  CustomStoryEditorController controller = CustomStoryEditorController();
  final TextEditingController _captionController = TextEditingController();
  XFile? _image;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home Page'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            getImageFromGarally().then(
              (value) {
                if (value != null && value!.isNotEmpty) {
                  showModalBottomSheet(
                    isScrollControlled: true,
                    isDismissible: false,
                    enableDrag: false,
                    context: context,
                    builder: (context) {
                      return CustomStoryEditor(
                          controller: controller,
                          captionController: _captionController,
                          selectedFiles: value,
                          onSaveClickListener: (files) {
                            // Here you go with your edited files.
                          });
                    },
                  );
                }
              },
            );
          },
          child: const Icon(Icons.image),
        ),
      ),
    );
  }

  Future getImageFromGarally() async {
    final pickedFile = await imagePicker.pickImage(source: ImageSource.gallery);
    setState(() {
      if (pickedFile != null) {
        _image = XFile(pickedFile.path);
      }
    });
  }
}
TchatchoKemajou commented 3 months ago

your code is not correct

TchatchoKemajou commented 3 months ago

make sure you check the values ​​of each property and much more there are a lot of errors in your code

for example the selectedFiles property is of type List?, but you sent a Future;

you will need to convert the Xfile to File

...

jtaxiexpress commented 3 months ago

Thanks ,

What package should we use to pick up our image files from the gallery app? I would like to see your sample code.