Skip to content

Commit 99d2b3f

Browse files
committed
chore: update example
1 parent 84f3d36 commit 99d2b3f

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

example/lib/main.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,33 @@ void main() => runApp(new MyApp());
77
class 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

2020
class 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

2929
class _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
},

example/pubspec.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: example
22
description: A new Flutter project.
33

4+
environment:
5+
sdk: ">=2.15.0 <4.0.0"
6+
flutter: ">=3.0.0"
7+
48
dependencies:
59
flutter:
610
sdk: flutter
711

812
# The following adds the Cupertino Icons font to your application.
913
# Use with the CupertinoIcons class for iOS style icons.
10-
cupertino_icons: ^0.1.2
14+
cupertino_icons: ^1.0.5
1115
gesture_password:
1216
path: ../
1317

0 commit comments

Comments
 (0)