Skip to content

Commit 81166f4

Browse files
committed
feat: update example
1 parent 34b8ffa commit 81166f4

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

Diff for: example/lib/main.dart

+29-11
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,38 @@ class MyHomePage extends StatefulWidget {
2727
}
2828

2929
class _MyHomePageState extends State<MyHomePage> {
30+
bool _isZerkerVisible = true;
31+
32+
void _toggleZerkerVisibility() {
33+
setState(() {
34+
_isZerkerVisible = !_isZerkerVisible;
35+
});
36+
}
37+
3038
@override
3139
Widget build(BuildContext context) {
3240
return Scaffold(
33-
appBar: AppBar(
34-
title: Text(widget.title),
35-
),
36-
body: Center(
37-
child: Zerker(
38-
app: MyZKApp(),
39-
clip: true,
40-
interactive: true,
41-
width: 350,
42-
height: 350),
43-
));
41+
appBar: AppBar(
42+
title: Text(widget.title),
43+
),
44+
body: Center(
45+
child: _isZerkerVisible
46+
? Zerker(
47+
app: MyZKApp(),
48+
clip: true,
49+
interactive: true,
50+
width: 350,
51+
height: 350,
52+
)
53+
: Container(),
54+
),
55+
floatingActionButton: FloatingActionButton(
56+
onPressed: _toggleZerkerVisibility,
57+
child: Icon(_isZerkerVisible ? Icons.visibility_off : Icons.visibility),
58+
tooltip: _isZerkerVisible ? 'Hide Zerker' : 'Show Zerker',
59+
),
60+
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
61+
);
4462
}
4563
}
4664

0 commit comments

Comments
 (0)