import 'dart:math'; import 'package:flutter/material.dart'; class GestureRotateWidget extends StatefulWidget { @override _GestureRotateWidgetState createState() => _GestureRotateWidgetState(); } class _GestureRotateWidgetState extends State { double _scale = 1.0; Offset _offset = Offset.zero; double _rotation = 0.0; void _updateRotation(double rotation) { setState(() { _rotation = rotation; print('Döndürme: $_rotation'); }); } @override Widget build(BuildContext context) { return GestureDetector( onScaleStart: (details) { if (details.pointerCount == 1) { print('Döndürme başlangıcı'); } else { print('Taşıma ve Yakınlaştırma başlangıcı'); } }, onScaleUpdate: (details) { if (details.pointerCount == 1) { // Tek parmakla döndürme hesabı Offset center = details.localFocalPoint; Offset focalPoint = details.focalPoint; double rotation = atan2( focalPoint.dy - center.dy, focalPoint.dx - center.dx, ); _updateRotation(rotation * 180 / pi); } else { // Çift parmakla taşıma ve yakınlaştırma hesabı setState(() { _scale = details.scale; _offset += details.focalPoint - details.localFocalPoint; print('Yakınlaştırma: $_scale, Taşıma: $_offset'); }); } }, child: // Transform.scale( // scale: _scale, // child: Transform.rotate( // angle: _rotation * // (pi / 180), // Radyan cinsinden dönüş açısını ayarlayın // child: Container( width: 200, height: 200, color: Colors.blue, child: Center( child: Text('Döndür!'), // ), // ), ), ), ); } }