Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform web #13

Open
kangsudal opened this issue Apr 12, 2022 · 3 comments
Open

platform web #13

kangsudal opened this issue Apr 12, 2022 · 3 comments

Comments

@kangsudal
Copy link

kangsudal commented Apr 12, 2022

Hi. I use this shake package very well.
I made a android application with this and it works nice.
This time, I build web application with same code and it doesn't detect gesture.
I checked this package support web platform in pub.dev.
Is there some more code I should add for web?

https://github.com/kangsudal/whats_for_dinner/blob/main/lib/model/menuState.dart

class MenuState extends ChangeNotifier {
  Recipe? randomRecipe;

  MenuState() {
    ShakeDetector detector = ShakeDetector.autoStart(
      onPhoneShake: () {
        shuffle();
      },
    );
  }

  Future<void> shuffle() async {
    PersistStorage persistStorage = PersistStorage();
    int _maxIdx = await persistStorage.allRecipesLength;
    print("_maxIdx: $_maxIdx, ");
    if (_maxIdx != 0) {
      int _randomIdx = Random().nextInt(_maxIdx);
      print("_randomIdx: $_randomIdx, ");
      randomRecipe = await persistStorage.loadRecipeAt(_randomIdx);
    }else if(_maxIdx ==0){
      randomRecipe = null;
    }
    notifyListeners();
  }
}

https://whateatgo.web.app/

@deven98
Copy link
Owner

deven98 commented Apr 17, 2022

This should work with v2.1.0, can you try and let me know if it works?

@kangsudal
Copy link
Author

oh!! awesome!!!!!!
it works!
my version was ^1.0.1 so I change it to ^2.1.0 in yaml.
I appreciate your answer and this package. 😃

@kangsudal
Copy link
Author

As soon as I write this, I gave my updated web app link to others.
In device(Galaxy A50, Galaxy M12) with samsung web browser and chrome, it works very well.
But some friends said it still did't work.
One person(iphone11) uses safari so I asked her to test it in chrome and it didn't work too.
The other(Galaxy A5 2017 ) told me it works with samung web browser and doesn't work in chrome.

After some try, I found out and solve it in chrome browser in Galaxy A5:
Settings-Site settings-Motion sensors: allowed

Unfortunatelly, I can't find the setting page in iphone chrome/safari yet.
Do know where is the setting page and how to fix it in iphone?

@kangsudal kangsudal reopened this Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants