简体   繁体   English

如何在flutter的浮动操作按钮中添加whatsapp图像

[英]How to add whatsapp image in floating action button in flutter

How to add whatsapp image in floating action button in flutter because whatsapp icon is not in flutter icon list.如何在颤动的浮动操作按钮中添加 whatsapp 图像,因为 whatsapp 图标不在颤动图标列表中。 Tell me a simple method.告诉我一个简单的方法。

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

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

Font Awesome has a flutter package that helps with most icons that are not in flutter default icon set, https://pub.dev/packages/font_awesome_flutter . Font Awesome 有一个 flutter 包,可以帮助大多数不在 flutter 默认图标集中的图标, https://pub.dev/packages/font_awesome_flutter It also includes all icons listed in font Awesome Offical website https://fontawesome.com/icons它还包括 font 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);
                    
                    },
                  ),
                ],
              ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM