joshuadeguzman/flutter_dialogs
💬 一个轻量级且平台感知的插件,可用于在 Android 和 iOS 设备上显示对话框和警告。
- Stars
- 14
- Forks
- 5
- 最近推送(UTC)
- 2022年7月24日
- 项目状态
- 未归档
语言C++CMakeDartHTMLCSwiftShellRubyKotlinObjective-C
技术话题
使用的依赖
依赖清单 2 项
- flutter
{"sdk":"flutter"} - flutter_test开发依赖
{"sdk":"flutter"}
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
展开 / 收起项目 README
flutter_dialogs
A lightweight and platform-aware plugin for showing dialogs and alerts for both Android and iOS devices. Supports null-safety and Flutter 2.0.
Features
- Platform aware
- Extendable widgets
- Lightweight < 28 KB
Usage
Sample Alert
showPlatformDialog(
context: context,
builder: (context) => BasicDialogAlert(
title: Text("Current Location Not Available"),
content:
Text("Your current location cannot be determined at this time."),
actions: <Widget>[
BasicDialogAction(
title: Text("OK"),
onPressed: () {
Navigator.pop(context);
},
),
],
),
);
Output
| iOS | Android |
|---|---|
| ios-basic-dialog-alert | android-basic-dialog-alert |
Sample Confirmation
showPlatformDialog(
context: context,
builder: (context) => BasicDialogAlert(
title: Text("Discard draft?"),
content: Text("Action cannot be undone."),
actions: <Widget>[
BasicDialogAction(
title: Text("Cancel"),
onPressed: () {
Navigator.pop(context);
},
),
BasicDialogAction(
title: Text("Discard"),
onPressed: () {
Navigator.pop(context);
},
),
],
),
);
Output
| iOS | Android |
|---|---|
| ios-basic-dialog-confirmation | android-basic-dialog-confirmation |
Sample List
showPlatformDialog(
context: context,
builder: (context) => BasicDialogAlert(
title: Text("Select account"),
content: Container(
height: 200,
child: ListView(
children: <Widget>[
_buildListSampleItem("joshua@joshuamdeguzman.com"),
_buildListSampleItem("hello@gmail.com"),
_buildListSampleItem("joshua@flutter.ph"),
_buildListSampleItem("jdeguzman@freelancer.com"),
],
),
),
actions: <Widget>[
BasicDialogAction(
title: Text("Cancel"),
onPressed: () {
Navigator.pop(context);
},
),
],
),
);
Output
| iOS | Android |
|---|---|
| ios-basic-dialog-list | android-basic-dialog-list |
License
MIT @joshuadeguzman