flutter_joystick_customisable 0.3.0 copy "flutter_joystick_customisable: ^0.3.0" to clipboard
flutter_joystick_customisable: ^0.3.0 copied to clipboard

A Flutter plugin for joystick with customisable options with preferred theme color of entire parts, buttons and callback methods to handle interactions.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_joystick_customisable/flutter_joystick_customisable.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  DragInfo? _dragInfo;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container(
            color: Colors.black,
            child: Center(
                child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                Text(
                  "x: ${_dragInfo?.x ?? 0.0}, y: ${_dragInfo?.y ?? 0.0}",
                  style: const TextStyle(color: Colors.white),
                ),
                Joystick(
                    stickSize: 150,
                    enableButtonControls: true,
                    directionButtonColor: Colors.yellow,
                    dragPadColor: Colors.red,
                    onDragStart: () {
                      // You can use this callback for your business case when the stick/ball start dragging
                    },
                    onDragEnd: () {
                      // You can use this callback for your business case when the stick/ball stop dragging
                    },
                    dragCallback: (DragInfo? dragInfo) {
                      setState(() {
                        _dragInfo = dragInfo;
                      });
                    })
              ],
            ))),
      ),
    );
  }
}
6
likes
150
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for joystick with customisable options with preferred theme color of entire parts, buttons and callback methods to handle interactions.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on flutter_joystick_customisable