flutter_smkit_ui 0.2.6
flutter_smkit_ui: ^0.2.6 copied to clipboard
Flutter Plugin for Sency's SMKitUI
flutter_smkit_ui #
A new Flutter plugin project.
Getting Started #
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
SMKitUI Flutter Plugin #
A Flutter plugin for integrating Sency's SMKitUI SDK, supporting both iOS and Android. Easily run fitness, body360, strength, cardio, and custom assessments and workouts, with unified user data and summary options.
Features #
- Start Sency assessments and custom workouts from Flutter
- Unified user data input (
gender,birthday) - Configurable
showSummaryoption for assessment results - Android/iOS platform alignment for arguments
- Example app with dropdown for assessment type and summary toggle
Getting Started #
1. Configure the Plugin #
final _smkitUiFlutterPlugin = SmkitUiFlutterPlugin();
await _smkitUiFlutterPlugin.configure(key: apiPublicKey);
2. Set Preferences (Optional) #
_smkitUiFlutterPlugin.setSessionLanguage(language: SMKitLanguage.english);
_smkitUiFlutterPlugin.setCounterPreferences(counterPreferences: SMKitCounterPreferences.perfectOnly);
_smkitUiFlutterPlugin.setEndExercisePreferences(endExercisePrefernces: SMKitEndExercisePreferences.targetBased);
3. Start an Assessment #
_smkitUiFlutterPlugin.startAssessment(
type: selectedAssessmentType, // AssessmentTypes.fitness, body360, strength, cardio, custom
userData: {
'gender': 'male', // or 'female', 'idle' (case-insensitive)
'birthday': DateTime(1990, 1, 1).millisecondsSinceEpoch,
'email': 'user@example.com', // optional
},
showSummary: showSummary, // bool
assessmentID: assessmentId, // for custom assessments
onHandle: (status) {
// Handle status updates and results
},
);
4. Start a Customized Workout or Assessment #
_smkitUiFlutterPlugin.startCustomaizedWorkout(
workout: workout,
onHandle: (status) {
// Handle workout status
},
);
_smkitUiFlutterPlugin.startCustomizedAssessment(
assessment: assessment,
onHandle: (status) {
// Handle assessment status
},
);
Example UI (from example app) #
// Dropdown for assessment type
DropdownButton<AssessmentTypes>(
value: selectedAssessmentType,
items: AssessmentTypes.values.map((type) {
return DropdownMenuItem(
value: type,
child: Text(type.name),
);
}).toList(),
onChanged: (type) {
if (type != null) {
setState(() {
selectedAssessmentType = type;
});
}
},
),
// Toggle for showSummary
Switch(
value: showSummary,
onChanged: (val) {
setState(() {
showSummary = val;
});
},
),
Platform Details #
- Android: Converts
birthdaytoage, mapsgenderstring to enum, supports both lowercase and capitalized values. - iOS: Uses
genderandbirthdaydirectly for native SDK. - Both: Accept
showSummaryargument from Flutter.
Changelog #
See CHANGELOG.md for details.
License #
MIT For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.