thinksys_mediapipe_plugin 0.0.12 copy "thinksys_mediapipe_plugin: ^0.0.12" to clipboard
thinksys_mediapipe_plugin: ^0.0.12 copied to clipboard

PlatformiOS

Add motion-based magic to your Flutter apps! ThinkSys Mediapipe Plugin offers real-time pose detection for iOS, with easy integration, customizable options, and endless possibilities for fitness, heal [...]

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:thinksys_mediapipe_plugin/pose_detection.dart';
import 'package:thinksys_mediapipe_plugin_example/pose_example/landmarks_filter_options.dart';

void main() {
  runApp(const MyHomePage());
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: PoseExample(),
    );
  }
}

class PoseExample extends StatefulWidget {
  const PoseExample({super.key});

  @override
  State<PoseExample> createState() => _PoseExampleState();
}

class _PoseExampleState extends State<PoseExample> {
  PoseLandmarkOptions options = PoseLandmarkOptions(
      face: true, leftArm: true, rightArm: true, leftLeg: true, torso: true, rightLeg: true);

  void _updateFilters(String key, bool value) {
    switch (key) {
      case "face":
        options.face = value;
        break;
      case "leftArm":
        options.leftArm = value;
        break;
      case "rightArm":
        options.rightArm = value;
        break;
      case "torso":
        options.torso = value;
        break;
      case "leftLeg":
        options.leftLeg = value;
        break;
      case "rightLeg":
        options.rightLeg = value;
        break;
      case "rightWrist":
        options.rightWrist = value;
        break;
      case "leftWrist":
        options.leftWrist = value;
        break;
      case "rightAnkle":
        options.rightAnkle = value;
        break;
      case "leftAnkle":
        options.leftAnkle = value;
        break;
    }
    setState(() {
      // print("Updated key : $key, $value");
    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
          appBar: AppBar(
            title: const Text("Camera View"),
            actions: [
              GestureDetector(
                  onTap: () {
                    Navigator.of(context).push(CupertinoPageRoute(
                        builder: (_) => LandmarksFilterOptions(
                              onFilterChange: _updateFilters,
                              defaultFilters: options.toJson(),
                            )));
                  },
                  child: const Icon(Icons.settings_input_component_sharp))
            ],
          ),
          body: poseLandmarks()),
    );
  }

  Widget poseLandmarks() {
    return OrientationBuilder(builder: (_, orientation) {
      return PoseLandmarks(
        key: UniqueKey(),
        options: PoseLandmarkOptions(
            cameraFacing: CameraFacing.front,
            cameraOrientation: orientation == Orientation.portrait
                ? CameraOrientation.portrait
                : CameraOrientation.landscape,
            face: true,
            leftLeg: true,
            rightLeg: true,
            leftArm: true,
            rightArm: true,
            torso: true,
            rightAnkle: true,
            leftAnkle: true,
            rightWrist: true,
            leftWrist: true),
        poseLandmarks: (value) {
          //  print("Received Landmarks : $value");
        },
      );
    });
  }
}
15
likes
110
points
41
downloads

Publisher

verified publisherthinksys.com

Weekly Downloads

Add motion-based magic to your Flutter apps! ThinkSys Mediapipe Plugin offers real-time pose detection for iOS, with easy integration, customizable options, and endless possibilities for fitness, healthcare, and more.

Repository (GitHub)
View/report issues

Topics

#mediapipe #pose-detection

Documentation

API reference

License

unknown (license)

Dependencies

equatable, flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on thinksys_mediapipe_plugin