본문 바로가기

Flutter-플러터/플러터 공부

Getx Getview를 활용한 애니메이션

반응형

복붙임

class HomePageController extends GetxController
    with GetSingleTickerProviderStateMixin {
  final Duration duration = const Duration(milliseconds: 300);
  AnimationController animationController;
  @override
  void onInit() {
    super.onInit();
    animationController = AnimationController(vsync: this, duration: duration);
  }
}

 

 

class HomePage extends GetView 
  @override
  Widget build(BuildContext context) {
// access animation controller on this page with controller.animationController
     return Container();
  } 
}

 

Future initAnimationController() async {
    animationController = AnimationController(vsync: this, duration: duration);
  }

 

 

 

 

방법 2 

 

class HomePage extends GetView with SingleGetTickerProviderMixin {
}

https://copyprogramming.com/howto/basic-way-to-implement-of-animation-in-flutter#flutter-how-to-implement-animation-inside-class-getviewcontrollergt

 

 

https://ithelp.ithome.com.tw/articles/10266087?sc=rss.iron

 

반응형