fix: v1.1.3+5 - profile/messages click + home refresh
This commit is contained in:
parent
77e6315c5b
commit
81a00bd79b
@ -65,7 +65,17 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
||||
},
|
||||
];
|
||||
|
||||
Future<void> _refreshActivities() async {
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
if (index == 0 && _selectedIndex == 0) {
|
||||
_refreshActivities();
|
||||
return;
|
||||
}
|
||||
if (index == 2) {
|
||||
// 中间按钮 - 跳转到发布页面
|
||||
Navigator.push(
|
||||
@ -81,9 +91,11 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
if (_selectedIndex != index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -113,10 +125,7 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
||||
|
||||
Widget _buildBody() {
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
setState(() {});
|
||||
},
|
||||
onRefresh: _refreshActivities,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: MasonryGridView.count(
|
||||
|
||||
@ -22,91 +22,98 @@ class MessagesScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: _mockMessages.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, index) => _buildMessageTile(_mockMessages[index]),
|
||||
itemBuilder: (context, index) => _buildMessageTile(context, _mockMessages[index]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMessageTile(Map<String, dynamic> message) {
|
||||
Widget _buildMessageTile(BuildContext context, Map<String, dynamic> message) {
|
||||
final unread = message['unread'] as int;
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
onTap: () {
|
||||
// TODO: 跳转会话详情页
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: const Color(0xFFFFE7CF),
|
||||
backgroundImage: NetworkImage('https://i.pravatar.cc/50?img=${message['avatar']}'),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
message['name'] as String,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
message['preview'] as String,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF8A8A8A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(const SnackBar(content: Text('功能开发中,敬请期待')));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
message['time'] as String,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF999999),
|
||||
CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: const Color(0xFFFFE7CF),
|
||||
backgroundImage: NetworkImage('https://i.pravatar.cc/50?img=${message['avatar']}'),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
message['name'] as String,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
message['preview'] as String,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF8A8A8A),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
unread > 0
|
||||
? Container(
|
||||
width: 18,
|
||||
height: 18,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFFF4D4F),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'$unread',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(height: 18),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
message['time'] as String,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
unread > 0
|
||||
? Container(
|
||||
width: 18,
|
||||
height: 18,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFFF4D4F),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'$unread',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(height: 18),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -41,11 +41,11 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
|
||||
Future<void> _openProfileSetup() async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => const ProfileSetupScreen()),
|
||||
);
|
||||
_loadProfile();
|
||||
if (!mounted) return;
|
||||
await _loadProfile();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
name: banxiang_app
|
||||
description: 伴享
|
||||
version: 1.1.2+4
|
||||
version: 1.1.3+5
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
|
||||
BIN
releases/banxiang-v1.1.3+5.apk
Normal file
BIN
releases/banxiang-v1.1.3+5.apk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user