@@ -7,36 +7,33 @@ void main() => runApp(new MyApp());
77class MyApp extends StatelessWidget {
88 @override
99 Widget build (BuildContext context) {
10- return new MaterialApp (
10+ return MaterialApp (
1111 title: 'Flutter Demo' ,
12- theme: new ThemeData (
12+ theme: ThemeData (
1313 primarySwatch: Colors .blue,
1414 ),
15- home: new MyHomePage (title: 'Flutter Demo Home Page' ),
15+ home: MyHomePage (title: 'Flutter Demo Home Page' ),
1616 );
1717 }
1818}
1919
2020class MyHomePage extends StatefulWidget {
21- MyHomePage ({Key key, this .title}) : super (key: key);
21+ MyHomePage ({Key ? key, required this .title}) : super (key: key);
2222
2323 final String title;
2424
2525 @override
26- _MyHomePageState createState () => new _MyHomePageState ();
26+ _MyHomePageState createState () => _MyHomePageState ();
2727}
2828
2929class _MyHomePageState extends State <MyHomePage > {
3030 GlobalKey <MiniGesturePasswordState > miniGesturePassword =
3131 new GlobalKey <MiniGesturePasswordState >();
3232
33- GlobalKey <ScaffoldState > scaffoldState = new GlobalKey <ScaffoldState >();
34-
3533 @override
3634 Widget build (BuildContext context) {
3735 return new MaterialApp (
3836 home: new Scaffold (
39- key: scaffoldState,
4037 appBar: new AppBar (
4138 title: new Text ('Plugin example app' ),
4239 ),
@@ -53,13 +50,13 @@ class _MyHomePageState extends State<MyHomePage> {
5350 width: 200.0 ,
5451 successCallback: (s) {
5552 print ("successCallback$s " );
56- scaffoldState.currentState ? .showSnackBar (new SnackBar (
53+ ScaffoldMessenger . of (context) .showSnackBar (new SnackBar (
5754 content: new Text ('successCallback:$s ' )));
5855 miniGesturePassword.currentState? .setSelected ('' );
5956 },
6057 failCallback: () {
6158 print ('failCallback' );
62- scaffoldState.currentState ? .showSnackBar (
59+ ScaffoldMessenger . of (context) .showSnackBar (
6360 new SnackBar (content: new Text ('failCallback' )));
6461 miniGesturePassword.currentState? .setSelected ('' );
6562 },
0 commit comments