column_card_items.dart 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart';
  2. import 'package:eye_video/framework/uikit/scrollview/overscroll_behavior.dart';
  3. import 'package:flutter/material.dart';
  4. class ColumnCardItems extends StatelessWidget {
  5. final List<Discovery> discoveryList;
  6. const ColumnCardItems({Key? key, this.discoveryList}) : super(key: key);
  7. Widget getColumnItem(BuildContext context, String coverImage, String title,
  8. String description) {
  9. return Stack(
  10. alignment: Alignment.center,
  11. children: [
  12. Container(
  13. width: MediaQuery.of(context).size.width / 2,
  14. height: 120,
  15. decoration: ShapeDecoration(
  16. image: DecorationImage(
  17. image: NetworkImage(coverImage),
  18. fit: BoxFit.cover,
  19. ),
  20. shape: RoundedRectangleBorder(
  21. borderRadius: BorderRadius.circular(5),
  22. ),
  23. ),
  24. ),
  25. Positioned(
  26. child: Column(
  27. mainAxisAlignment: MainAxisAlignment.center,
  28. children: [
  29. Text(
  30. title,
  31. style: TextStyle(
  32. fontFamily: 'NotoSansHans-Medium',
  33. fontSize: 14,
  34. color: Colors.white,
  35. ),
  36. ),
  37. Text(
  38. description,
  39. style: TextStyle(
  40. fontFamily: 'NotoSansHans-Regular',
  41. fontSize: 12,
  42. color: Colors.white,
  43. ),
  44. )
  45. ],
  46. ),
  47. ),
  48. ],
  49. );
  50. }
  51. @override
  52. Widget build(BuildContext context) {
  53. return Container(
  54. height: 220,
  55. child: ScrollConfiguration(
  56. behavior: OverScrollBehavior(),
  57. child: GridView.count(
  58. crossAxisCount: 2,
  59. scrollDirection: Axis.vertical,
  60. crossAxisSpacing: 8,
  61. shrinkWrap: true,
  62. physics: NeverScrollableScrollPhysics(),
  63. childAspectRatio: 2.0,
  64. padding: EdgeInsets.all(10),
  65. mainAxisSpacing: 8,
  66. children: discoveryList.map((discovery) {
  67. var coverImage = discovery.data.image;
  68. var title = discovery.data.title;
  69. var description = discovery.data.description;
  70. return Stack(
  71. alignment: Alignment.center,
  72. children: [
  73. Container(
  74. width: MediaQuery.of(context).size.width / 2,
  75. height: 120,
  76. decoration: ShapeDecoration(
  77. image: DecorationImage(
  78. image: NetworkImage(coverImage),
  79. fit: BoxFit.cover,
  80. ),
  81. shape: RoundedRectangleBorder(
  82. borderRadius: BorderRadius.circular(5),
  83. ),
  84. ),
  85. ),
  86. Positioned(
  87. child: Column(
  88. mainAxisAlignment: MainAxisAlignment.center,
  89. children: [
  90. Text(
  91. title,
  92. style: TextStyle(
  93. fontFamily: 'NotoSansHans-Medium',
  94. fontSize: 14,
  95. color: Colors.white,
  96. ),
  97. ),
  98. Text(
  99. description,
  100. style: TextStyle(
  101. fontFamily: 'NotoSansHans-Regular',
  102. fontSize: 12,
  103. color: Colors.white,
  104. ),
  105. )
  106. ],
  107. ),
  108. ),
  109. ],
  110. );
  111. }).toList(),
  112. ),
  113. ));
  114. }
  115. }