Skip to content

Commit ab1be03

Browse files
committed
Fixed logo index on message
1 parent b8ae486 commit ab1be03

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/wallpaper_generator/lib/src/wallpaper_generator.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class WallpaperGenerator {
8686
if (wallpaperLogos != null) {
8787
for (int i = 0; i < wallpaperLogos.length; i++) {
8888
WallpaperLogo wallpaperLogo = wallpaperLogos[i];
89-
updatingFunction("Working on logo [$i/${wallpaperLogos.length}]... setup...");
89+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... setup...");
9090
String? src;
9191
String? type = wallpaperLogo.type;
9292
String? name = wallpaperLogo.name;
@@ -118,7 +118,7 @@ class WallpaperGenerator {
118118
// Try to hit the image from cache or get via http
119119
ByteBuffer? resCache = await imageDB.tryFetch(src);
120120
if(resCache == null) {
121-
updatingFunction("Working on logo [$i/${wallpaperLogos.length - 1}]... fetching the image...");
121+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... fetching the image...");
122122
final HttpRequest res = await HttpRequest.request(src, responseType: 'arraybuffer');
123123
if(res.status == 200) {
124124
resCache = res.response as ByteBuffer;
@@ -130,14 +130,14 @@ class WallpaperGenerator {
130130
if(resCache != null) {
131131

132132
// Decode the image from the bytes
133-
updatingFunction("Working on logo [$i/${wallpaperLogos.length - 1}]... convert the image...");
133+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... convert the image...");
134134
Uint8List imageBytes = Uint8List.view(resCache);
135-
updatingFunction("Working on logo [$i/${wallpaperLogos.length - 1}]... decode the image...");
135+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... decode the image...");
136136
Image? logoSrcImage = decodeImage(imageBytes);
137137
if (logoSrcImage == null) continue;
138138

139139
// Apply the color by multiplication
140-
updatingFunction("Working on logo [$i/${wallpaperLogos.length - 1}]... apply recoloring...");
140+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... apply recoloring...");
141141
Color color = ColorFromString.fromString(wallpaperLogo.color);
142142
logoSrcImage = scaleRgba(logoSrcImage, scale: color, mask: logoSrcImage, maskChannel: Channel.alpha);
143143

@@ -151,7 +151,7 @@ class WallpaperGenerator {
151151
double centerX = ((wallpaperWidth * logoPosX) - logoWidth / 2);
152152
double centerY = ((wallpaperHeight * logoPosY) - logoHeight / 2);
153153

154-
updatingFunction("Working on logo [$i/${wallpaperLogos.length - 1}]... apply the logo...");
154+
updatingFunction("Working on logo [${i + 1}/${wallpaperLogos.length}]... apply the logo...");
155155
// Apply the logo into the final image
156156
finalImage = compositeImage(
157157
finalImage,

0 commit comments

Comments
 (0)