In this code i have to rotate text container. but the container rotate only one direction and than another not rotate full 360 degree.
the container move the 360 degree and smooth not more speed to rotation.
In this code i have to rotate text container. but the container rotate only one direction and than another not rotate full 360 degree.
the container move the 360 degree and smooth not more speed to rotation.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Resizable Rotatable Text Box'),
),
body: Center(
child: MyResizableTextBox(),
),
),
);
}
}
class MyResizableTextBox extends StatefulWidget {
@override
_MyResizableTextBoxState createState() => _MyResizableTextBoxState();
}
class _MyResizableTextBoxState extends State<MyResizableTextBox> {
double boxWidth = 200.0;
double boxHeight = 100.0;
double rotationAngle = 0.0;
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onScaleUpdate: (ScaleUpdateDetails details) {
setState(() {
boxWidth = 200.0 * details.scale;
boxHeight = 100.0 * details.scale;
});
},
child: Transform.rotate(
angle: rotationAngle,
child: Container(
width: boxWidth,
height: boxHeight,
decoration: BoxDecoration(
border: Border.all(color: Colors.blue, width: 2.0),
borderRadius: BorderRadius.circular(8.0),
),
child: Center(
child: Text(
'Resizable Text Box',
style: TextStyle(fontSize: 16.0),
),
),
),
),
),
GestureDetector(
onPanUpdate: (details) {
setState(() {
rotationAngle += details.delta.dx /180;
});
},
child: Icon(
Icons.rotate_left,
size: 36.0,
color: Colors.blue,
),
),
],
);
}
}
what wrong in this code.