Show Profile Widget
Display the Gameball customer profile widget that contains customer details, available reward campaigns, leaderboard, and more.Basic Usage
Request Parameters
BuildContext
required
The Flutter BuildContext from your widget.
string
Unique identifier for the customer whose profile to display. Optional for guest mode.
string
Specific detail section to open (e.g., “rewards”, “profile”, “achievements”). Opens the main view by default.
Hide the navigation bar in the profile widget. Defaults to
false.bool
Show a close button in the profile widget. Defaults to
true.string
Close button color in hex format (e.g., “#FF6B6B”). Only applies if
showCloseButton is true.string
Optional session token to override the global token for this specific request. Required in upcoming SDK v4.
string
Customer mobile number, used for channel merging. Available from v3.2.0.
string
Customer email address, used for channel merging. Available from v3.2.0.
void Function(String)
Handler for links the widget tags with
gbExternalBrowser=true. When provided, the link is delegated to your app; otherwise the SDK opens it in the system browser. Available from v3.2.0.void Function(Map<String, dynamic>?, Exception?)
Receives events the widget posts, such as game completion. Called with
(null, exception) on a parse failure. Available from v3.2.0.In Flutter SDK, passing a sessionToken parameter updates the global token. Pass
null to clear, or omit to use the current global token.Validation Rules
No required fields (guest mode supported). ProvidecustomerId for authenticated profiles.
Advanced Configuration
Open Specific Section
Open a specific section of the profile widget directly:Guest Mode (v3.1.1+)
Custom Close Button
Add a custom-styled close button:Hide Navigation
Display the widget without navigation controls:Handle External Links (v3.2.0+)
Links the widget tags withgbExternalBrowser=true open in the system browser by default. Provide an externalLinkCallback to handle them yourself instead (for example, to open an in-app browser or route to a custom screen):
When
externalLinkCallback is set, the SDK delegates the link to your app and does not open the system browser.Channel Merging (v3.2.0+)
Pass the customer’smobile and email so Gameball can merge the customer’s channels:
Widget Events (v3.2.0+)
Pass awidgetEventCallback to react to events the widget posts, such as a customer finishing a game. Each event arrives as a Map<String, dynamic> with a top-level type and a nested metadata map. On a parse failure the callback is invoked with (null, exception):
gameCompleted Metadata
All
gameCompleted values arrive as String or bool. There are no numeric fields.Dismiss the Widget (v3.2.0+)
Dismiss the widget programmatically from your app. The call is a no-op when no widget is showing:window.GameballWidget.closeWidget().
Implementation Examples
Show Profile Button
Display the profile widget when user clicks a button:Bottom Navigation Integration
Integrate with bottom navigation:Floating Action Button
Add a rewards button as a floating action button:Widget Content
The profile widget displays:Customer Info
Display name, points balance, tier level, and customer status
Reward Campaigns
Available rewards, challenges, and how to earn them
Leaderboard
Customer ranking, top performers, and competitive standings
Transaction History
Points earned and redeemed history with detailed breakdown
The widget content, design, and branding can be fully customized from your Gameball dashboard.
Best Practices
1
Prominent Access
Place the profile widget button in an easily accessible location (e.g., main navigation, profile screen, bottom bar).
2
Badge Indicators
Show badge notifications when customers earn new rewards or achievements to increase engagement.
3
Deep Linking
Use the
openDetail parameter to deep link to specific sections based on user context (e.g., open rewards after purchase).4
Consistent Styling
Match the close button color with your app’s theme using
closeButtonColor for a cohesive user experience.5
Contextual Display
Show the profile widget at relevant moments (after earning points, completing challenges, or when users check their account).