小编cus*_*pps的帖子

如何添加自定义信息窗口颤动

我想将此自定义小部件添加到我的标记中。我已经设计了小部件,但我不知道如何将其放置在标记上。

如何自定义它以始终显示在信息窗口位置。它包裹在一个定位的小部件中,但我无法将其放置在信息窗口位置。

标记图像

Stack(
        children: [
          AnimatedPositioned(
            bottom: 0.0,
            duration: Duration(milliseconds: 200),
            child: Container(
              padding: EdgeInsets.only(top:
              30,left: 15,
                  right: 15,bottom: 10),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.only(
                      topRight: Radius.circular(0),
                      topLeft: Radius.circular(0),
                      bottomRight: Radius.circular(5),
                      bottomLeft: Radius.circular(5))),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  Text(
                    '500 USD',
                    style: TextStyle(
                      fontWeight: FontWeight.w600,
                      fontFamily: 'Roboto',
                      color: customBlue,
                      fontSize: _sizeConfig.textSize(
                        context,
                        Converters.configSize(14),
                      ),
                    ),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  RatingBar.builder(
                    initialRating: 3.5,
                    unratedColor: Colors.grey
                        .withOpacity(0.5),
                    minRating: 1,
                    allowHalfRating: true,
                    itemSize: 20,
                    direction: Axis.horizontal,
                    itemCount: 5,
                    itemPadding: EdgeInsets.symmetric(horizontal: …
Run Code Online (Sandbox Code Playgroud)

google-maps dart flutter

8
推荐指数
1
解决办法
2万
查看次数

我可以在应用程序启动时显示模态底部表单吗?

我试图在应用程序启动时自动在 flutter 中显示bottom sheeet,但它出现错误。仅当我使用单击事件实例化它时,它才适用于我。但我怎样才能在屏幕启动时弹出它呢?

 @override
  Widget build(BuildContext context) {
    showModalBottomSheet(context: context, builder: (BuildContext context) {
      return Container();
    });
Run Code Online (Sandbox Code Playgroud)

dart flutter bottom-sheet

5
推荐指数
2
解决办法
7499
查看次数

在 dart 中将秒转换为 mm:ss

我想将秒转换为 HH:SS 格式的分钟和秒,但我的逻辑没有给我我想要的。

  static double toMin (var value){
            return (value/60);
          }
Run Code Online (Sandbox Code Playgroud)

我还希望能够将余数添加到分钟值中,因为有时我的除法给出的秒值大于 60,这是不准确的

dart flutter

5
推荐指数
2
解决办法
4590
查看次数

onBackgroundMessage 没有被调用 flutter 消息传递

firebase messaging我在我的 flutter 应用程序上获得了令人沮丧的体验onBackgroundmessage,因为发送请求后应用程序处于后台时没有被触发。我想知道为什么,因为这是我的应用程序需要的核心功能。

  Future initialize(context) async{
    _firebaseMessaging.configure(
   
    onBackgroundMessage: Platform.isIOS ? null:_myBackgroundMessageHandler,

    
    );
  }
  Future<dynamic> _myBackgroundMessageHandler
      (Map<String, dynamic> message) async {
      print("onBackground Message called");
    fetchRideInfoInBackground();
    return Future<void>.value();
  }

}
Run Code Online (Sandbox Code Playgroud)

通知负载

const message = {
      notification: {
        title: 'New Incoming Request',
        body: `New incoming ${service} request`,
      },
      data: { orderId: orderId },
      android: {
        ttl: 30,
        priority: 'high',
        notification: {
          click_action: 'FLUTTER_NOTIFICATION_CLICK',
        },
      },
      tokens: driversRegistrationToken,
    };
Run Code Online (Sandbox Code Playgroud)

flutter firebase-cloud-messaging

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

Flutter 中特定设备的 Firebase 消息通知

我正在开发一个颤振应用程序,其中在我们的自定义服务器上实现了许多服务器请求,包括登录/注册。但是,我们决定使用 Firebase Cloud Messaging 进行通知。例如,应用程序中包含聊天功能。

在端到端消息传递期间,当消息发布到我们的服务器时,用户应该会在其特定设备上收到通知。我已经firebase在应用程序中成功实现和配置,可以从控制台发送消息,但我需要让它在特定设备上工作。

// Replace with server token from firebase console settings.
final String serverToken = '<Server-Token>';
final FirebaseMessaging firebaseMessaging = FirebaseMessaging();

Future<Map<String, dynamic>> sendAndRetrieveMessage() async {
  await firebaseMessaging.requestNotificationPermissions(
    const IosNotificationSettings(sound: true, badge: true, alert: true, provisional: false),
  );

  await http.post(
    'https://fcm.googleapis.com/fcm/send',
     headers: <String, String>{
       'Content-Type': 'application/json',
       'Authorization': 'key=$serverToken',
     },
     body: jsonEncode(
     <String, dynamic>{
       'notification': <String, dynamic>{
         'body': 'this is a body',
         'title': 'this is a title'
       },
       'priority': 'high',
       'data': <String, dynamic>{
         'click_action': 'FLUTTER_NOTIFICATION_CLICK', …
Run Code Online (Sandbox Code Playgroud)

push-notification dart firebase flutter firebase-cloud-messaging

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