FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix red CI on main: format, analyze and Android example build by rickdijk · Pull Request #1045 · Baseflow/flutter_cached_network_image · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .dart  (9) .gradle  (2) .md  (2) .properties  (2) .yaml  (1) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
This file contains hidden or 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
Expand Up @@ -19,6 +19,6 @@
### :thinking: Checklist before submitting

- [ ] All projects build
- [ ] Follows style guide lines ([code style guide](https://github.com/Baseflow/flutter_cached_network_image/blob/develop/CONTRIBUTING.md))
- [ ] Follows style guide lines ([code style guide](https://github.com/Baseflow/flutter_cached_network_image/blob/main/cached_network_image/CONTRIBUTING.md))
- [ ] Relevant documentation was updated
- [ ] Rebased onto current develop
- [ ] Rebased onto current main
6 changes: 6 additions & 0 deletions cached_network_image/CHANGELOG.md
This file contains hidden or 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
@@ -1,3 +1,9 @@
## [4.0.1] - 2026-09-22

* Use an initializing formal for `MultiImageStreamCompleter`'s `scale`, fixing a `prefer_initializing_formals` lint
* Reformat with the current Dart formatter
* Update the example's Android build to AGP 9.0.1, Kotlin 2.3.20, Gradle 9.1.0 and Java 17

## [4.0.0] - 2026-08-25

### Breaking changes
Expand Down
35 changes: 11 additions & 24 deletions cached_network_image/example/android/app/build.gradle
This file contains hidden or 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
@@ -1,36 +1,17 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
// The Flutter Gradle Plugin must be applied after the Android Gradle plugin.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}

android {
namespace = "com.example.example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

defaultConfig {
Expand All @@ -40,8 +21,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
Expand All @@ -53,6 +34,12 @@ android {
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

flutter {
source = "../.."
}
This file contains hidden or 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
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
# Flutter migrator defaults while transitive plugins finish AGP 9 / built-in Kotlin migration.
android.builtInKotlin=false
android.newDsl=false
This file contains hidden or 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
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
This file contains hidden or 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
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version "9.0.1" apply false
id "org.jetbrains.kotlin.android" version "2.3.20" apply false
}

include ":app"
60 changes: 28 additions & 32 deletions cached_network_image/lib/src/cached_image_widget.dart
This file contains hidden or 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
Expand Up @@ -7,34 +7,28 @@ import 'package:octo_image/octo_image.dart';

/// Builder function to create an image widget. The function is called after
/// the ImageProvider completes the image loading.
typedef ImageWidgetBuilder = Widget Function(
BuildContext context,
ImageProvider imageProvider,
);
typedef ImageWidgetBuilder =
Widget Function(BuildContext context, ImageProvider imageProvider);

/// Builder function to create a placeholder widget. The function is called
/// once while the ImageProvider is loading the image.
typedef PlaceholderWidgetBuilder = Widget Function(
BuildContext context,
String url,
);
typedef PlaceholderWidgetBuilder =
Widget Function(BuildContext context, String url);

/// Builder function to create a progress indicator widget. The function is
/// called every time a chuck of the image is downloaded from the web, but at
/// least once during image loading.
typedef ProgressIndicatorBuilder = Widget Function(
BuildContext context,
String url,
DownloadProgress progress,
);
typedef ProgressIndicatorBuilder =
Widget Function(
BuildContext context,
String url,
DownloadProgress progress,
);

/// Builder function to create an error widget. This builder is called when
/// the image failed loading, for example due to a 404 NotFound exception.
typedef LoadingErrorWidgetBuilder = Widget Function(
BuildContext context,
String url,
Object error,
);
typedef LoadingErrorWidgetBuilder =
Widget Function(BuildContext context, String url, Object error);

/// Image widget to show NetworkImage with caching functionality.
class CachedNetworkImage extends StatelessWidget {
Expand Down Expand Up @@ -243,23 +237,25 @@ class CachedNetworkImage extends StatelessWidget {
ImageRenderMethodForWeb.HtmlImage,
double scale = 1.0,
}) : _image = CachedNetworkImageProvider(
imageUrl,
headers: httpHeaders,
cacheManager: cacheManager,
cacheKey: cacheKey,
imageRenderMethodForWeb: imageRenderMethodForWeb,
maxWidth: maxWidthDiskCache,
maxHeight: maxHeightDiskCache,
errorListener: errorListener,
scale: scale,
);
imageUrl,
headers: httpHeaders,
cacheManager: cacheManager,
cacheKey: cacheKey,
imageRenderMethodForWeb: imageRenderMethodForWeb,
maxWidth: maxWidthDiskCache,
maxHeight: maxHeightDiskCache,
errorListener: errorListener,
scale: scale,
);

@override
Widget build(BuildContext context) {
var octoPlaceholderBuilder =
placeholder != null ? _octoPlaceholderBuilder : null;
final octoProgressIndicatorBuilder =
progressIndicatorBuilder != null ? _octoProgressIndicatorBuilder : null;
var octoPlaceholderBuilder = placeholder != null
? _octoPlaceholderBuilder
: null;
final octoProgressIndicatorBuilder = progressIndicatorBuilder != null
? _octoProgressIndicatorBuilder
: null;

///If there is no placeholder OctoImage does not fade, so always set an
///(empty) placeholder as this always used to be the behaviour of
Expand Down
This file contains hidden or 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
Expand Up @@ -5,7 +5,8 @@ import 'dart:ui';

import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart';
import 'package:cached_network_image_platform_interface'
'/cached_network_image_platform_interface.dart' as platform
'/cached_network_image_platform_interface.dart'
as platform
show ImageLoader;
import 'package:material_ui/material_ui.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
Expand Down Expand Up @@ -87,11 +88,12 @@ class ImageLoader implements platform.ImageLoader {
) async* {
try {
assert(
cacheManager is ImageCacheManager ||
(maxWidth == null && maxHeight == null),
'To resize the image with a CacheManager the '
'CacheManager needs to be an ImageCacheManager. maxWidth and '
'maxHeight will be ignored when a normal CacheManager is used.');
cacheManager is ImageCacheManager ||
(maxWidth == null && maxHeight == null),
'To resize the image with a CacheManager the '
'CacheManager needs to be an ImageCacheManager. maxWidth and '
'maxHeight will be ignored when a normal CacheManager is used.',
);

final stream = cacheManager is ImageCacheManager
? cacheManager.getImageFile(
Expand Down
This file contains hidden or 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
Expand Up @@ -17,11 +17,10 @@ class MultiImageStreamCompleter extends ImageStreamCompleter {
/// to show.
MultiImageStreamCompleter({
required Stream<ui.Codec> codec,
required double scale,
required this._scale,
Stream<ImageChunkEvent>? chunkEvents,
InformationCollector? informationCollector,
}) : _informationCollector = informationCollector,
_scale = scale {
}) : _informationCollector = informationCollector {
codec.listen(
(event) {
if (_timer != null) {
Expand Down
2 changes: 1 addition & 1 deletion cached_network_image/pubspec.yaml
This file contains hidden or 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
Expand Up @@ -6,7 +6,7 @@ topics:
- cache
- image
- network-image
version: 4.0.0
version: 4.0.1

environment:
sdk: ^3.12.0
Expand Down
14 changes: 2 additions & 12 deletions cached_network_image/test/fake_cache_manager.dart
This file contains hidden or 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
Expand Up @@ -46,12 +46,7 @@ class FakeCacheManager extends Mock implements CacheManager {
withProgress: any(named: 'withProgress'),
),
).thenAnswer(
(_) => _createResultStream(
url,
chunks,
imageData,
delayBetweenChunks,
),
(_) => _createResultStream(url, chunks, imageData, delayBetweenChunks),
);

return ExpectedData(
Expand Down Expand Up @@ -109,12 +104,7 @@ class FakeImageCacheManager extends Mock implements ImageCacheManager {
maxWidth: any(named: 'maxWidth'),
),
).thenAnswer(
(_) => _createResultStream(
url,
chunks,
imageData,
delayBetweenChunks,
),
(_) => _createResultStream(url, chunks, imageData, delayBetweenChunks),
);

return ExpectedData(
Expand Down
Loading
Loading

Back | FazBrowse Home | New Git URL