Skip to content

Commit

Permalink
added background opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
dbilgin committed Mar 26, 2023
1 parent 8bd3782 commit 00d1c36
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.8.2](https://github.com/dbilgin/swipe_image_gallery/releases/tag/v0.8.2)

- Added `backgroundOpacity` property.

## [0.8.1](https://github.com/dbilgin/swipe_image_gallery/releases/tag/v0.8.1)

- Removed touchpad support to fix windows crash.
Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class _ImageGalleryExamplesPageState extends State<ImageGalleryExamplesPage> {
initialOverlay: OverlayExample(
title: '1/${remoteImages.length}',
),
backgroundOpacity: 0.5,
).show();
},
child: const Text('Open Gallery With Overlay'),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.8.1"
version: "0.8.2"
term_glyph:
dependency: transitive
description:
Expand Down
8 changes: 6 additions & 2 deletions lib/swipe_image_gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class SwipeImageGallery {
this.transitionDuration = 400,
this.hideOverlayOnTap = true,
this.zoom = 8.0,
this.backgroundOpacity = 1.0,
this.controller,
this.onSwipe,
this.overlayController,
Expand Down Expand Up @@ -136,6 +137,9 @@ class SwipeImageGallery {
/// Amount of zoom allowed.
final double zoom;

/// Background opacity between 0-1 and defaults to 1.
final double backgroundOpacity;

/// The controller for the image gallery, extends [PageController].
final ImageGalleryController? controller;

Expand Down Expand Up @@ -273,13 +277,13 @@ class SwipeImageGallery {
if (hideStatusBar)
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
var showOverlay = true;
double _opacity = 1.0;
double _opacity = backgroundOpacity;

final content = StatefulBuilder(
builder: (context, setState) {
void _setOpacity(double opacity) {
setState(() {
_opacity = opacity;
_opacity = opacity * backgroundOpacity;
});
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: swipe_image_gallery
description: A scrollable, dismissable by swiping, zoomable gallery on which you can add a dynamic overlay.
version: 0.8.1
version: 0.8.2
homepage: https://github.com/dbilgin/swipe_image_gallery

environment:
Expand Down

0 comments on commit 00d1c36

Please sign in to comment.