1

When I click on contact with seller button then it open webpage and it display **Web page not available The web page at whatsapp://send/?phone=923424627671&text=Hi%2C%20I%20am%20interested%20in%20the%20product%3A%0A%0AProduct%20Name%3A%20Electric%20%0AProduct%20Image%3A%20https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Fecommerce-1b43e.appspot.com%2Fo%2Fimages1677497513119374%3Falt%3Dmedia&type=phone_number&app_absent=0 could not be loaded because:

net::ERR_UNKNOWN_URL_SCHEME**

In console when I click on link it go to web page of whatsapp and when I click on continue to chat then it send message but in physical mobile it give above error or web view adding is mendatory? And in app when i click on back then it show web of whatsapp for a moment but it not open permanent why? Can anyone solve this error? Here is my code Also it show this error

W/chromium( 8785): [WARNING:display_webview.cc(31)] WebView overlays are enabled!*


  String buildWhatsAppMessage() {
    String message = 'Hi, I am interested in the product:\n\n';
    message += 'Product Name: ${widget.productName}\n';
    message += 'Product Image: ${widget.url}\n';
    message += 'Product Price: ${widget.productPrice}\n\n';
    message += 'Please let me know more about it.';
    return Uri.encodeFull(message);
  }
  void launchWhatsApp() async {
    String phoneNumber = 'https://wa.me/${widget.phonenumber}?text=${buildWhatsAppMessage()}';
    if (await canLaunchUrl(Uri.parse(phoneNumber))){
     launchUrl(Uri.parse(phoneNumber));
   } else {
     showDialog(context: context,
         builder: (BuildContext context) {
           return AlertDialog(
             title: Text('Seller has no WhatsApp number'),
             content: Text('Unfortunately, the seller does not have a WhatsApp account.'),
             actions: [
               ElevatedButton(
                 child: Text('OK'),
                 onPressed: () {
                   Navigator.of(context).pop();
                 },
               ),
             ],
           );
         });
   }
  }
 RoundedLoadingButton(
              child: Text(
                'Contact with seller',
                style: TextStyle(color: Colors.white),
              ),
              controller: contact,
              resetDuration: Duration(seconds: 3),
              resetAfterDuration: true,
              width: 200,
              height: 50,
              color: Colors.blue,
              successColor: Colors.blue,
              borderRadius: 10,
              elevation: 3,
              onPressed: _isAddToContactLoading
                  ? null
                  : () async {
                setState(() {
                  _isAddToContactLoading = true;
                });
              launchWhatsApp();
                  setState(() {
                    _isAddToContactLoading = false;
                  });
                  _addCartController.success();

              },
            ),

0 Answers0