flutter - 我需要在 Flutter 中发送带有调度的通知
问题描述
我需要在我的应用程序调度通知上加上日期和时间。当用户创建卡片时,输入日期、时间并选择一个选项并收到通知。我知道 Flutter 本地通知,但我无法在我的代码中进行设置。本地通知是最好的解决方案吗?
buildCard() {
setState(() {
cardWidget.add(
Card(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(20.0),
child: DateTimeField(
resetIcon: Icon(Entypo.ccw),
format: DateFormat("dd/MM/yyyy HH:mm"),
onShowPicker: (context, currentValue) async {
final date = await showDatePicker(
context: context,
firstDate: DateTime(2020),
initialDate: currentValue ?? DateTime.now(),
lastDate: DateTime(2100));
if (date != null) {
final time = await showTimePicker(
context: context,
initialTime: TimeOfDay.fromDateTime(
currentValue ?? DateTime.now()),
);
return DateTimeField.combine(date, time);
} else {
return currentValue;
}
},
),
),
FlatButton(
color: Colors.green,
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: EdgeInsets.symmetric(horizontal: 50),
splashColor: Colors.black12,
onPressed: () {
Timer(Duration(seconds: 0), () {
show(context);
});
},
/*...*/
child: Text(
"Criar",
style: TextStyle(fontSize: 18.0),
),
),
],
),
),
);
});
SizedBox(
height: 27,
);
}
}
解决方案
推荐阅读
- c++11 - std::atomic 的问题
::compareexchangeweak(): 编译器没有匹配的成员函数错误 - r - Tukey 是在混合效应 ANCOVA 之后测试斜率差异的最佳方法吗?
- comments - clang-format 打破长长的 doxygen 评论
- python - 如何在pycharm中使用unittest运行多个测试?
- python-3.x - 没有名为“乌龟”的模块
- python - 使昂贵的 Python 数组全局化
- javascript - 循环没有在所有 JSON 数据集上迭代
- mule-studio - AnpointStudio 部署问题
- coldfusion - CFIMAP 错误 - 不允许对已关闭的文件夹执行此操作
- javascript - 我如何煮一个动画菜单,当草书进入时打开并在光标移除时关闭?