FLUTTER ECOSYSTEM

MisterJimson/animated_rotation

用於旋轉的隱式動畫組件

animated_rotation 專案封面
Stars
11
Forks
3
最近推送(UTC)
2021年3月4日
專案狀態
未封存
Jason Rai GitHub avatar
GITHUB User

Jason Rai ↗

Code

Toronto
語言DartSwiftKotlinObjective-C

技術主題

此儲存庫發佈的套件

使用的依賴

依賴清單 2 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

AnimatedRotation pub package

An implicitly animated version of RotationTransition which automatically transitions the rotation over time when the provided angle changes.

Check it out on DartPad

Install

Get it from pub. Add the dependency to your pubspec.yaml

dependencies:
  animated_rotation: ^1.0.0

Run flutter pub get in your root folder after saving the pubspec.yaml file

Usage

Here is an example of the counter app with text rotating based on the count

import 'package:animated_rotation/animated_rotation.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyHomePage());

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("AnimatedRotation example"),
        ),
        body: Center(
          child: AnimatedRotation(
            angle: _counter,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(
                  'You have pushed the button this many times:',
                ),
                Text(
                  '$_counter',
                  style: Theme.of(context).textTheme.display1,
                ),
              ],
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _counter++;
            });
          },
          tooltip: 'Increment',
          child: Icon(Icons.add),
        ),
      ),
    );
  }
}
Example image

https://raw.githubusercontent.com/MisterJimson/animated_rotation/master/.media/example.png

Example gif

https://raw.githubusercontent.com/MisterJimson/animated_rotation/master/.media/example.gif