Skip to content

Commit

Permalink
Github pages demo project added and maxImages 1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham16g committed Jan 18, 2023
1 parent 4e4a897 commit 829ccc1
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 16 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Note:
# Make sure that the github pages is already set to Github Actions, otherwise the workflow will fail.
#
# Author: Shubham Gupta
# - GitHub: https://github.com/shubham-gupta-16/

name: CI
on:
push:
branches:
- master
# pull_request:
# branches:
# - master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
flutter_web_deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./example
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter build web --base-href /${{ github.event.repository.name }}/
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: example/build/web
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@main
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.12
- Github pages demo project added
- maxImages 1 support

## 0.0.11
- Fixed remove image from laptop touchpad
- Improved web support
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Multi Image Picker View Flutter

[![](https://img.shields.io/pub/v/multi_image_picker_view.svg?color=success&label=pub.dev&logo=dart&logoColor=0099ff)](https://pub.dev/packages/multi_image_picker_view)
[![](https://img.shields.io/pub/v/multi_image_picker_view.svg?color=blue&label=pub.dev&logo=dart&logoColor=0099ff)](https://pub.dev/packages/multi_image_picker_view)
[![](https://img.shields.io/github/issues/shubham-gupta-16/multi_image_picker_view?color=red&label=Issues)](https://github.com/shubham-gupta-16/multi_image_picker_view/issues)
[![](https://img.shields.io/github/license/shubham-gupta-16/multi_image_picker_view?label=License)]()

A complete widget which can easily pick multiple images from device and display them in UI. Also picked image can be re-ordered and removed easily.

**🚀 LIVE DEMO OF EXAMPLE PROJECT:** https://shubham-gupta-16.github.io/multi_image_picker_view/

![preview](https://user-images.githubusercontent.com/55009858/178099543-d3b576d9-625c-426e-b627-9e48c2f65c17.gif)

## Features
Expand Down Expand Up @@ -94,8 +98,13 @@ controller.reOrderImage(oldIndex, newIndex); // reorder the image

![custom](https://user-images.githubusercontent.com/55009858/178099563-72e26aea-0a06-43c2-8315-25c7a0d039fb.gif)

## Contributors
## My other flutter packages
- <a href="https://pub.dev/packages/view_model_x">view_model_x</a> - An Android similar state management package (StateFlow and SharedFlow with ViewModel) which helps to implement MVVM pattern easily.

## Support
<p><a href="https://www.buymeacoffee.com/shubhamgupta16"> <img align="center" src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="50" width="210" alt="shubhamgupta16" /></a></p>

## Contributors
<a href="https://github.com/shubham-gupta-16/multi_image_picker_view/graphs/contributors">
<img src="https://contrib.rocks/image?repo=shubham-gupta-16/multi_image_picker_view" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _DemoPageState extends State<DemoPage> {
onPressed: () {
final images = controller.images;
// use these images
print(images);
debugPrint(images.toString());
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.11"
version: "0.0.12"
path:
dependency: transitive
description:
Expand Down
24 changes: 13 additions & 11 deletions lib/src/multi_image_picker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ class _MultiImagePickerViewState extends State<MultiImagePickerView> {
);

return MouseRegion(
onEnter: isMouse ? null : (e){
setState(() {
isMouse = true;
});
},
onEnter: isMouse
? null
: (e) {
setState(() {
isMouse = true;
});
},
child: Padding(
padding: widget.padding ?? EdgeInsets.zero,
child: ReorderableBuilder(
Expand Down Expand Up @@ -170,7 +172,6 @@ class _MultiImagePickerViewState extends State<MultiImagePickerView> {
),
lockedIndices: [widget.controller.images.length],
onReorder: (List<OrderUpdateEntity> orderUpdateEntities) {
debugPrint('onReorder');
for (final orderUpdateEntity in orderUpdateEntities) {
widget.controller.reOrderImage(
orderUpdateEntity.oldIndex, orderUpdateEntity.newIndex,
Expand All @@ -180,9 +181,6 @@ class _MultiImagePickerViewState extends State<MultiImagePickerView> {
}
}
},
onDragStarted: (){
debugPrint('drag started');
},
longPressDelay: const Duration(milliseconds: 100),
builder: (children) {
return GridView(
Expand All @@ -203,7 +201,11 @@ class _MultiImagePickerViewState extends State<MultiImagePickerView> {
key: Key(e.key),
child: widget.itemBuilder != null
? widget.itemBuilder!(context, e, _deleteImage)
: PreviewItem(file: e, onDelete: _deleteImage, isMouse: isMouse,),
: PreviewItem(
file: e,
onDelete: _deleteImage,
isMouse: isMouse,
),
))
.toList() +
(widget.controller.maxImages > widget.controller.images.length
Expand Down Expand Up @@ -238,4 +240,4 @@ class _MultiImagePickerViewState extends State<MultiImagePickerView> {
scrollController.dispose();
super.dispose();
}
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: multi_image_picker_view
description: A complete widget which can easily pick multiple images from device and display them in UI. Also picked image can be re-ordered and removed easily.
version: 0.0.11
version: 0.0.12
homepage: https://github.com/shubham-gupta-16/multi_image_picker_view
repository: https://github.com/shubham-gupta-16/multi_image_picker_view
issue_tracker: https://github.com/shubham-gupta-16/multi_image_picker_view/issues
Expand Down

0 comments on commit 829ccc1

Please sign in to comment.