forked from AdnanKhan45/flutter_story_editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee8a271
Showing
286 changed files
with
3,880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This is a generated file; do not edit or check into version control. | ||
ffmpeg_kit_flutter=/Users/amirkhan/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter-6.0.3/ | ||
file_picker=/Users/amirkhan/.pub-cache/hosted/pub.dev/file_picker-8.0.1/ | ||
flutter_keyboard_visibility=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/ | ||
flutter_keyboard_visibility_linux=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/ | ||
flutter_keyboard_visibility_macos=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/ | ||
flutter_keyboard_visibility_web=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/ | ||
flutter_keyboard_visibility_windows=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/ | ||
flutter_plugin_android_lifecycle=/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.19/ | ||
image_cropper=/Users/amirkhan/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/ | ||
image_cropper_for_web=/Users/amirkhan/.pub-cache/hosted/pub.dev/image_cropper_for_web-3.0.0/ | ||
path_provider=/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider-2.1.3/ | ||
path_provider_android=/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/ | ||
path_provider_foundation=/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/ | ||
path_provider_linux=/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ | ||
path_provider_windows=/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ | ||
video_player=/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player-2.8.6/ | ||
video_player_android=/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_android-2.4.14/ | ||
video_player_avfoundation=/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.5.7/ | ||
video_player_web=/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_web-2.3.0/ | ||
video_thumbnail=/Users/amirkhan/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"ffmpeg_kit_flutter","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter-6.0.3/","native_build":true,"dependencies":[]},{"name":"file_picker","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/file_picker-8.0.1/","native_build":true,"dependencies":[]},{"name":"flutter_keyboard_visibility","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.5.7/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/","native_build":true,"dependencies":[]}],"android":[{"name":"ffmpeg_kit_flutter","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter-6.0.3/","native_build":true,"dependencies":[]},{"name":"file_picker","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/file_picker-8.0.1/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_keyboard_visibility","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/","native_build":true,"dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.19/","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/image_cropper-5.0.1/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_android-2.4.14/","native_build":true,"dependencies":[]},{"name":"video_thumbnail","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/","native_build":true,"dependencies":[]}],"macos":[{"name":"ffmpeg_kit_flutter","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter-6.0.3/","native_build":true,"dependencies":[]},{"name":"flutter_keyboard_visibility_macos","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.5.7/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_keyboard_visibility_linux","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"flutter_keyboard_visibility_windows","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[{"name":"file_picker","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/file_picker-8.0.1/","dependencies":[]},{"name":"flutter_keyboard_visibility_web","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_cropper_for_web","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/image_cropper_for_web-3.0.0/","dependencies":[]},{"name":"video_player_web","path":"/Users/amirkhan/.pub-cache/hosted/pub.dev/video_player_web-2.3.0/","dependencies":[]}]},"dependencyGraph":[{"name":"ffmpeg_kit_flutter","dependencies":[]},{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_linux","flutter_keyboard_visibility_macos","flutter_keyboard_visibility_web","flutter_keyboard_visibility_windows"]},{"name":"flutter_keyboard_visibility_linux","dependencies":[]},{"name":"flutter_keyboard_visibility_macos","dependencies":[]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_keyboard_visibility_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_cropper","dependencies":["image_cropper_for_web"]},{"name":"image_cropper_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"video_thumbnail","dependencies":[]}],"date_created":"2024-04-18 14:45:16.049397","version":"3.19.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
migrate_working_dir/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
/pubspec.lock | ||
**/doc/api/ | ||
.dart_tool/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "bae5e49bc2a867403c43b2aae2de8f8c33b037e4" | ||
channel: "stable" | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* Initial release of *Flutter Story Editor* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Muhammad Adnan | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# flutter_story_editor [![Pub](https://img.shields.io/pub/v/flutter_story_editor.svg)](https://pub.dev/packages/flutter_story_editor) | ||
|
||
This package is created using style of the WhatsApp story image/video editor, with which you can edit images and videos both together. You can add texts, stickers, freehand finger drawing, apply filter, and undo. The edited images will be returned in a **onSave** call back as **List of Files**. You can then upload it to some storage or save it locally to your gallery. | ||
|
||
>> Video editing for now only support trimming. In future more video editing features will be added. | ||
## Features | ||
|
||
✅ You can edit Images, and videos both together. | ||
|
||
✅ Draggable fancy text with (custom colors, font families, and resize) | ||
|
||
✅ Draggable stickers & emojis | ||
|
||
✅ Apply filters to images | ||
|
||
✅ Freehand drawing over images | ||
|
||
✅ Trimming video frames | ||
|
||
## Future features | ||
|
||
🚀 Drawing painting over video frames (requires platform specific work) | ||
|
||
🚀 More image and video editing functionality like (WhatsApp & Instagram) stories | ||
|
||
🚀 The UI is currently like WhatsApp, but I think we should go with something unique for flutter (your contribution & ideas will be very invaluable) | ||
|
||
🚀 improve and enhance performance and existing features. | ||
|
||
## Package Demo | ||
|
||
<p float="left"> | ||
|
||
<img src="https://media.giphy.com/media/JubXlSh0KAlZjKnqRW/giphy.gif" width=200 /> | ||
<img src="https://res.cloudinary.com/dor7mejda/image/upload/v1713443118/Screen_Recording_2024-04-18_at_5.09.25_PM_kdfpza.gif" width=200> | ||
<img src="https://res.cloudinary.com/dor7mejda/image/upload/v1713443118/Screen_Recording_2024-04-18_at_5.06.32_PM_vdirgz.gif" width=200> | ||
|
||
</p> | ||
|
||
## Installation | ||
|
||
Add flutter_story_editor: latest_version to your **pubspec.yaml** and then import it. | ||
|
||
```dartimport 'package:stories_editor/stories_editor.dart';``` | ||
|
||
### Android | ||
add the following code to your `AndroidMAnifest.xml` file | ||
```xml | ||
<activity | ||
android:name="com.yalantis.ucrop.UCropActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/> | ||
``` | ||
### iOS | ||
add the following code to your `info.plist` file | ||
|
||
```xml | ||
<key>NSCameraUsageDescription</key> | ||
<string>Used to demonstrate image picker plugin</string> | ||
<key>NSMicrophoneUsageDescription</key> | ||
<string>Used to capture audio for image picker plugin</string> | ||
<key>NSPhotoLibraryUsageDescription</key> | ||
<string>Used to demonstrate image picker plugin</string> | ||
``` | ||
## How to use | ||
```dart | ||
// Inialize controllers within the state | ||
FlutterStoryEditorController controller = FlutterStoryEditorController(); | ||
final TextEditingController _captionController = TextEditingController(); | ||
// TODO: create a method to pick files (videos and images) either separate or together. | ||
// Select files | ||
selectMedia().then((value) { | ||
if (_selectedMedia != null && _selectedMedia!.isNotEmpty) { | ||
showModalBottomSheet( | ||
isScrollControlled: true, | ||
isDismissible: false, | ||
enableDrag: false, | ||
context: context, | ||
builder: (context) { | ||
return FlutterStoryEditor( | ||
controller: controller, | ||
captionController: _captionController, | ||
selectedFiles: _selectedMedia, | ||
onSaveClickListener: (files) { | ||
// Here you go with your edited files. | ||
} | ||
); | ||
}, | ||
); | ||
} | ||
}, | ||
); | ||
}, icon: const Icon(Icons.upload, size: 50,)), | ||
), | ||
``` | ||
|
||
For more information : visit example project inside `example/example.dart`. | ||
|
||
## Screenshots | ||
|
||
Initial view & Multiple images selected | ||
|
||
<p float="left"> | ||
|
||
<img src="https://i.imgur.com/plIVQiJ.jpg" width=200 /> | ||
<img src="https://i.imgur.com/Aw91PkQ.png" width=200 /> | ||
|
||
</p> | ||
|
||
Images & videos together & Apply filters | ||
|
||
<p float="left"> | ||
|
||
<img src="https://i.imgur.com/XDCMooh.jpg" width=200 /> | ||
<img src="https://i.imgur.com/S6PlaCM.png" width=200 /> | ||
|
||
</p> | ||
|
||
Crop, scale and rotate & Add draggable stickers | ||
|
||
<p float="left"> | ||
|
||
<img src="https://i.imgur.com/w7akoHi.jpg" width=200 /> | ||
<img src="https://i.imgur.com/X3K4pFK.png" width=200 /> | ||
|
||
</p> | ||
|
||
Add emojis & Add draggable fancy text | ||
|
||
<p float="left"> | ||
|
||
<img src="https://i.imgur.com/Hkm9VOF.jpg" width=200 /> | ||
<img src="https://i.imgur.com/iByPB5R.png" width=200 /> | ||
<img src="https://i.imgur.com/jMDUWek.png" width=200 /> | ||
|
||
</p> | ||
|
||
Draw freehand painting over images | ||
|
||
<p float="left"> | ||
|
||
<img src="https://i.imgur.com/Nm3jgOa.jpg" width=200 /> | ||
<img src="https://i.imgur.com/5qsogMC.png" width=200 /> | ||
|
||
</p> | ||
|
||
|
||
## Must read | ||
|
||
The initial release of `flutter_story_editor` may have small bugs, and issues. If you found some, and you're willing to contribute feel free to create issue and rasie a PR. Make sure you inform me through my [LinkedIn DM](https://www.linkedin.com/in/muhammad-adnan-23bb8821b/) for the issues you create in both cases either or not if you want to contribute. | ||
|
||
This package will be improved more along the time, your contribution will be very invaluable. | ||
|
||
|
||
## Created & Maintained By | ||
|
||
[@MuhammadAdnan](https://github.com/AdnanKhan45), LinkedIn : [@MuhammadAdnan](https://www.linkedin.com/in/muhammad-adnan-23bb8821b/) , Instagram : [@MuhammadAdnan](https://www.instagram.com/dev.adnankhan/). | ||
|
||
YouTube : [@eTechViral](https://www.youtube.com/c/eTechViral) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:file_picker/file_picker.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_story_editor/flutter_story_editor.dart'; | ||
import 'package:flutter_story_editor/src/controller/controller.dart'; | ||
|
||
import 'package:path/path.dart' as path; | ||
|
||
class FlutterStoryEditorExample extends StatefulWidget { | ||
// final User? user; | ||
const FlutterStoryEditorExample({super.key}); | ||
|
||
@override | ||
State<FlutterStoryEditorExample> createState() => _FlutterStoryEditorExampleState(); | ||
} | ||
|
||
class _FlutterStoryEditorExampleState extends State<FlutterStoryEditorExample> with SingleTickerProviderStateMixin { | ||
|
||
FlutterStoryEditorController controller = FlutterStoryEditorController(); | ||
|
||
final TextEditingController _captionController = TextEditingController(); | ||
|
||
|
||
|
||
List<File>? _selectedMedia; | ||
|
||
List<String>? _mediaTypes; // To store the type of each selected file | ||
|
||
Future<void> selectMedia() async { | ||
setState(() { | ||
_selectedMedia = null; | ||
_mediaTypes = null; | ||
}); | ||
|
||
try { | ||
final result = await FilePicker.platform.pickFiles( | ||
type: FileType.media, | ||
allowMultiple: true, | ||
); | ||
if (result != null) { | ||
_selectedMedia = result.files.map((file) => File(file.path!)).toList(); | ||
|
||
// Initialize the media types list | ||
_mediaTypes = List<String>.filled(_selectedMedia!.length, ''); | ||
|
||
// Determine the type of each selected file | ||
for (int i = 0; i < _selectedMedia!.length; i++) { | ||
String extension = path.extension(_selectedMedia![i].path) | ||
.toLowerCase(); | ||
if (extension == '.jpg' || extension == '.jpeg' || | ||
extension == '.png') { | ||
_mediaTypes![i] = 'image'; | ||
} else if (extension == '.mp4' || extension == '.mov' || | ||
extension == '.avi') { | ||
_mediaTypes![i] = 'video'; | ||
} | ||
} | ||
|
||
setState(() {}); | ||
} else { | ||
print("No file is selected."); | ||
} | ||
} catch (e) { | ||
print("Error while picking file: $e"); | ||
} | ||
} | ||
|
||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
|
||
Center( | ||
child: IconButton(onPressed: () { | ||
|
||
|
||
selectMedia().then( | ||
(value) { | ||
|
||
if (_selectedMedia != null && _selectedMedia!.isNotEmpty) { | ||
showModalBottomSheet( | ||
isScrollControlled: true, | ||
isDismissible: false, | ||
enableDrag: false, | ||
context: context, | ||
builder: (context) { | ||
|
||
return FlutterStoryEditor( | ||
controller: controller, | ||
captionController: _captionController, | ||
selectedFiles: _selectedMedia, | ||
onSaveClickListener: (files) { | ||
// Navigator.push( | ||
// context, | ||
// MaterialPageRoute( | ||
// builder: (context) => ImagesPage(files: files), | ||
// ), | ||
// ); | ||
} | ||
); | ||
}, | ||
); | ||
} | ||
|
||
}, | ||
); | ||
}, icon: const Icon(Icons.upload, size: 50,)), | ||
), | ||
|
||
|
||
const SizedBox(height: 10), | ||
const Text("Pick Files & Play with them") | ||
|
||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.