mirror of https://github.com/flutter/samples.git
parent
de40ba5c0a
commit
7c33a11a7b
@ -1,4 +0,0 @@
|
|||||||
Just a spinning square. That's it. Super exciting.
|
|
||||||
|
|
||||||
Original source on
|
|
||||||
[GitHub](https://github.com/flutter/flutter_web/tree/master/examples/spinning_square).
|
|
Before Width: | Height: | Size: 3.2 KiB |
@ -1,48 +0,0 @@
|
|||||||
// Copyright 2018 The Chromium 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/material.dart';
|
|
||||||
|
|
||||||
class SpinningSquare extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
_SpinningSquareState createState() => new _SpinningSquareState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SpinningSquareState extends State<SpinningSquare>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
AnimationController _animation;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
// 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.
|
|
||||||
_animation = new AnimationController(
|
|
||||||
duration: const Duration(milliseconds: 3600),
|
|
||||||
vsync: this,
|
|
||||||
)..repeat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return new RotationTransition(
|
|
||||||
turns: _animation,
|
|
||||||
child: new Container(
|
|
||||||
width: 200.0,
|
|
||||||
height: 200.0,
|
|
||||||
color: const Color(0xFF00FF00),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_animation.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
runApp(new Center(child: new SpinningSquare()));
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
# Generated by pub
|
|
||||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
|
||||||
packages:
|
|
||||||
collection:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: collection
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.14.11"
|
|
||||||
flutter:
|
|
||||||
dependency: "direct main"
|
|
||||||
description: flutter
|
|
||||||
source: sdk
|
|
||||||
version: "0.0.0"
|
|
||||||
meta:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: meta
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.8"
|
|
||||||
sky_engine:
|
|
||||||
dependency: transitive
|
|
||||||
description: flutter
|
|
||||||
source: sdk
|
|
||||||
version: "0.0.99"
|
|
||||||
typed_data:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: typed_data
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.6"
|
|
||||||
vector_math:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: vector_math
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "2.0.8"
|
|
||||||
sdks:
|
|
||||||
dart: ">=2.2.2 <3.0.0"
|
|
@ -1,11 +0,0 @@
|
|||||||
name: flutter_web.examples.spinning_square
|
|
||||||
|
|
||||||
environment:
|
|
||||||
sdk: ">=2.2.0 <3.0.0"
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
flutter:
|
|
||||||
sdk: flutter
|
|
||||||
flutter:
|
|
||||||
assets:
|
|
||||||
- preview.png
|
|
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title></title>
|
|
||||||
<script defer src="main.dart.js" type="application/javascript"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in new issue