【问题标题】:How to add whatsapp image in floating action button in flutter如何在颤动的浮动操作按钮中添加whatsapp图像
【发布时间】:2021-11-09 18:05:59
【问题描述】:

如何在颤动的浮动操作按钮中添加whatsapp图像,因为whatsapp图标不在颤动图标列表中。告诉我一个简单的方法。

Row(
                    children: [
                      FloatingActionButton(
                        child: const Icon(Icons.chat),
                          backgroundColor: Colors.green.shade800,
                        onPressed: () {
                          
                          String url =
                              "https://wa.me/+923045873730/?text=Hello";
                          launch(url);
                        
                        },
                      ),
                    ],
                  ),

【问题讨论】:

    标签: android flutter dart


    【解决方案1】:

    Font Awesome 有一个 Flutter 包,可以帮助处理大多数不在 Flutter 默认图标集中的图标,https://pub.dev/packages/font_awesome_flutter。它还包括字体 Awesome 官方网站 https://fontawesome.com/icons 中列出的所有图标

     import 'package:font_awesome_flutter/font_awesome_flutter.dart';     
    
     Row(
                    children: [
                      FloatingActionButton(
                        child: FaIcon(FontAwesomeIcons.whatsapp),
                          backgroundColor: Colors.green.shade800,
                        onPressed: () {
                          
                          String url =
                              "https://wa.me/+923045873730/?text=Hello";
                          launch(url);
                        
                        },
                      ),
                    ],
                  ),
    

    【讨论】:

      【解决方案2】:

      我想到的最简单的方法是下载 Whatsapp 的图标图像(从 flaticon 或其他网站),将其添加到项目的资产中并将其添加为子项(例如资产图像)。

      【讨论】:

        猜你喜欢
        • 2019-03-06
        • 1970-01-01
        • 2022-06-14
        • 1970-01-01
        • 2022-11-01
        • 1970-01-01
        • 2021-12-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多