Advertisement
narimetisaigopi

flip card

Nov 15th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. import 'package:flip_card/flip_card.dart';
  2. import 'package:flutter/material.dart';
  3.  
  4. class WayToScreen extends StatelessWidget {
  5. GlobalKey<FlipCardState> cardKey = GlobalKey<FlipCardState>();
  6.  
  7. @override
  8. Widget build(BuildContext context) {
  9. return Stack(
  10. children: [
  11. GestureDetector(
  12. onVerticalDragUpdate: (details) {
  13. int sensitivity = 8;
  14. if (details.delta.dy > sensitivity) {
  15. // Down Swipe
  16. // --
  17. cardKey.currentState!.toggleCard();
  18. } else if (details.delta.dy < -sensitivity) {
  19. // Up Swipe
  20. //++
  21. cardKey.currentState!.toggleCard();
  22. }
  23. },
  24. child: FlipCard(
  25. key: cardKey,
  26. flipOnTouch: false,
  27. direction: FlipDirection.VERTICAL,
  28. front: InkWell(
  29. // onTap: () {
  30. // cardKey.currentState!.toggleCard();
  31. // },
  32. child: Container(
  33. width: MediaQuery.of(context).size.width,
  34. height: MediaQuery.of(context).size.height,
  35. color: Colors.green,
  36. ),
  37. ),
  38. back: InkWell(
  39. // onTap: () {
  40. // cardKey.currentState!.toggleCard();
  41. // },
  42. child: Container(
  43. width: MediaQuery.of(context).size.width,
  44. height: MediaQuery.of(context).size.height,
  45. color: Colors.amber,
  46. ),
  47. ),
  48. ),
  49. ),
  50. Positioned(
  51. right: 10,
  52. bottom: 150,
  53. child: Column(
  54. children: [
  55. Icon(Icons.favorite),
  56. Icon(Icons.favorite),
  57. Icon(Icons.favorite),
  58. Icon(Icons.favorite),
  59. Icon(Icons.favorite),
  60. ],
  61. ),
  62. ),
  63. ],
  64. );
  65. }
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement