RotateView class

create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-12-26 create_time: 17:24 describe: 可控角度旋转组件 / Controllable Angle Rotation Component

支持配置旋转角度并带动画过渡的组件 Component with configurable rotation angle and animation transition

功能特性 / Features

  • 🎯 精确控制旋转角度 / Precise angle control
  • 🎬 平滑的动画过渡 / Smooth animation transition
  • 🔄 支持动态更新角度 / Dynamic angle updates
  • ⚙️ 可自定义动画时长 / Customizable animation duration

基础示例 / Basic Example

// 简单旋转
RotateView(
  angle: 45,
  child: Icon(Icons.arrow_forward, size: 50),
)

// 动态旋转
class MyWidget extends StatefulWidget {
  @override
  _MyWidgetState createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  double angle = 0;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        RotateView(
          angle: angle,
          duration: Duration(milliseconds: 500),
          child: Icon(Icons.navigation, size: 50),
        ),
        Slider(
          value: angle,
          min: 0,
          max: 360,
          onChanged: (value) {
            setState(() => angle = value);
          },
        ),
      ],
    );
  }
}

// 箭头指示器
RotateView(
  angle: 90,
  child: Icon(Icons.arrow_upward),
)

// 自定义动画时长
RotateView(
  angle: 180,
  duration: Duration(milliseconds: 800),
  child: Container(
    width: 50,
    height: 50,
    color: Colors.blue,
  ),
)

注意事项 / Notes

  • angle 范围 0-360 度 / Angle range 0-360 degrees
  • 角度改变时会自动播放动画 / Auto-animates on angle change
  • 使用 Curves.easeOut 曲线 / Uses Curves.easeOut curve
Inheritance
Available extensions

Constructors

RotateView({Key? key, required double angle, Duration duration = const Duration(milliseconds: 300), required Widget child})
const

Properties

angle double
旋转角度 / Rotation angle
final
child Widget
子组件 / Child widget
final
duration Duration
动画时长 / Animation duration
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

blurred({double blur = 5, Color blurColor = Colors.white, BorderRadius? borderRadius, double colorOpacity = 0.5, Widget? overlay, AlignmentGeometry alignment = Alignment.center}) Blur

Available on Widget, provided by the BlurExtension extension

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RotateView>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
frosted({double blur = 5, Color frostColor = Colors.white, AlignmentGeometry alignment = Alignment.center, double? height, double? width, double frostOpacity = 0.0, BorderRadius? borderRadius, EdgeInsetsGeometry padding = EdgeInsets.zero}) Blur

Available on Widget, provided by the FrostExtension extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited