Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter – scatter

scatter is a widget that displays a collection of dispersed and non-overlapping children.

can be used to create word clouds:

dispersed nonoverlapping children
dispersed children – words cloud

features

  • built-in delegates (spirals, align, ellipse).
  • allow you to specify how to align chlidren.

getting started

in the pubspec.yaml of your flutter project, add the following dependency:
the latest version is

dependencies:
  ...
  flutter_scatter: ^latest_version

in your library add the following import:

import 'package:flutter_scatter/flutter_scatter.dart';

for help getting started with flutter, view the online documentation.

widgets

you can simply create a scatter by providing a delegate and a list of widgets.

the delegate is responsible for computing positions.
for example if you want to position your widgets on a circle, you will use the ellipsescatterdelegate:

return center(
    child: scatter(
    delegate: ellipsescatterdelegate(
        a: 185.0,
        b: 185.0,
        step: 1.0 / count,
    ),
    children: widgets,
    ),
);
ellipse
dispersed children – circle

it may be useful to choose how children are aligned with the computed positions. by default, the center of the widgets will be placed on the positions generated by the delegate.
if you want to be left aligned, you will change the alignment argument of the scatter to be alignment.topleft.

by default, the scatter will not try to fill gaps (for performance reasons). you can override this behavior by setting the fillgaps argument to true.

for example this is what the above word cloud would look if the fillgaps argument would be set to false:

delegates

scatter has built-in delegates which can be highly parameterized:

spirals

  • archimedeanspiralscatterdelegate
  • fermatspiralscatterdelegate
  • logarithmicspiralscatterdelegate
spirals
dispersed children -spiral

alignments

  • alignscatterdelegate
alignments
dispersed children – align

ellipses

  • ellipsescatterdelegate
ellipses
dispersed children – ellipse

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.