|
| 1 | + |
| 2 | +// ignore_for_file: lines_longer_than_80_chars, cascade_invocations |
| 3 | + |
1 | 4 | import 'dart:async';
|
2 | 5 | import 'dart:convert';
|
3 | 6 |
|
@@ -282,13 +285,9 @@ class ImageTransformation {
|
282 | 285 | /// cropRatio as prams else it takes crop params and comas
|
283 | 286 | /// separated width & height
|
284 | 287 | final cropLRBL = [];
|
285 |
| - if (width != null) { |
286 |
| - cropLRBL.add(width); |
287 |
| - } |
288 |
| - if (height != null) { |
| 288 | + cropLRBL.add(width); |
289 | 289 | cropLRBL.add(height);
|
290 |
| - } |
291 |
| - if (region != null) { |
| 290 | + if (region != null) { |
292 | 291 | cropLRBL.add(region);
|
293 | 292 | }
|
294 | 293 | if (offset != null) {
|
@@ -359,25 +358,19 @@ class ImageTransformation {
|
359 | 358 | ///
|
360 | 359 |
|
361 | 360 | void fit(double width, double height, Fit fit) {
|
362 |
| - if (width != null) { |
363 |
| - query.append('width', width.toString()); |
364 |
| - } |
365 |
| - if (height != null) { |
| 361 | + query.append('width', width.toString()); |
366 | 362 | query.append('height', height.toString());
|
367 |
| - } |
368 |
| - if (fit != null) { |
369 | 363 | //enum Fit { bounds, crop }
|
370 | 364 |
|
371 |
| - switch(fit) { |
372 |
| - case Fit.Bounds: |
373 |
| - query.append('fit', 'bounds'); |
374 |
| - break; |
375 |
| - case Fit.Crop: |
376 |
| - query.append('fit', 'crop'); |
377 |
| - break; |
378 |
| - } |
| 365 | + switch(fit) { |
| 366 | + case Fit.Bounds: |
| 367 | + query.append('fit', 'bounds'); |
| 368 | + break; |
| 369 | + case Fit.Crop: |
| 370 | + query.append('fit', 'crop'); |
| 371 | + break; |
| 372 | + } |
379 | 373 | }
|
380 |
| - } |
381 | 374 |
|
382 | 375 | /// The frame parameter fetches the first frame from an animated GIF
|
383 | 376 | /// (Graphics Interchange Format) file that comprises
|
@@ -429,35 +422,33 @@ class ImageTransformation {
|
429 | 422 | // degrees90TowardsRight = '6';
|
430 | 423 | // horizontallyAndRotate90DegreesRight = '7';
|
431 | 424 | // rotate90DegreesLeft = '8';
|
432 |
| - if (orient != null) { |
433 |
| - switch(orient) { |
434 |
| - case Orientation.ToDefault: |
435 |
| - query.append('orient', 1); |
436 |
| - break; |
437 |
| - case Orientation.Horizontally: |
438 |
| - query.append('orient', 2); |
439 |
| - break; |
440 |
| - case Orientation.HorizontallyAndVertically: |
441 |
| - query.append('orient', 3); |
442 |
| - break; |
443 |
| - case Orientation.Vertically: |
444 |
| - query.append('orient', 4); |
445 |
| - break; |
446 |
| - case Orientation.HorizontallyAndRotate90DegreeLeft: |
447 |
| - query.append('orient', 5); |
448 |
| - break; |
449 |
| - case Orientation.Degrees90TowardsRight: |
450 |
| - query.append('orient', 6); |
451 |
| - break; |
452 |
| - case Orientation.HorizontallyAndRotate90DegreesRight: |
453 |
| - query.append('orient', 7); |
454 |
| - break; |
455 |
| - case Orientation.Rotate90DegreesLeft: |
456 |
| - query.append('orient', 8); |
457 |
| - break; |
458 |
| - } |
| 425 | + switch(orient) { |
| 426 | + case Orientation.ToDefault: |
| 427 | + query.append('orient', 1); |
| 428 | + break; |
| 429 | + case Orientation.Horizontally: |
| 430 | + query.append('orient', 2); |
| 431 | + break; |
| 432 | + case Orientation.HorizontallyAndVertically: |
| 433 | + query.append('orient', 3); |
| 434 | + break; |
| 435 | + case Orientation.Vertically: |
| 436 | + query.append('orient', 4); |
| 437 | + break; |
| 438 | + case Orientation.HorizontallyAndRotate90DegreeLeft: |
| 439 | + query.append('orient', 5); |
| 440 | + break; |
| 441 | + case Orientation.Degrees90TowardsRight: |
| 442 | + query.append('orient', 6); |
| 443 | + break; |
| 444 | + case Orientation.HorizontallyAndRotate90DegreesRight: |
| 445 | + query.append('orient', 7); |
| 446 | + break; |
| 447 | + case Orientation.Rotate90DegreesLeft: |
| 448 | + query.append('orient', 8); |
| 449 | + break; |
| 450 | + } |
459 | 451 | }
|
460 |
| - } |
461 | 452 |
|
462 | 453 | /// The overlay parameter allows you to put one image on top of another.
|
463 | 454 | /// You need to specify the relative URL of the image as
|
|
0 commit comments