@@ -63,8 +63,13 @@ class ResponsiveValue<T> {
6363 T ? getValue (BuildContext context, List <Condition > conditions) {
6464 // Find the active condition.
6565 Condition ? activeCondition = getActiveCondition (context, conditions);
66+ if (activeCondition == null ) return null ;
67+ // Return landscape value if orientation is landscape and landscape override value is provided.
68+ if (ResponsiveWrapper .of (context).orientation == Orientation .landscape &&
69+ activeCondition.landscapeValue != null )
70+ return activeCondition.landscapeValue;
6671 // Return active condition value or default value if null.
67- return activeCondition? .value;
72+ return activeCondition.value;
6873 }
6974
7075 /// Set [activeCondition] .
@@ -143,40 +148,53 @@ class Condition<T> {
143148 final String ? name;
144149 final Conditional ? condition;
145150 final T ? value;
146-
147- const Condition ._({this .breakpoint, this .name, this .condition, this .value})
151+ final T ? landscapeValue;
152+
153+ const Condition ._(
154+ {this .breakpoint,
155+ this .name,
156+ this .condition,
157+ this .value,
158+ this .landscapeValue})
148159 : assert (breakpoint != null || name != null ),
149160 assert ((condition == Conditional .EQUALS ) ? name != null : true );
150161
151- const Condition .equals ({required String name, T ? value})
162+ const Condition .equals ({required String name, T ? value, T ? landscapeValue })
152163 : this .breakpoint = null ,
153164 this .name = name,
154165 this .condition = Conditional .EQUALS ,
155- this .value = value;
166+ this .value = value,
167+ this .landscapeValue = landscapeValue;
156168
157- const Condition .largerThan ({int ? breakpoint, String ? name, T ? value})
169+ const Condition .largerThan (
170+ {int ? breakpoint, String ? name, T ? value, T ? landscapeValue})
158171 : this .breakpoint = breakpoint,
159172 this .name = name,
160173 this .condition = Conditional .LARGER_THAN ,
161- this .value = value;
174+ this .value = value,
175+ this .landscapeValue = landscapeValue;
162176
163- const Condition .smallerThan ({int ? breakpoint, String ? name, T ? value})
177+ const Condition .smallerThan (
178+ {int ? breakpoint, String ? name, T ? value, T ? landscapeValue})
164179 : this .breakpoint = breakpoint,
165180 this .name = name,
166181 this .condition = Conditional .SMALLER_THAN ,
167- this .value = value;
182+ this .value = value,
183+ this .landscapeValue = landscapeValue;
168184
169185 Condition copyWith ({
170186 int ? breakpoint,
171187 String ? name,
172188 Conditional ? condition,
173- bool ? value,
189+ T ? value,
190+ T ? landscapeValue,
174191 }) =>
175192 Condition ._(
176193 breakpoint: breakpoint ?? this .breakpoint,
177194 name: name ?? this .name,
178195 condition: condition ?? this .condition,
179196 value: value ?? this .value,
197+ landscapeValue: landscapeValue ?? this .value,
180198 );
181199
182200 @override
@@ -190,6 +208,8 @@ class Condition<T> {
190208 condition.toString () +
191209 ', value: ' +
192210 value.toString () +
211+ ', landscapeValue: ' +
212+ landscapeValue.toString () +
193213 ')' ;
194214
195215 int sort (Condition a, Condition b) {
0 commit comments