@@ -201,6 +201,33 @@ class ListViewProperties extends CustomProperties with FieldsHolder {
201201 /// with motion bound to their index (see [MotionModel] ).
202202 bool stacked;
203203
204+ /// Whether the items flow onto further lines (runs) when they don't fit,
205+ /// like Flutter's [Wrap] , instead of scrolling in one line. The scroll
206+ /// direction is the wrap direction: a horizontal list fills a line from
207+ /// left to right, then starts a new line below; a vertical list fills a
208+ /// column top to bottom, then starts a new column to the right. Items keep
209+ /// their own size (they are not stretched to the list's cross extent).
210+ /// Separators are not drawn; use [wrapSpacing] and [wrapRunSpacing] .
211+ /// Ignored when [stacked] is true.
212+ ///
213+ /// A wrapping list shows every item, so it needs an item count or a data
214+ /// source. It scrolls along the cross axis when its runs don't fit its box;
215+ /// give it a shrink-wrap fit on the cross axis to grow with its runs.
216+ bool wrap;
217+
218+ /// The gap between two items of the same line when [wrap] is true.
219+ double wrapSpacing;
220+
221+ /// The gap between two lines (runs) when [wrap] is true.
222+ double wrapRunSpacing;
223+
224+ /// How the items of a line are placed along the wrap direction when [wrap]
225+ /// is true. Maps to Flutter's [WrapAlignment] by name.
226+ MainAxisAlignmentC wrapAlignment;
227+
228+ /// Whether this list wraps its items: [wrap] is on and [stacked] is off.
229+ bool get isWrapping => wrap && ! stacked;
230+
204231 /// Creates a new [ListViewProperties] instance.
205232 ListViewProperties ({
206233 this .itemCount,
@@ -210,6 +237,10 @@ class ListViewProperties extends CustomProperties with FieldsHolder {
210237 this .separatorSpacing = 0 ,
211238 this .hasSeparator = false ,
212239 this .stacked = false ,
240+ this .wrap = false ,
241+ this .wrapSpacing = 0 ,
242+ this .wrapRunSpacing = 0 ,
243+ this .wrapAlignment = MainAxisAlignmentC .start,
213244 DividerProperties ? dividerProperties,
214245 }) : dividerProperties = dividerProperties ?? DividerProperties ();
215246
@@ -230,10 +261,18 @@ class ListViewProperties extends CustomProperties with FieldsHolder {
230261 double ? dividerSpacing,
231262 bool ? hasSeparator,
232263 bool ? stacked,
264+ bool ? wrap,
265+ double ? wrapSpacing,
266+ double ? wrapRunSpacing,
267+ MainAxisAlignmentC ? wrapAlignment,
233268 DividerProperties ? dividerProperties,
234269 }) {
235270 return ListViewProperties (
236271 stacked: stacked ?? this .stacked,
272+ wrap: wrap ?? this .wrap,
273+ wrapSpacing: wrapSpacing ?? this .wrapSpacing,
274+ wrapRunSpacing: wrapRunSpacing ?? this .wrapRunSpacing,
275+ wrapAlignment: wrapAlignment ?? this .wrapAlignment,
237276 itemCount: itemCount ?? this .itemCount,
238277 itemExtent: itemExtent ?? this .itemExtent,
239278 cacheExtent: cacheExtent ?? this .cacheExtent,
@@ -255,6 +294,37 @@ class ListViewProperties extends CustomProperties with FieldsHolder {
255294 (value) => stacked = value,
256295 requiresLayout: true ,
257296 ),
297+ 'wrap' : BoolFieldAccess (
298+ 'Wrap' ,
299+ 'Flow the items onto further lines when they do not fit, instead of '
300+ 'scrolling in one line. Ignored when Stacked is on.' ,
301+ () => wrap,
302+ (value) => wrap = value,
303+ requiresLayout: true ,
304+ ),
305+ 'wrapSpacing' : NumFieldAccess <double >(
306+ 'Wrap Spacing' ,
307+ 'The gap between two items of the same line of a wrapping list.' ,
308+ () => wrapSpacing,
309+ (value) => wrapSpacing = value,
310+ requiresLayout: true ,
311+ ),
312+ 'wrapRunSpacing' : NumFieldAccess <double >(
313+ 'Wrap Run Spacing' ,
314+ 'The gap between two lines of a wrapping list.' ,
315+ () => wrapRunSpacing,
316+ (value) => wrapRunSpacing = value,
317+ requiresLayout: true ,
318+ ),
319+ 'wrapAlignment' : EnumFieldAccess <MainAxisAlignmentC >(
320+ 'Wrap Alignment' ,
321+ 'How the items of a line of a wrapping list are placed along it.' ,
322+ () => wrapAlignment,
323+ (value) => wrapAlignment = value,
324+ defaultValue: () => MainAxisAlignmentC .start,
325+ options: () => MainAxisAlignmentC .values,
326+ requiresLayout: true ,
327+ ),
258328 'hasSeparator' : BoolFieldAccess (
259329 'Has Separator' ,
260330 'Whether to use a separator between list view items.' ,
@@ -304,6 +374,10 @@ class ListViewProperties extends CustomProperties with FieldsHolder {
304374 separatorSpacing,
305375 hasSeparator,
306376 stacked,
377+ wrap,
378+ wrapSpacing,
379+ wrapRunSpacing,
380+ wrapAlignment,
307381 dividerProperties,
308382 ];
309383}
0 commit comments