fix: v1.1.5+7 - messages/profile tab switch + home refresh animation
This commit is contained in:
parent
85c69671e8
commit
df047ad64a
@ -3,6 +3,8 @@ 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 'messages_screen.dart';
|
||||||
|
import 'profile_screen.dart';
|
||||||
|
|
||||||
class ActivityListScreen extends StatefulWidget {
|
class ActivityListScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@ -11,6 +13,7 @@ class ActivityListScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ActivityListScreenState extends State<ActivityListScreen> {
|
class _ActivityListScreenState extends State<ActivityListScreen> {
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
|
final _feedKey = GlobalKey<RefreshIndicatorState>();
|
||||||
|
|
||||||
// 模拟活动数据
|
// 模拟活动数据
|
||||||
final List<Map<String, dynamic>> activities = [
|
final List<Map<String, dynamic>> activities = [
|
||||||
@ -65,14 +68,16 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _refreshActivities() async {
|
Future<void> _refreshActivities() async {
|
||||||
await Future.delayed(Duration(seconds: 1));
|
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {});
|
setState(() {
|
||||||
|
activities.shuffle();
|
||||||
|
});
|
||||||
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
if (index == 0 && _selectedIndex == 0) {
|
if (index == 0 && _selectedIndex == 0) {
|
||||||
_refreshActivities();
|
_feedKey.currentState?.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (index == 2) {
|
if (index == 2) {
|
||||||
@ -90,6 +95,14 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (index == 3 || index == 4) {
|
||||||
|
if (_selectedIndex != index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_selectedIndex != index) {
|
if (_selectedIndex != index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedIndex = index;
|
_selectedIndex = index;
|
||||||
@ -123,7 +136,19 @@ class _ActivityListScreenState extends State<ActivityListScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
|
switch (_selectedIndex) {
|
||||||
|
case 3:
|
||||||
|
return const MessagesScreen();
|
||||||
|
case 4:
|
||||||
|
return const ProfileScreen();
|
||||||
|
default:
|
||||||
|
return _buildFeed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildFeed() {
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
|
key: _feedKey,
|
||||||
onRefresh: _refreshActivities,
|
onRefresh: _refreshActivities,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: banxiang_app
|
name: banxiang_app
|
||||||
description: 伴享
|
description: 伴享
|
||||||
version: 1.1.4+6
|
version: 1.1.5+7
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
|||||||
BIN
releases/banxiang-v1.1.5+7.apk
Normal file
BIN
releases/banxiang-v1.1.5+7.apk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user