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

gesture passwords widget

gesture passwords a gesture-unlocking control for flutter that supports a high degree of customization.

demo:

1)a simple and common demo.

rendering:

gesture passwords

code:

gesturepasswordwidget(
      linecolor: const color(0xff0c6bfe),
      errorlinecolor: const color(0xfffb2e4e),
      singlelinecount: 3,
      identifysize: 80.0,
      minlength: 4,
      erroritem: image.asset(
        'images/error.png',
        color: const color(0xfffb2e4e),
      ),
      normalitem: image.asset('images/normal.png'),
      selecteditem: image.asset(
        'images/selected.png',
        color: const color(0xff0c6bfe),
      ),
      answer: [0, 1, 2, 4, 7],
      color: backgroundcolor,
      oncomplete: (data) {
        setstate(() {
          result = data.join(', ');
        });
      },
    )

2)a complex demo. a line has four dots and supports the effect of the selection by set [hititem].

rendering:

complex_demo

code:

gesturepasswordwidget(
      linecolor: colors.white,
      errorlinecolor: colors.redaccent,
      singlelinecount: 4,
      identifysize: 80.0,
      minlength: 4,
      hitshowmilliseconds: 40,
      erroritem: container(
        width: 10.0,
        height: 10.0,
        decoration: boxdecoration(
          color: colors.redaccent,
          borderradius: borderradius.circular(50.0),
        ),
      ),
      normalitem: container(
        width: 10.0,
        height: 10.0,
        decoration: boxdecoration(
          color: colors.white,
          borderradius: borderradius.circular(50.0),
        ),
      ),
      selecteditem: container(
        width: 10.0,
        height: 10.0,
        decoration: boxdecoration(
          color: colors.white,
          borderradius: borderradius.circular(50.0),
        ),
      ),
      hititem: container(
        width: 15.0,
        height: 15.0,
        decoration: boxdecoration(
          color: colors.white,
          borderradius: borderradius.circular(50.0),
        ),
      ),
      answer: [0, 1, 2, 3, 6, 10, 14],
      color: backgroundcolor,
      oncomplete: (data) {
        setstate(() {
          result = data.join(', ');
        });
      },
    )

properties:

property description
size the width and height of gesturepasswordwidget.
identifysize the size of the area used to determine whether a point is selected, the larger the value of the more accurate identification.
normalitem normal display of widget.
selecteditem the widget to display in the selected case.
erroritem the widget displayed in the error case will only work if minlength or answer is set.
(1) when minlength is not null, if the number of selected points is less than minlength, display erroritem, for example, minlength = 4 is set, but the result set of selected points is [0,1,3], a total of 3 points are selected, less than 4.
2) when answer is not null, the erroritem is displayed if the result set of the selected point and answer are not equal, e.g., answer = [0,1,2,4,7], but the result set of the selected point is [0,1,2,5,8], which is not equal to answer;
in addition, the display duration of the erroritem is controlled by completewaitmilliseconds.
hititem the widget to be displayed when this point is selected, its display duration is controlled by hitshowmilliseconds, continue to display selecteditem after reaching the display duration.
singlelinecount the total number of single lines is equal to singlelinecount * singlelinecount.
color the background color of gesturepasswordwidget,which defaults to theme.of(context).scaffoldbackgroundcolor.
onhitpoint the callback function when a point is selected.
oncomplete the callback function at the end of a gesture slide.
linecolor the color of line in the normal case.
errorlinecolor the color of line in the error casr, see [erroritem].
answer the right result,e.g., [0, 1, 2, 4, 7]
loose the default is true.
consider this case: the points index=0 and index=6 are selected, and the point index=3 is not selected, but the point index=3 is on the line between index=0 and index=6. if loose=true, the gesture password obtained is [0,3,6] if loose=false, then the obtained gesture password is [0,6].
completewaitmilliseconds the last selected point and the drawn line are displayed on the screen for the duration of the time, after which all points are cleared and the initial state is restored, and gesturepasswordwidget no longer accepts any gesture events until the time expires.
hitshowmilliseconds see hititem.
minlength if this value is set, erroritem and errorline are displayed if the length is short.

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.