alert_controller 0.0.5 alert_controller: ^0.0.5 copied to clipboard
ios原生的AlertViewController的插件
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:alert_controller/alert_controller.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
}
@override
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();
},
)
),
),
);
}
}