games_services 2.0.8 games_services: ^2.0.8 copied to clipboard
A new Flutter plugin to support game center and google play games services.
A Flutter plugin to support game center and google play games services.
Screenshot #
iOS
Android
Tutorials #
Video tutorial Will be added soon.
Apps #
Monkey Banana Android & iOS by Abedalkareem.
Nonogram Colors by @tommybuonomo.
Ripple Effect Puzzle by @tommybuonomo.
Lights: A Memory Game Android & iOS by @theLee3.
Usage #
Sign in
Sign in the user to the Game center (iOS) or Google play games services (Android). You should call the sign in before making any action (like sending a score or unlocking an achievement).
GamesServices.signIn();
Is Signed In
A boolean value to check to see if the user is currently signed into Game Center or Google Play Services.
GamesServices.isSignedIn;
Sign out
To sign the user out of Goole Play Services. After calling, you can no longer make any actions on the user's account.
GamesServices.signOut();
Show achievements
To show the achievements screen.
GamesServices.showAchievements();
Show leaderboards
To show the leaderboards screen. It takes the leaderbord id for android and iOS.
GamesServices.showLeaderboards(iOSLeaderboardID: 'ios_leaderboard_id', androidLeaderboardID: 'android_leaderboard_id');
Submit score
To submit a Score
to specific leaderboard.
-The Score
class takes three parameters:
-androidLeaderboardID
: the leader board id that you want to send the score for in case of android.
-iOSLeaderboardID
the leader board id that you want to send the score for in case of iOS.
-value
the score.
GamesServices.submitScore(score: Score(androidLeaderboardID: 'android_leaderboard_id',
iOSLeaderboardID: 'ios_leaderboard_id',
value: 5));
Unlock achievement
To unlock an Achievement
.
The Achievement
takes three parameters:
-androidID
the achievement id for android.
-iOSID
the achievement id for iOS.
-percentComplete
the completion percent of the achievement, this parameter is optional in case of iOS.
-steps
the achievement steps for Android.
GamesServices.unlock(achievement: Achievement(androidID: 'android_id',
iOSID: 'ios_id',
percentComplete: 100,
steps: 2));
Increment (Android Only)
To increment the steps for android achievement.
final result = await GamesServices.increment(achievement: Achievement(androidID: 'android_id', steps: 50));
print(result);
Show AccessPoint (iOS Only)
To show the access point you can call the following function:
GamesServices.showAccessPoint(AccessPointLocation.topLeading);
This feature support only on the iOS, on Android there is nothing like this supported natively.
Hide AccessPoint (iOS Only)
To hide the access point.
GamesServices.hideAccessPoint();
Player id
To get the player you can call:
final playerID = GamesServices.getPlayerID();
Player name
To get the player name can call:
final playerID = GamesServices.getPlayerName();
Installing #
Simply add the following line to your pubspec.yaml file:
dependencies:
games_services: any # <-- Add this line
Support me 🚀 #
You can support this project by:
1- Checking my apps.
2- Star the repo.
3- Share the repo with your friends.