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/
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
https://whateatgo.web.app/