-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; | ||
|
||
void main() { | ||
runApp(MaterialApp( | ||
navigatorObservers: [FlutterSmartDialog.observer], | ||
builder: FlutterSmartDialog.init(), | ||
home: const MyApp(), | ||
)); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text( | ||
"Test", | ||
), | ||
), | ||
body: Center( | ||
child: ElevatedButton( | ||
onPressed: () async { | ||
show("toast1"); | ||
show("toast2"); | ||
}, | ||
child: const Text( | ||
"Click", | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Future show(String msg) { | ||
return SmartDialog.showToast( | ||
msg, | ||
alignment: Alignment.center, | ||
displayType: SmartToastType.last, | ||
displayTime: const Duration(seconds: 3), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters