auto_sort_wrap_widget

Auto_sort_wrap_widget automatically wraps it concisely like Tetris. Effective for exposing more data on a small screen.

sample_image

Usage

  • Results when using Flutter's default widgets
final data = ['show me the money', 'asbcdef', '1234567890', 'hi', 'love'];

Wrap(
  runSpacing: 5,
  spacing: 5,
  children: List.generate(data.length, (index) => _getItem(data[index])),
)

스크린샷 2022-08-12 14 08 11

  • Results when using AutoSortWrapWidget
final data = ['show me the money', 'asbcdef', '1234567890', 'hi', 'love'];

AutoSortWrapWidget<String>(
  data: data,
  runSpacing: 5,
  spacing: 5,
  itemBuilder: (context, index, data) => _getItem(data)
);

스크린샷 2022-08-11 17 20 24

  • The data is of type T, and the newline array changes if the items are of different sizes even if the data is the same.
final data = ['show me the money', 'asbcdef', '1234567890', 'hi', 'love'];   // same data as before

AutoSortWrapWidget<Widget>(
  data: List.generate(data.length, (index) => _getItem(data[index])),
  runSpacing: 5,
  spacing: 5,
  itemBuilder: (context, index, data) => Container(
    child: data,
    padding:  const EdgeInsets.all(5.0),
    color:Colors.blueAccent,
   ),
);

스크린샷 2022-08-12 14 31 05

MIT License

Copyright (c) 2018 Simon Leier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.