Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'dart:math' as math;
  3.  
  4. class AnimatedBackground extends StatefulWidget {
  5.  
  6. AnimatedBackground({Key key, this.controller}) : super(key: key);
  7.  
  8. final ScrollController controller;
  9.  
  10. @override
  11. _AnimatedBackgroundState createState() => _AnimatedBackgroundState();
  12. }
  13.  
  14. class _AnimatedBackgroundState extends State<AnimatedBackground> {
  15.  
  16. get offset => widget.controller.hasClients ? widget.controller.offset : 0;
  17.  
  18. @override
  19. Widget build(BuildContext context) {
  20.  
  21. return AnimatedBuilder(
  22.  
  23. animation: widget.controller,
  24. builder: (BuildContext context, Widget child) {
  25.  
  26. return OverflowBox(
  27.  
  28. maxWidth: double.infinity,
  29. alignment: Alignment(4, 3),
  30. child: Transform.rotate(
  31. angle: ((math.pi * offset) / -1024),
  32. child: Icon(Icons.settings, size: 512, color: Colors.white)
  33. )
  34. );
  35. }
  36. );
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement