小编Het*_*tal的帖子

Firebase 推送通知未在屏幕上弹出 [Flutter]

我正在尝试为 Flutter 应用程序实现 firebase 推送通知。

但它在状态栏中显示为一个图标。我怎样才能让它弹出?

在此处输入图片说明

我想在收到通知时在屏幕上弹出。

这是我的代码的样子:

 Future<bool> sendNotification(var userToken, String bodyMessage) async {
 final data = {
  "notification": {
    "body": bodyMessage,
    "title": "Leave Application",
  },
  "priority": "high",
  "data": {
    "click_action": "FLUTTER_NOTIFICATION_CLICK",
    "id": "1",
    "status": "done"
  },
  "registration_ids": userToken,
 };

 final headers = {
  'content-type': 'application/json',
  'Authorization':
  'key=<Firebase web key>',
 };

 final response = await http.post(postUrl,
    body: json.encode(data),
    encoding: Encoding.getByName('utf-8'),
    headers: headers);

 if (response.statusCode == 200) {
  print(response.statusCode.toString());
  print("Working");
  return true;
 } else {
  print(postUrl.toString());
  print(response.statusCode.toString());
  print("Not Working");
  return …
Run Code Online (Sandbox Code Playgroud)

android dart flutter

12
推荐指数
2
解决办法
4371
查看次数

如何根据视图在屏幕上的位置制作android缩放动画并将该视图集中在中心?

我想要这样的动画:日历动画

我想在日历上缩放动画并将当前日期集中到中心。我是android动画的新手,我做了一些缩放的事情:

Zoom_in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
    android:duration="1000"
    android:fromXScale="1"
    android:fromYScale="1"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="2"
    android:toYScale="2" />
</set>
Run Code Online (Sandbox Code Playgroud)

但使用它,它将日历缩放到中心,但我希望当前日期位于中心。有人知道如何制作整个动画吗?任何帮助,将不胜感激。

scaling animation android zooming android-animation

1
推荐指数
1
解决办法
2721
查看次数