flutter_smkit_ui 1.3.3 copy "flutter_smkit_ui: ^1.3.3" to clipboard
flutter_smkit_ui: ^1.3.3 copied to clipboard

Flutter Plugin for Sency's SMKitUI

SMKitUI Flutter Plugin (v1.3.3) #

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, summary options, and runtime modifications.

⚠️ Breaking Changes in v1.2.8 #

Important: Preference setter methods (setSessionLanguage, setCounterPreferences, setEndExercisePreferences) no longer need to be awaited. Remove await from these calls to prevent hanging issues.

// ❌ Old way (v1.2.7 and earlier) - causes hanging
await _smkitUiFlutterPlugin.setSessionLanguage(language: SMKitLanguage.english);

// ✅ New way (v1.2.8+) - fire-and-forget
_smkitUiFlutterPlugin.setSessionLanguage(language: SMKitLanguage.english);

Features #

  • Start Sency assessments and custom workouts from Flutter
  • Unified user data input (gender, birthday)
  • Configurable showSummary option for assessment results
  • Android/iOS platform alignment for arguments
  • Example app with dropdown for assessment type and summary toggle
  • Android 15 & 16 Support: Full compatibility with Android 15 and Android 16 (API 36) including 16KB page size requirements
  • Modern Build Tools: Updated to latest Gradle, Kotlin 2.0, and Android Gradle Plugin for optimal performance
  • Color Theme Customization (v1.3.3+): Customize UI theme colors via primaryColor in modifications
  • Phone Calibration Control (v1.3.3+): Control phone calibration screen visibility via phoneCalibration settings

Getting Started #

1. Configure the Plugin #

final _smkitUiFlutterPlugin = SmkitUiFlutterPlugin();
await _smkitUiFlutterPlugin.configure(key: apiPublicKey);

2. Set Preferences (Optional) #

// Fire-and-forget calls - no need to await
_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
	modifications: { // optional runtime configuration
		'primaryColor': '#4CAF50', // UI theme color (green, blue, orange, purple, red, silver, gold, pink)
		'phoneCalibration': { // optional phone calibration settings
			'enabled': true, // Show/hide calibration screen
			'autoCalibrate': false,
			'calibrationSensitivity': 0.8,
		},
		// Exercise-specific parameters can also be included here
		'key': 'value',
	},
	onHandle: (status) {
		// Handle status updates and results
	},
);

4. Start a Customized Workout or Assessment #

_smkitUiFlutterPlugin.startCustomaizedWorkout(
	workout: workout,
	modifications: { // optional runtime configuration
		'primaryColor': '#2196F3', // UI theme color
		'phoneCalibration': {
			'enabled': true,
		},
		// Exercise-specific parameters
		'key': 'value',
	},
	onHandle: (status) {
		// Handle workout status
	},
);

_smkitUiFlutterPlugin.startCustomizedAssessment(
	assessment: assessment,
	modifications: { // optional runtime configuration
		'primaryColor': '#FF9800', // UI theme color
		'phoneCalibration': {
			'enabled': false, // Skip calibration screen
		},
		// Exercise-specific parameters
		'key': 'value',
	},
	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;
		});
	},
),

Migration Guide #

From v1.2.7 to v1.2.8 #

  1. Remove await from preference setters to prevent hanging:

    // Before (v1.2.7)
    await _smkitUiFlutterPlugin.setSessionLanguage(language: SMKitLanguage.english);
       
    // After (v1.2.8)
    _smkitUiFlutterPlugin.setSessionLanguage(language: SMKitLanguage.english);
    
  2. Benefits of this change:

    • Eliminates timeout issues during assessment startup
    • Faster assessment initialization
    • More reliable custom assessment launching
    • Better error handling and debugging

Platform Details #

  • Android: Converts birthday to age, maps gender string to enum, supports both lowercase and capitalized values.
  • iOS: Uses gender and birthday directly for native SDK.
  • Both: Accept showSummary argument from Flutter.
  • Color Themes (v1.3.3+): Supports 8 predefined themes: green, blue, orange, purple, red (maps to orange), silver, gold, and pink. Set via primaryColor hex code in modifications.
  • Phone Calibration (v1.3.3+): Control calibration screen visibility via phoneCalibration.enabled in modifications. Default is true.

Requirements #

  • Flutter: 3.3.0 or higher
  • Dart: 3.3.4 or higher
  • Android:
    • Minimum SDK: 26 (Android 8.0)
    • Compile SDK: 36 (Android 16)
    • Target SDK: 35 (Android 15)
    • Gradle: 8.11.1+
    • Kotlin: 2.0.21
    • Java: 17
  • iOS:
    • Minimum version: 16.0
    • Check additional requirements in native SDK documentation

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.

2
likes
120
points
296
downloads

Publisher

verified publishersency.ai

Weekly Downloads

Flutter Plugin for Sency's SMKitUI

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_smkit_ui

Packages that implement flutter_smkit_ui