flutter_ritl_alert 0.0.2 icon indicating copy to clipboard operation
flutter_ritl_alert: ^0.0.2 copied to clipboard

A simple iOS style AlertController.

flutter_ritl_alert #

青岛地铁APP中使用的AlertController flutter版本

Version

引用 #

dependencies:
 flutter_ritl_alert: ^0.0.1

or

dependencies:
 flutter_ritl_alert:
   git: git@github.com:RITL/flutter_ritl_alert.git

then run flutter packages get

无按钮 #

RITLAlert(
  context: context,
  title: "我是RITLAlert",
  message: "开启一下GPS定位吧。",
).show();

默认方式 #

RITLAlert(
  context: context,
  title: "我是RITLAlert",
  message: "开启一下GPS定位吧。",
  buttons: [
    RITLAlertAction(
      title: "知道啦",
      type: RITLAlertActionType.normal,
      onPressed: (alert, action) => print("我点击啦知道啦"),
    ),
    RITLAlertAction(
      title: "取消吧",
      type: RITLAlertActionType.destructive,
      onPressed: (alert, action) => print("我点击啦取消吧"),
    ),
  ],
).show();

自定义方式 #

RITLAlert(
    context: context,
    title: "我是RITLAlert",
    message: "开启一下GPS定位吧。",
    buttons: [
      RITLAlertAction(
        title: "自定义啦",
        type: RITLAlertActionType.custom,
        style: TextStyle(
          color: Color.fromRGBO(47, 189, 75, 1),
          fontWeight: FontWeight.w500,
        ),
        onPressed: (alert, action) => print("我点击自定义"),
      ),
      RITLAlertAction(
        title: "知道啦",
        type: RITLAlertActionType.normal,
        onPressed: (alert, action) => print("我点击啦知道啦"),
      ),
      RITLAlertAction(
        title: "取消吧",
        type: RITLAlertActionType.destructive,
        onPressed: (alert, action) => print("我点击啦取消吧"),
      ),
    ]).show();

自定义Style #

RITLAlert(
  context: context,
  title: "我是RITLAlert",
  message: "开启一下GPS定位吧。",
  buttons: [
    RITLAlertAction(
      title: "知道啦",
      type: RITLAlertActionType.normal,
      onPressed: (alert, action) => print("我点击啦知道啦"),
    ),
    RITLAlertAction(
      title: "取消吧",
      type: RITLAlertActionType.destructive,
      onPressed: (alert, action) => print("我点击啦取消吧"),
    ),
  ],
  style: RITLAlertStyle(
    backgroundColor: CupertinoColors.black,
    separateColor: CupertinoColors.white,
    titleStyle: TextStyle(color: CupertinoColors.white),
    messageStyle: TextStyle(color: CupertinoColors.white),
  ),
).show();

3
likes
120
pub points
0%
popularity

Publisher

unverified uploader

A simple iOS style AlertController.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_ritl_alert