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) { void _onItemTapped(int index) {
if (index == 0 && _selectedIndex == 0) {
_refreshActivities();
return;
}
if (index == 2) { if (index == 2) {
// - // -
Navigator.push( Navigator.push(
@ -81,10 +91,12 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
); );
return; return;
} }
if (_selectedIndex != index) {
setState(() { setState(() {
_selectedIndex = index; _selectedIndex = index;
}); });
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -113,10 +125,7 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
Widget _buildBody() { Widget _buildBody() {
return RefreshIndicator( return RefreshIndicator(
onRefresh: () async { onRefresh: _refreshActivities,
await Future.delayed(Duration(seconds: 1));
setState(() {});
},
child: Padding( child: Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: MasonryGridView.count( child: MasonryGridView.count(

View File

@ -22,24 +22,29 @@ class MessagesScreen extends StatelessWidget {
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
itemCount: _mockMessages.length, itemCount: _mockMessages.length,
separatorBuilder: (_, __) => const SizedBox(height: 10), 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; final unread = message['unread'] as int;
return InkWell( return Material(
borderRadius: BorderRadius.circular(14), color: Colors.transparent,
onTap: () { child: Ink(
// TODO:
},
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(14), 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( child: Row(
children: [ children: [
CircleAvatar( CircleAvatar(
@ -109,6 +114,8 @@ class MessagesScreen extends StatelessWidget {
], ],
), ),
), ),
),
),
); );
} }
} }

View File

@ -41,11 +41,11 @@ class _ProfileScreenState extends State<ProfileScreen> {
} }
Future<void> _openProfileSetup() async { Future<void> _openProfileSetup() async {
await Navigator.push( await Navigator.of(context).push(
context,
MaterialPageRoute(builder: (_) => const ProfileSetupScreen()), MaterialPageRoute(builder: (_) => const ProfileSetupScreen()),
); );
_loadProfile(); if (!mounted) return;
await _loadProfile();
} }
@override @override

View File

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

Binary file not shown.