1

I developed a game with Flutter that I embedded on a webpage. None of the actions works on finger touch on Safari on the iPad. They respond only to mouse clicks. They do respond to finger touch on Chrome on a mobile device.

On the first screen, there is a simple Flat Button with onPressed to navigate to the next screen. The button is working perfectly fine on Chrome, Firefox, even Safari, but for this one, only with a mouse. If I tried the game on Safari on an iPad, the onPressed doesn't work with finger touch, nor with a pencil.

Same thing for the logo that I embedded in an InkWell widget with an onTap.

Here is the page with the game: http://www.maxetom.com/jeux_lecture/son_a1.php

Here is the code for the button:

import 'package:flutter/material.dart';

class OrangeButton extends StatelessWidget {
  final String screenName;
  final String text;

  OrangeButton(this.text, this.screenName);

  void callNextScreen(BuildContext context) {
    Navigator.of(context).pushNamed(screenName);
  }

  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.circular(15),
      child: FlatButton(
        color: Theme.of(context).accentColor,
        textColor: Colors.white,
        onPressed: () => callNextScreen(context),
        child: Container(
          alignment: Alignment.center,
          width: 120,
          height: 50,
          child: Text(
            text,
            style: Theme.of(context).textTheme.bodyText1,
          ),
        ),
      ),
    );
  }
}

Here is the code for the InkWell + onTap:

import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/material.dart';

class Logo extends StatelessWidget {
  const Logo({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.transparent,
      alignment: Alignment.centerRight,
      padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5.0),
      child: Material(
        color: Theme.of(context).primaryColorDark,
        child: InkWell(
          child: Text(
            'maxetom',
            style: TextStyle(
              fontFamily: 'Bradley',
              fontWeight: FontWeight.bold,
              fontSize: 20,
              color: Colors.white,
              letterSpacing: 1.5,
            ),
            textAlign: TextAlign.right,
          ),
          onTap: () async {
            final url = 'http://www.maxetom.com/';
            if (await canLaunch(url)) {
              await launch(
                url,
                forceSafariVC: false,
              );
            }
          },
        ),
      ),
    );
  }
}

I used "Flutter build web" to build the release for the web version.

I'm probably missing something. Does anybody have an idea?

Thank you!

nvoigt
  • 75,013
  • 26
  • 93
  • 142
cmaxetom
  • 481
  • 4
  • 10
  • 1
    There is [issue](https://github.com/flutter/flutter/issues/55323) for that – Roman Soviak Jan 25 '21 at 16:06
  • Issue 55323 doesn't really seem to address this problem (which I just encountered). IMHO, 55323 is talking about trying to be able to basically run Safari from devtools while this question is about a particular problem--onTap doesn't seem to be working correctly when running on Safari (for what it's worth, I tried both InkWell and GestureDetector as wrappers for a container. Both work as expected on Chrome (on iPhone and on Windows) but not on iPhone+Safari. I'd report a separate issue for this but can't take the time to come up with the appropriate minimal example of the problem. – j-vasil Jun 17 '21 at 21:30

0 Answers0