首页 > 解决方案 > 如何使用颤振访问用户的日历设备

问题描述

我正在编写一个简单的应用程序来测试可以访问用户设备日历的包的功能。到目前为止我做了什么:

class CalendarEvents extends StatelessWidget {
  final CalendarPlugin _myPlugin = CalendarPlugin();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Calendar Testing',
          style: TextStyle(color: Colors.black),
        ),
        backgroundColor: TheBaseColors.lightGreen,
      ),
      body: Center(
        child: RaisedButton(
          onPressed: () {
            _myPlugin.hasPermissions().then((value) {
              if (!value) {
                _myPlugin.requestPermissions();
              } else {

                Text('We dont have permissions');

              }
            });
          },
          child: Text('Calendar'),
        ),
      ),
    );
  }
}

我还添加了 android 的权限。我需要做的是访问日历设备。知道怎么做吗?

标签: flutter

解决方案


推荐阅读