Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'demo-card.dart';
  3. import 'items.dart';
  4. import 'animated-bg.dart';
  5.  
  6. void main() => runApp(AnimationDemo());
  7.  
  8. class AnimationDemo extends StatelessWidget {
  9.  
  10. @override
  11. Widget build(BuildContext context) {
  12.  
  13. return MaterialApp(
  14. title: 'Flutter Demo',
  15. theme: ThemeData(primarySwatch: Colors.deepPurple),
  16. home: MyHomePage(title: 'Flutter Animation Demo'),
  17. );
  18. }
  19. }
  20.  
  21. class MyHomePage extends StatefulWidget {
  22.  
  23. MyHomePage({Key key, this.title}) : super(key: key);
  24. final String title;
  25.  
  26. @override
  27. _MyHomePageState createState() => _MyHomePageState();
  28. }
  29.  
  30. class _MyHomePageState extends State<MyHomePage> {
  31.  
  32. ScrollController _controller = new ScrollController();
  33.  
  34. List<DemoCard> get _cards =>
  35. items.map((Item _item) => DemoCard(_item)).toList();
  36.  
  37. @override
  38. Widget build(BuildContext context) {
  39.  
  40. return Scaffold(
  41.  
  42. backgroundColor: Colors.black,
  43. appBar: AppBar(title: Text(widget.title)),
  44. body: Stack(
  45.  
  46. alignment: AlignmentDirectional.topStart,
  47. children: <Widget>[
  48.  
  49. AnimatedBackground(controller: _controller),
  50. Center(
  51. child: ListView(
  52. controller: _controller,
  53. children: _cards
  54. )
  55. )
  56. ]
  57. )
  58. );
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement