index.dart 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:get/get.dart';
  4. import 'package:get/get_core/src/get_main.dart';
  5. class Information extends StatefulWidget {
  6. const Information({Key? key}) : super(key: key);
  7. @override
  8. State<Information> createState() => _InformationState();
  9. }
  10. class _InformationState extends State<Information> {
  11. @override
  12. Widget build(BuildContext context) {
  13. return Scaffold(
  14. resizeToAvoidBottomInset: false,
  15. appBar: AppBar(
  16. title: Text('资讯'),
  17. leading: Icon(Icons.arrow_back_ios),
  18. // backgroundColor: Colors.transparent,
  19. centerTitle: true,
  20. ),
  21. body: ListView(
  22. children: [
  23. // ListTile用不好
  24. GestureDetector(
  25. child:
  26. Container(
  27. padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
  28. width: 310.w,
  29. decoration: const BoxDecoration(
  30. border:Border(
  31. bottom:
  32. BorderSide(width: 0.5, color: Color(0x20000000)
  33. // 0x17000000
  34. ))
  35. ),
  36. child: Row(
  37. children: [
  38. Container(
  39. margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
  40. width: 100,
  41. height: 100,
  42. decoration: BoxDecoration(
  43. image: DecorationImage(
  44. image: AssetImage('images/cars.png'),
  45. fit: BoxFit.cover,
  46. ),
  47. borderRadius: BorderRadius.circular(12),
  48. ),
  49. )
  50. ,
  51. Column(
  52. crossAxisAlignment: CrossAxisAlignment.start,
  53. children: [
  54. Container(
  55. width: 240.w,
  56. padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
  57. child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
  58. softWrap: true,
  59. maxLines: 2,
  60. textAlign: TextAlign.left,
  61. overflow: TextOverflow.ellipsis,
  62. style: TextStyle(
  63. fontSize: 17.sp, fontWeight: FontWeight.bold,)),
  64. ),
  65. Container(
  66. child: Text('2022-02-09'),
  67. )
  68. ],
  69. )
  70. ],
  71. )
  72. ),
  73. onTap: () {
  74. Get.toNamed('/ArticleInfo');
  75. },
  76. ),
  77. GestureDetector(
  78. child:
  79. Container(
  80. padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
  81. width: 310.w,
  82. decoration: const BoxDecoration(
  83. border:Border(
  84. bottom:
  85. BorderSide(width: 0.5, color: Color(0x20000000)
  86. // 0x17000000
  87. ))
  88. ),
  89. child: Row(
  90. children: [
  91. Container(
  92. margin: EdgeInsets.fromLTRB(15, 0, 11, 0),
  93. width: 100,
  94. height: 100,
  95. decoration: BoxDecoration(
  96. image: DecorationImage(
  97. image: AssetImage('images/cars.png'),
  98. fit: BoxFit.cover,
  99. ),
  100. borderRadius: BorderRadius.circular(12),
  101. ),
  102. )
  103. ,
  104. Column(
  105. crossAxisAlignment: CrossAxisAlignment.start,
  106. children: [
  107. Container(
  108. width: 240.w,
  109. padding: EdgeInsets.fromLTRB(0, 0, 0, 30),
  110. child: Text("我我就是一个标题,什阿三大苏打333萨达萨达萨达v么特不是",
  111. softWrap: true,
  112. maxLines: 2,
  113. textAlign: TextAlign.left,
  114. overflow: TextOverflow.ellipsis,
  115. style: TextStyle(
  116. fontSize: 17.sp, fontWeight: FontWeight.bold,)),
  117. ),
  118. Container(
  119. child: Text('2022-02-09'),
  120. )
  121. ],
  122. )
  123. ],
  124. )
  125. ),
  126. onTap: () {
  127. print('进入资讯详情');
  128. },
  129. )
  130. ],
  131. ),
  132. );
  133. }
  134. }