rotate_x 0.0.4 copy "rotate_x: ^0.0.4" to clipboard
rotate_x: ^0.0.4 copied to clipboard

rotating an image must be easy as x.

example/lib/main.dart

import 'dart:math';

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'RotateX Example',
      home: RotateXExample(),
    );
  }
}

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

  @override
  State<RotateXExample> createState() => _RotateXExampleState();
}

class _RotateXExampleState extends State<RotateXExample> {
  double sliderValue = 0.5;
  RotateXController controller = RotateXController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('RotateX Example'),
      ),
      body: Column(
        children: [
          RotateX(
            image: Image.network(
              'https://picsum.photos/300/500',
            ),
            controller: controller,
            scaleFollowsRotation: true,
          ),
          Slider(
            value: sliderValue,
            onChanged: (value) {
              // setState(() {
              controller.angle = (value * 0.5 * pi) - (pi / 4);
              setState(() => sliderValue = value);
              // sliderValue = value;
              // });
            },
          ),
          TextButton(
            onPressed: () {
              controller.angle = 0;
              setState(() => sliderValue = 0.5);
            },
            child: const Text('Reset'),
          ),
          TextButton(
            onPressed: controller.save,
            child: const Text('Save'),
          )
        ],
      ),
    );
  }
}
1
likes
150
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

rotating an image must be easy as x.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

equatable, flutter, vector_math

More

Packages that depend on rotate_x