Guest User

Untitled

a guest
Aug 23rd, 2019
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_credit_card/flutter_credit_card.dart';
  3.  
  4. void main() => runApp(MaterialApp(
  5. home: MyApp(),
  6. ));
  7.  
  8. class MyApp extends StatefulWidget {
  9. @override
  10. _MyAppState createState() => _MyAppState();
  11. }
  12.  
  13. class _MyAppState extends State<MyApp> {
  14. double topPosition = 700;
  15. double containerHeight = 0;
  16. double containerWidth = 0;
  17.  
  18. @override
  19. Widget build(BuildContext context) {
  20. return Scaffold(
  21. floatingActionButton: FloatingActionButton.extended(
  22. onPressed: () {
  23. setState(() {
  24. containerHeight = 200;
  25. containerWidth = MediaQuery.of(context).size.width - 24 * 2;
  26. topPosition = 100;
  27. });
  28. },
  29. icon: Icon(Icons.payment),
  30. label: Text("Payment"),
  31. ),
  32. body: Stack(
  33. children: <Widget>[
  34. AnimatedPositioned(
  35. curve: Curves.elasticOut,
  36. duration: Duration(milliseconds: 2800),
  37. child: AnimatedContainer(
  38. alignment: Alignment.center,
  39. duration: Duration(milliseconds: 300),
  40. margin: EdgeInsets.symmetric(horizontal: 24.0),
  41. width: containerWidth,
  42. height: containerHeight,
  43. child: //Credit Card
  44. ),
  45. top: topPosition
  46. )
  47. ]
  48. )
  49. );
  50. }
  51. }
RAW Paste Data