@@ -445,7 +445,32 @@ void main() {
445
445
Color (0x80777777 ),
446
446
Color (0x80444444 ),
447
447
],
448
- ),);
448
+ ));
449
+ });
450
+
451
+ test ('LinearGradient withOpacity() preserves transform' , () {
452
+ const LinearGradient testGradient = LinearGradient (
453
+ begin: Alignment .bottomRight,
454
+ end: Alignment .topCenter,
455
+ colors: < Color > [
456
+ Color (0xFFFFFFFF ),
457
+ Color (0xAF777777 ),
458
+ Color (0x44444444 ),
459
+ ],
460
+ transform: GradientRotation (1 ),
461
+ );
462
+ final LinearGradient actual = testGradient.withOpacity (0.5 );
463
+
464
+ expect (actual, const LinearGradient (
465
+ begin: Alignment .bottomRight,
466
+ end: Alignment .topCenter,
467
+ colors: < Color > [
468
+ Color (0x80FFFFFF ),
469
+ Color (0x80777777 ),
470
+ Color (0x80444444 ),
471
+ ],
472
+ transform: GradientRotation (1 ),
473
+ ));
449
474
});
450
475
451
476
test ('RadialGradient with AlignmentDirectional' , () {
@@ -765,6 +790,36 @@ void main() {
765
790
],
766
791
));
767
792
});
793
+
794
+ test ('RadialGradient withOpacity() preserves transform' , () {
795
+ const RadialGradient testGradient = RadialGradient (
796
+ center: Alignment .topLeft,
797
+ focal: Alignment .centerLeft,
798
+ radius: 20.0 ,
799
+ focalRadius: 10.0 ,
800
+ colors: < Color > [
801
+ Color (0xFFFFFFFF ),
802
+ Color (0xAF777777 ),
803
+ Color (0x44444444 ),
804
+ ],
805
+ transform: GradientRotation (1 ),
806
+ );
807
+ final RadialGradient actual = testGradient.withOpacity (0.5 );
808
+
809
+ expect (actual, const RadialGradient (
810
+ center: Alignment .topLeft,
811
+ focal: Alignment .centerLeft,
812
+ radius: 20.0 ,
813
+ focalRadius: 10.0 ,
814
+ colors: < Color > [
815
+ Color (0x80FFFFFF ),
816
+ Color (0x80777777 ),
817
+ Color (0x80444444 ),
818
+ ],
819
+ transform: GradientRotation (1 ),
820
+ ));
821
+ });
822
+
768
823
test ('SweepGradient lerp test' , () {
769
824
const SweepGradient testGradient1 = SweepGradient (
770
825
center: Alignment .topLeft,
@@ -997,6 +1052,32 @@ void main() {
997
1052
],
998
1053
));
999
1054
});
1055
+
1056
+ test ('SweepGradient withOpacity() preserves transform' , () {
1057
+ const SweepGradient testGradient = SweepGradient (
1058
+ center: Alignment .topLeft,
1059
+ endAngle: math.pi / 2 ,
1060
+ colors: < Color > [
1061
+ Color (0xFFFFFFFF ),
1062
+ Color (0xAF777777 ),
1063
+ Color (0x44444444 ),
1064
+ ],
1065
+ transform: GradientRotation (1 ),
1066
+ );
1067
+ final SweepGradient actual = testGradient.withOpacity (0.5 );
1068
+
1069
+ expect (actual, const SweepGradient (
1070
+ center: Alignment .topLeft,
1071
+ endAngle: math.pi / 2 ,
1072
+ colors: < Color > [
1073
+ Color (0x80FFFFFF ),
1074
+ Color (0x80777777 ),
1075
+ Color (0x80444444 ),
1076
+ ],
1077
+ transform: GradientRotation (1 ),
1078
+ ));
1079
+ });
1080
+
1000
1081
test ('Gradient lerp test (with RadialGradient)' , () {
1001
1082
const RadialGradient testGradient1 = RadialGradient (
1002
1083
center: Alignment .topLeft,
0 commit comments