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

A Flutter package inspired by SwiftUI's rotation3DEffect that allows to apply a Three Dimensional rotation to any Widget.

example/main.dart

import 'package:flutter/material.dart';
import 'package:rotation_three_d_effect/indefinite_rotation_three_d_effect.dart';
import 'package:rotation_three_d_effect/rotation_three_d_effect.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SafeArea(
          bottom: false,
          child: Center(
            child: SingleChildScrollView(
              child: Column(
                spacing: 50,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  const SizedBox(
                    height: 20,
                  ),
                  IndefiniteRotation3DEffect(
                    rotateY: true,
                    rotateX: false,
                    rotationCount: 10,
                    allowUserRotation: true,
                    rotationDuration: const Duration(seconds: 5),
                    child: FilledButton.tonal(
                      onPressed: () {},
                      child: const Text(
                        "Indefinite Continous Rotation",
                      ),
                    ),
                  ),
                  Rotation3DEffect.limitedReturnsInPlace(
                    child: const Text(
                      'Hello 3D Rotation! \n(Returns in place)',
                      style: TextStyle(fontSize: 35),
                    ),
                  ),
                  Rotation3DEffect.limited(
                    maximumPan: 80,
                    child: FilledButton.tonal(
                      onPressed: () {},
                      child: const Text(
                        "Limited 3D Rotation (No return in place)",
                      ),
                    ),
                  ),
                  const Text("Unrestriced 3D Rotation"),
                  Rotation3DEffect(child: const FlutterLogo(size: 150)),
                  Rotation3DEffect(
                    maximumPan: 90,
                    returnsInPlace: true,
                    returnInPlaceDuration: const Duration(seconds: 1),
                    child: Card(
                      elevation: 6,
                      color: Colors.amber[300],
                      shadowColor: Colors.black,
                      child: const SizedBox(
                        height: 160,
                        width: 300,
                        child: Center(child: Text("Rotating Card")),
                      ),
                    ),
                  ),
                  Rotation3DEffect.limitedReturnsInPlace(
                    initalPosition: const Offset(21, 50),
                    child: const Text(
                      '3D Rotation with\nWith inital offset! \n(Returns in place)',
                      style: TextStyle(fontSize: 25),
                      textAlign: TextAlign.center,
                    ),
                  ),
                  Rotation3DEffect(
                    maximumPan: 90,
                    returnsInPlace: true,
                    returnInPlaceDuration: const Duration(milliseconds: 200),
                    initalPosition: const Offset(45, 90),
                    endPosition: const Offset(45, 90),
                    child: const Card(
                      elevation: 6,
                      color: Colors.green,
                      shadowColor: Colors.black,
                      child: SizedBox(
                        height: 160,
                        width: 300,
                        child: Center(
                          child: Text(
                            "Rotating Card\nInitial and end pos:\nx: 45, y: 90",
                          ),
                        ),
                      ),
                    ),
                  ),
                  const SizedBox(height: 150),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
14
likes
0
points
7
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package inspired by SwiftUI's rotation3DEffect that allows to apply a Three Dimensional rotation to any Widget.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on rotation_three_d_effect