@@ -194,9 +194,13 @@ class BoxConstraintsModel with EquatableMixin, SerializableMixin {
194194 /// Creates a union [BoxConstraintsModel] from the current
195195 /// [BoxConstraintsModel] and the provided [constraints] .
196196 ///
197- /// The resulting [BoxConstraintsModel] will have the minimum with and height
198- /// that's the biggest of the two, and the maximum width and height that's
199- /// the smallest of the two.
197+ /// The resulting [BoxConstraintsModel] will have:
198+ /// - The maximum of the two minimum widths.
199+ /// - The maximum of the two minimum heights.
200+ /// - The minimum of the two maximum widths.
201+ /// - The minimum of the two maximum heights.
202+ ///
203+ /// [returns] a [BoxConstraintsModel] that has overlapping constraints.
200204 BoxConstraintsModel union (BoxConstraintsModel constraints) {
201205 return BoxConstraintsModel (
202206 minWidth: (minWidth == null )
@@ -222,35 +226,6 @@ class BoxConstraintsModel with EquatableMixin, SerializableMixin {
222226 );
223227 }
224228
225- /// Similar to [union] , but will only clamp the minimums and maximums
226- /// if the passed [constraints] of the relevant parameter is not null.
227- ///
228- /// So for example, if the passed [constraints] has a null min width,
229- /// instead of returning a [BoxConstraintsModel] with a null min width,
230- /// it just returns its own if available.
231- /// Otherwise, it takes the biggest of the two min widths.
232- ///
233- /// Another example, if the passed [constraints] has a null max width,
234- /// instead of returning a [BoxConstraintsModel] with a null max width,
235- /// it just returns its own if available.
236- /// Otherwise, it takes the smallest of the two max widths.
237- BoxConstraintsModel unionNonNull (BoxConstraintsModel constraints) {
238- return BoxConstraintsModel (
239- minWidth: constraints.minWidth == null
240- ? minWidth
241- : max (minWidth ?? 0 , constraints.minWidth! ),
242- maxWidth: constraints.maxWidth == null
243- ? maxWidth
244- : min (maxWidth ?? double .infinity, constraints.maxWidth! ),
245- minHeight: constraints.minHeight == null
246- ? minHeight
247- : max (minHeight ?? 0 , constraints.minHeight! ),
248- maxHeight: constraints.maxHeight == null
249- ? maxHeight
250- : min (maxHeight ?? double .infinity, constraints.maxHeight! ),
251- );
252- }
253-
254229 /// Whether this constraints is the same as no constraints which is the
255230 /// default value.
256231 bool get isDefault =>
0 commit comments