@@ -5,20 +5,11 @@ import 'package:gesture_password/mini_gesture_password.dart';
55void main () => runApp (new MyApp ());
66
77class MyApp extends StatelessWidget {
8- // This widget is the root of your application.
98 @override
109 Widget build (BuildContext context) {
1110 return new MaterialApp (
1211 title: 'Flutter Demo' ,
1312 theme: new ThemeData (
14- // This is the theme of your application.
15- //
16- // Try running your application with "flutter run". You'll see the
17- // application has a blue toolbar. Then, without quitting the app, try
18- // changing the primarySwatch below to Colors.green and then invoke
19- // "hot reload" (press "r" in the console where you ran "flutter run",
20- // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
21- // counter didn't reset back to zero; the application is not restarted.
2213 primarySwatch: Colors .blue,
2314 ),
2415 home: new MyHomePage (title: 'Flutter Demo Home Page' ),
@@ -29,38 +20,15 @@ class MyApp extends StatelessWidget {
2920class MyHomePage extends StatefulWidget {
3021 MyHomePage ({Key key, this .title}) : super (key: key);
3122
32- // This widget is the home page of your application. It is stateful, meaning
33- // that it has a State object (defined below) that contains fields that affect
34- // how it looks.
35-
36- // This class is the configuration for the state. It holds the values (in this
37- // case the title) provided by the parent (in this case the App widget) and
38- // used by the build method of the State. Fields in a Widget subclass are
39- // always marked "final".
40-
4123 final String title;
4224
4325 @override
4426 _MyHomePageState createState () => new _MyHomePageState ();
4527}
4628
4729class _MyHomePageState extends State <MyHomePage > {
48- int _counter = 0 ;
49-
50- void _incrementCounter () {
51- setState (() {
52- // This call to setState tells the Flutter framework that something has
53- // changed in this State, which causes it to rerun the build method below
54- // so that the display can reflect the updated values. If we changed
55- // _counter without calling setState(), then the build method would not be
56- // called again, and so nothing would appear to happen.
57- _counter++ ;
58- });
59- }
60-
61-
6230 GlobalKey <MiniGesturePasswordState > miniGesturePassword =
63- new GlobalKey <MiniGesturePasswordState >();
31+ new GlobalKey <MiniGesturePasswordState >();
6432
6533 GlobalKey <ScaffoldState > scaffoldState = new GlobalKey <ScaffoldState >();
6634
@@ -81,13 +49,13 @@ class _MyHomePageState extends State<MyHomePage> {
8149 margin: const EdgeInsets .only (top: 100.0 ),
8250 child: new GesturePassword (
8351 successCallback: (s) {
84- print ("密码为 $s " );
52+ print ("successCallback $s " );
8553 scaffoldState.currentState? .showSnackBar (
8654 new SnackBar (content: new Text ('successCallback:$s ' )));
8755 miniGesturePassword.currentState? .setSelected ('' );
8856 },
8957 failCallback: () {
90- print ('失败了 ' );
58+ print ('failCallback ' );
9159 scaffoldState.currentState? .showSnackBar (
9260 new SnackBar (content: new Text ('failCallback' )));
9361 miniGesturePassword.currentState? .setSelected ('' );
0 commit comments