feat: v1.1.4+6 - waterfall card visual upgrade

This commit is contained in:
Ubuntu 2026-02-17 18:12:47 +08:00
parent 81a00bd79b
commit 85c69671e8
3 changed files with 49 additions and 72 deletions

View File

@ -3,7 +3,6 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'publish_screen.dart'; import 'publish_screen.dart';
import 'activity_detail_screen.dart'; import 'activity_detail_screen.dart';
import 'friends_screen.dart'; import 'friends_screen.dart';
import 'dart:math';
class ActivityListScreen extends StatefulWidget { class ActivityListScreen extends StatefulWidget {
@override @override
@ -127,24 +126,25 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
return RefreshIndicator( return RefreshIndicator(
onRefresh: _refreshActivities, onRefresh: _refreshActivities,
child: Padding( child: Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(12),
child: MasonryGridView.count( child: MasonryGridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 8, mainAxisSpacing: 10,
crossAxisSpacing: 8, crossAxisSpacing: 10,
itemCount: activities.length, itemCount: activities.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildActivityCard(activities[index]); return _buildActivityCard(activities[index], index);
}, },
), ),
), ),
); );
} }
Widget _buildActivityCard(Map<String, dynamic> activity) { Widget _buildActivityCard(Map<String, dynamic> activity, int index) {
final random = Random(activity['title'].hashCode); final imageHeight = index.isOdd ? 160.0 : 210.0;
final height = 200.0 + random.nextInt(100); final coverUrl =
'https://picsum.photos/seed/${activity['title'].hashCode.abs()}/400/300';
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// //
@ -161,8 +161,8 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withOpacity(0.08), color: Colors.black.withOpacity(0.06),
blurRadius: 8, blurRadius: 6,
offset: Offset(0, 2), offset: Offset(0, 2),
), ),
], ],
@ -173,36 +173,29 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
// //
ClipRRect( ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)), borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
child: Container( child: SizedBox(
height: height, height: imageHeight,
width: double.infinity, width: double.infinity,
color: Colors.grey[200], child: Image.network(
child: Stack( coverUrl,
children: [ fit: BoxFit.cover,
Center( errorBuilder: (context, error, stackTrace) {
child: Icon(Icons.image, size: 40, color: Colors.grey[400]), return Container(
), color: Colors.grey[200],
Image.network( alignment: Alignment.center,
activity['image'], child: Icon(
height: height, Icons.image_outlined,
width: double.infinity, size: 40,
fit: BoxFit.cover, color: Colors.grey[400],
errorBuilder: (context, error, stackTrace) { ),
return Container( );
color: Colors.grey[200], },
child: Center(
child: Icon(Icons.image, size: 40, color: Colors.grey[400]),
),
);
},
),
],
), ),
), ),
), ),
// //
Padding( Padding(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -210,57 +203,31 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
activity['title'], activity['title'],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.bold,
color: Color(0xFF333333), color: Color(0xFF333333),
), ),
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, 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), 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( Row(
children: [ children: [
SizedBox( SizedBox(
width: 24, width: 32,
height: 24, height: 32,
child: ClipOval( child: ClipOval(
child: Image.network( child: Image.network(
'https://i.pravatar.cc/50?img=${activity['avatarSeed']}', 'https://i.pravatar.cc/40?img=${activity['avatarSeed']}',
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) { errorBuilder: (context, error, stackTrace) {
return Container( return Container(
color: Colors.grey[200], 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<ActivityListScreen> {
), ),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
flex: 3,
child: Text( child: Text(
activity['creator'], activity['creator'],
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: Color(0xFF999999), color: Color(0xFF999999),
), ),
maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
Spacer(flex: 1),
Text(
'${activity['participants']}',
style: TextStyle(
fontSize: 12,
color: Color(0xFFFF6B35),
),
),
], ],
), ),
], ],

View File

@ -1,6 +1,6 @@
name: banxiang_app name: banxiang_app
description: 伴享 description: 伴享
version: 1.1.3+5 version: 1.1.4+6
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'

Binary file not shown.