confirm_dialog 0.1.1 confirm_dialog: ^0.1.1 copied to clipboard
Confirm Dialog Widget JS-LIKE for Flutter. Use confirm dialog easy and simple for your flutter app.
Confirm Dialog #
Confirm Dialog Widget for Flutter(JS-LIKE). https://pub.dev/packages/confirm_dialog
Installation #
Add pubspec.yaml #
dependencies:
confirm_dialog: lastest_version
Usage #
Basic #
import 'package:flutter/material.dart';
import 'package:confirm_dialog/confirm_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('Confirm Dialog'),
onPressed: () async {
if (await confirm(context)) {
return print('pressedOK');
}
return print('pressedCancel');
},
),
),
),
);
}
}
Custom Message #
import 'package:flutter/material.dart';
import 'package:confirm_dialog/confirm_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('Confirm Dialog'),
onPressed: () async {
if (await confirm(
context,
title: Text('Confirm'),
content: Text('Would you like to remove?'),
textOK: Text('Yes'),
textCancel: Text('No'),
)) {
return print('pressedOK');
}
return print('pressedCancel');
},
),
),
),
);
}
}
Recommend Libraries #
- Prompt Dialog - Prompt Dialog Widget for Flutter(JS-LIKE).
- Alert Dialog - Alert Dialog Widget for Flutter(JS-LIKE).
- Currency Text Input Formatter - Currency Text Input Formatter for Flutter.
Maintainer #
License #
MIT