rotation_three_d_effect 0.2.0 copy "rotation_three_d_effect: ^0.2.0" to clipboard
rotation_three_d_effect: ^0.2.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/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(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Rotation3DEffect.limitedReturnsInPlace(
                      child: const Text(
                    'Hello 3D Rotation! \n(Returns in place)',
                    style: TextStyle(fontSize: 35),
                  )),
                  const SizedBox(
                    height: 50,
                  ),
                  Rotation3DEffect.limited(
                    maximumPan: 80,
                    child: FilledButton.tonal(
                        onPressed: () {},
                        child: const Text(
                            "Limited 3D Rotation (No return in place)")),
                  ),
                  const SizedBox(
                    height: 50,
                  ),
                  const Text("Unrestriced 3D Rotation"),
                  Rotation3DEffect(
                      child: const FlutterLogo(
                    size: 150,
                  )),
                  const SizedBox(
                    height: 50,
                  ),
                  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")),
                      ),
                    ),
                  ),
                  const SizedBox(height: 50),
                  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,
                      )),
                  const SizedBox(height: 50),
                  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),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
6
likes
160
pub points
53%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on rotation_three_d_effect