rotatable_overlay 0.0.11 copy "rotatable_overlay: ^0.0.11" to clipboard
rotatable_overlay: ^0.0.11 copied to clipboard

A flutter widget that makes its child rotatable by dragging around its center.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: RotatableOverlay(
              snaps: [
                Angle.degrees(0),
                Angle.degrees(90),
                Angle.degrees(180),
                Angle.degrees(270),
              ],
              snapDelta: Angle.degrees(5),
              shouldSnapOnEnd: true,
              shouldUseRelativeSnapDuration: true,
              child: Stack(
                alignment: Alignment.center,
                children: [
                  Container(
                    height: 150,
                    width: 150,
                    color: Colors.green,
                  ),
                  const Positioned(
                    top: 0,
                    child: Text(
                      'N',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  const Positioned(
                    right: 0,
                    child: Text(
                      'E',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  const Positioned(
                    left: 0,
                    child: Text(
                      'W',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  const Positioned(
                    bottom: 0,
                    child: Text(
                      'S',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
copied to clipboard
3
likes
160
points
48
downloads

Publisher

verified publisherdaniel-riffert.com

Weekly Downloads

2024.09.26 - 2025.04.10

A flutter widget that makes its child rotatable by dragging around its center.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

angle_utils, flutter

More

Packages that depend on rotatable_overlay