Download flutter/examples/layers/widgets/spinning_square.dart from luom2645/agent-workspace: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/examples/layers/widgets/spinning_square.dart
- Command line
-
hf download hf://luom2645/agent-workspace/flutter/examples/layers/widgets/spinning_square.dart
-
curl -L -o spinning_square.dart https://huggingface.co/luom2645/agent-workspace/resolve/main/flutter/examples/layers/widgets/spinning_square.dart
1.18 kB
| // Copyright 2014 The Flutter Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| import 'package:flutter/widgets.dart'; | |
| class SpinningSquare extends StatefulWidget { | |
| const SpinningSquare({super.key}); | |
| State<SpinningSquare> createState() => _SpinningSquareState(); | |
| } | |
| class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin { | |
| // We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0 | |
| // represents an entire turn of the square whereas in the other examples | |
| // we used 0.0 -> math.pi, which is only half a turn. | |
| late final AnimationController _animation = AnimationController( | |
| duration: const Duration(milliseconds: 3600), | |
| vsync: this, | |
| )..repeat(); | |
| void dispose() { | |
| _animation.dispose(); | |
| super.dispose(); | |
| } | |
| Widget build(BuildContext context) { | |
| return RotationTransition( | |
| turns: _animation, | |
| child: Container(width: 200.0, height: 200.0, color: const Color(0xFF00FF00)), | |
| ); | |
| } | |
| } | |
| void main() { | |
| runApp(const Center(child: SpinningSquare())); | |
| } | |