Home > other >  How to add whatsapp image in floating action button in flutter
How to add whatsapp image in floating action button in flutter

Time:11-10

How to add whatsapp image in floating action button in flutter because whatsapp icon is not in flutter icon list. 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);
                        
                        },
                      ),
                    ],
                  ),

CodePudding user response:

The easiest way that comes to my mind is that downloading the icon image of Whatsapp (from flaticon or other website), adding it to the project's assets and adding it as a child( for example asset image).

CodePudding user response:

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. It also includes all icons listed in font Awesome Offical website 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);
                    
                    },
                  ),
                ],
              ),
  • Related