Skip to content

Commit c488e44

Browse files
committed
create #251 demo
1 parent 8faf0c6 commit c488e44

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

example/lib/demo/issue251_tag.dart

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3+
4+
void main() {
5+
runApp(MaterialApp(
6+
navigatorObservers: [FlutterSmartDialog.observer],
7+
builder: FlutterSmartDialog.init(),
8+
home: const MyApp(),
9+
));
10+
}
11+
12+
class MyApp extends StatelessWidget {
13+
const MyApp({super.key});
14+
15+
@override
16+
Widget build(BuildContext context) {
17+
return Scaffold(
18+
appBar: AppBar(
19+
title: const Text("Test"),
20+
),
21+
body: Center(
22+
child: Builder(builder: (ctx) {
23+
return ElevatedButton(
24+
onPressed: () => show(ctx),
25+
child: const Text("Click"),
26+
);
27+
}),
28+
),
29+
);
30+
}
31+
32+
show(BuildContext context) {
33+
SmartDialog.showAttach(
34+
targetContext: context,
35+
alignment: Alignment.topCenter,
36+
maskColor: Colors.transparent,
37+
usePenetrate: true,
38+
keepSingle: true,
39+
tag: "tag2",
40+
animationType: SmartAnimationType.scale,
41+
builder: (_) {
42+
return Container(
43+
height: 300,
44+
width: 500,
45+
decoration: BoxDecoration(
46+
borderRadius: BorderRadius.circular(20),
47+
color: Colors.white,
48+
),
49+
alignment: Alignment.center,
50+
child: ElevatedButton(
51+
onPressed: () {
52+
final checkMsg = SmartDialog.checkExist(tag: "tag2").toString();
53+
SmartDialog.showToast(checkMsg);
54+
},
55+
child: const Text('check tag status'),
56+
),
57+
);
58+
},
59+
);
60+
}
61+
}

0 commit comments

Comments
 (0)