alert_controller

alert_controller 是一个展示iOS系统的AlertController的插件,目前只是适配了ios 使用原生的语法形式调用ios系统弹框,支持actionSheet和alert

Installation

Add dependency to pubspec.yaml

dependencies:
  ...
  alert_controller: ^0.0.5

Run in your terminal

flutter packages get

Example

      Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: new InkWell(
            child: new Text("点击弹框"),
            onTap: (){
                var alertVc = AlertController(title: "测试弹框",message: "这是一个弹框",preferredStyle: AlertStyle.actionSheet);
                var action1 = AlertAction(title: "举报",style: AlertActionStyle.cancel,handler: (action){
                    print(action.title);
                });
                var action0 = AlertAction(title: "111",style: AlertActionStyle.normal,handler: (action){
                    print(action.title);
                });
                var action2 = AlertAction(title: "222",style: AlertActionStyle.normal,handler: (action){
                    print(action.title);
                });
                var action3 = AlertAction(title: "333",style: AlertActionStyle.normal,handler: (action){
                    print(action.title);
                });
                var action4 = AlertAction(title: "444",style: AlertActionStyle.normal,handler: (action){
                    print(action.title);
                });
                alertVc.addAction(action0);
                alertVc.addAction(action1);
                alertVc.addAction(action2);
                alertVc.addAction(action4);
                alertVc.addAction(action1);
                alertVc.show();
            },
          )
        ),
      ),
    );
  }

Libraries

alert_controller