fix: v1.1.3+5 - profile/messages click + home refresh

This commit is contained in:
Ubuntu 2026-02-17 17:44:55 +08:00
parent 77e6315c5b
commit 81a00bd79b
5 changed files with 98 additions and 82 deletions

View File

@ -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,10 +91,12 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
);
return;
}
if (_selectedIndex != index) {
setState(() {
_selectedIndex = index;
});
}
}
@override
Widget build(BuildContext context) {
@ -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(

View File

@ -22,24 +22,29 @@ 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: 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: [
CircleAvatar(
@ -109,6 +114,8 @@ class MessagesScreen extends StatelessWidget {
],
),
),
),
),
);
}
}

View File

@ -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

View File

@ -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'

Binary file not shown.