diff --git a/lib/screens/activity_list_screen.dart b/lib/screens/activity_list_screen.dart index 4e79932..9def0c6 100644 --- a/lib/screens/activity_list_screen.dart +++ b/lib/screens/activity_list_screen.dart @@ -3,7 +3,6 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'publish_screen.dart'; import 'activity_detail_screen.dart'; import 'friends_screen.dart'; -import 'dart:math'; class ActivityListScreen extends StatefulWidget { @override @@ -127,24 +126,25 @@ class _ActivityListScreenState extends State { return RefreshIndicator( onRefresh: _refreshActivities, child: Padding( - padding: EdgeInsets.all(8), + padding: EdgeInsets.all(12), child: MasonryGridView.count( crossAxisCount: 2, - mainAxisSpacing: 8, - crossAxisSpacing: 8, + mainAxisSpacing: 10, + crossAxisSpacing: 10, itemCount: activities.length, itemBuilder: (context, index) { - return _buildActivityCard(activities[index]); + return _buildActivityCard(activities[index], index); }, ), ), ); } - Widget _buildActivityCard(Map activity) { - final random = Random(activity['title'].hashCode); - final height = 200.0 + random.nextInt(100); - + Widget _buildActivityCard(Map activity, int index) { + final imageHeight = index.isOdd ? 160.0 : 210.0; + final coverUrl = + 'https://picsum.photos/seed/${activity['title'].hashCode.abs()}/400/300'; + return GestureDetector( onTap: () { // 跳转到详情页 @@ -161,8 +161,8 @@ class _ActivityListScreenState extends State { borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.08), - blurRadius: 8, + color: Colors.black.withOpacity(0.06), + blurRadius: 6, offset: Offset(0, 2), ), ], @@ -173,36 +173,29 @@ class _ActivityListScreenState extends State { // 封面图片 ClipRRect( borderRadius: BorderRadius.vertical(top: Radius.circular(12)), - child: Container( - height: height, + child: SizedBox( + height: imageHeight, width: double.infinity, - color: Colors.grey[200], - child: Stack( - children: [ - Center( - child: Icon(Icons.image, size: 40, color: Colors.grey[400]), - ), - Image.network( - activity['image'], - height: height, - width: double.infinity, - fit: BoxFit.cover, - errorBuilder: (context, error, stackTrace) { - return Container( - color: Colors.grey[200], - child: Center( - child: Icon(Icons.image, size: 40, color: Colors.grey[400]), - ), - ); - }, - ), - ], + child: Image.network( + coverUrl, + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + return Container( + color: Colors.grey[200], + alignment: Alignment.center, + child: Icon( + Icons.image_outlined, + size: 40, + color: Colors.grey[400], + ), + ); + }, ), ), ), // 标题和信息 Padding( - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -210,57 +203,31 @@ class _ActivityListScreenState extends State { activity['title'], style: TextStyle( fontSize: 14, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.bold, color: Color(0xFF333333), ), maxLines: 2, overflow: TextOverflow.ellipsis, ), - SizedBox(height: 8), - Row( - children: [ - Icon(Icons.location_on, size: 14, color: Color(0xFF999999)), - SizedBox(width: 4), - Expanded( - child: Text( - activity['location'], - style: TextStyle( - fontSize: 12, - color: Color(0xFF999999), - ), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), SizedBox(height: 4), - Row( - children: [ - Icon(Icons.people, size: 14, color: Color(0xFF999999)), - SizedBox(width: 4), - Text( - '${activity['participants']}人报名', - style: TextStyle( - fontSize: 12, - color: Color(0xFF999999), - ), - ), - ], - ), - SizedBox(height: 8), Row( children: [ SizedBox( - width: 24, - height: 24, + width: 32, + height: 32, child: ClipOval( child: Image.network( - 'https://i.pravatar.cc/50?img=${activity['avatarSeed']}', + 'https://i.pravatar.cc/40?img=${activity['avatarSeed']}', fit: BoxFit.cover, errorBuilder: (context, error, stackTrace) { return Container( color: Colors.grey[200], - child: Icon(Icons.person, size: 14, color: Colors.grey[500]), + alignment: Alignment.center, + child: Icon( + Icons.person, + size: 16, + color: Colors.grey[500], + ), ); }, ), @@ -268,15 +235,25 @@ class _ActivityListScreenState extends State { ), SizedBox(width: 8), Expanded( + flex: 3, child: Text( activity['creator'], style: TextStyle( fontSize: 12, color: Color(0xFF999999), ), + maxLines: 1, overflow: TextOverflow.ellipsis, ), ), + Spacer(flex: 1), + Text( + '${activity['participants']}人', + style: TextStyle( + fontSize: 12, + color: Color(0xFFFF6B35), + ), + ), ], ), ], diff --git a/pubspec.yaml b/pubspec.yaml index a12c8d5..15270bc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: banxiang_app description: 伴享 -version: 1.1.3+5 +version: 1.1.4+6 environment: sdk: '>=3.0.0 <4.0.0' diff --git a/releases/banxiang-v1.1.4+6.apk b/releases/banxiang-v1.1.4+6.apk new file mode 100644 index 0000000..d1de6e4 Binary files /dev/null and b/releases/banxiang-v1.1.4+6.apk differ