alert_dialog 0.0.2 alert_dialog: ^0.0.2 copied to clipboard
Alert Dialog Widget JS-LIKE for Flutter. Use alert dialog easy and simple for your flutter app.
Alert Dialog #
Alert Dialog Widget for Flutter(JS-LIKE). https://pub.dev/packages/alert_dialog
Installation #
Add pubspec.yaml #
dependencies:
alert_dialog: lastest_version
Usage #
Basic #
import 'package:flutter/material.dart';
import 'package:alert_dialog/alert_dialog.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: FlatButton(
child: Text('Alert Dialog'),
onPressed: () {
alert(context);
},
),
),
),
);
}
}
Custom Message #
import 'package:flutter/material.dart';
import 'package:alert_dialog/alert_dialog.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: FlatButton(
child: Text('Alert Dialog'),
onPressed: () async {
if (await alert(
context,
title: Text('Alert'),
content: Text('Would you like to remove?'),
textOK: Text('Yes'),
textCancel: Text('No'),
)) {
return print('pressedOK');
}
return print('pressedCancel');
},
),
),
),
);
}
}
Recommend Libraries #
- Confirm Dialog - Confirm Dialog Widget for Flutter(JS-LIKE).
- Prompt Dialog - Prompt Dialog Widget for Flutter(JS-LIKE).
Maintainer #
License #
MIT