Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust GitHub Actions to run tests on multiple versions of Flutter #54

Merged
merged 7 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ on:
branches: [ main ]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['any', '3.7.0', '3.10.0', '3.16.3'] # Specify versions here

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ matrix.flutter-version }}
- name: Print version
run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Analyze project source
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# EasyImageViewer Changelog

## 1.4.1
- Clearly declare Flutter 3.7.0 and Dart 2.19.0 as the minimum supported versions. Fixes a "const Column" error when used with Flutter versions lower than 3.10.0 (see [GH-52](https://github.com/thesmythgroup/easy_image_viewer/issues/52)).

## 1.4.0
- Add a default error widget that is shown when an image fails to load. The default error widget shows a red `Icons.broken_image` and '🖼️💥🚫' (image, boom, no entry) as a message underneath. You can customize the error widget by subclassing `EasyImageProvider` and overriding `errorWidgetBuilder`. See the README for an example.

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ An easy way to display images in a full-screen dialog, including pinch & zoom.
* Callbacks for `onPageChanged` and `onViewerDismissed`
* Fully customizable loading/progress indicator

## Requirements

EasyImageViewer requires Flutter 3.7.0 and Dart 2.19.0 or higher.

## Usage

Show a single image:
Expand Down
8 changes: 6 additions & 2 deletions lib/src/easy_image_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ abstract class EasyImageProvider {
/// The [stackTrace] parameter is the stack trace associated with the error.
Widget errorWidgetBuilder(
BuildContext context, int index, Object error, StackTrace? stackTrace) {
return const Center(
// Remove once the minimum Flutter version is 3.10+
// ignore: prefer_const_constructors
return Center(
// Remove once the minimum Flutter version is 3.10+
// ignore: prefer_const_constructors
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
children: const <Widget>[
Icon(
Icons.broken_image,
color: Colors.red,
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: easy_image_viewer
description: An easy image viewer with pinch & zoom, multi image, and built-in full-screen dialog support.
version: 1.4.0
version: 1.4.1
homepage: https://github.com/thesmythgroup/easy_image_viewer

environment:
sdk: ">=2.12.0 <4.0.0"
flutter: ">=1.17.0"
sdk: ">=2.19.0 <4.0.0" # This implies at least Dart 2.19, which comes with Flutter 3.7.0
flutter: ">=3.7.0"

topics:
- image
Expand All @@ -21,4 +21,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
flutter_lints: 2.0.3
11 changes: 10 additions & 1 deletion test/support/test_image_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ class TestImageProvider extends ImageProvider<Object> {
}

@override
ImageStreamCompleter loadImage(Object key, ImageDecoderCallback decode) {
// Remove once the minimum Flutter version is 3.16+
// ignore: deprecated_member_use
ImageStreamCompleter loadBuffer(Object key, DecoderBufferCallback decode) {
_loadCallCount += 1;
return _streamCompleter;
}

// Use once the minimum Flutter version is 3.16+
// @override
// ImageStreamCompleter loadImage(Object key, ImageDecoderCallback decode) {
// _loadCallCount += 1;
// return _streamCompleter;
// }

void complete(ui.Image image) {
_completer.complete(ImageInfo(image: image));
}
Expand Down
Loading