diff --git a/lib/screens/activity_list_screen.dart b/lib/screens/activity_list_screen.dart index 8f8b596..f87fc27 100644 --- a/lib/screens/activity_list_screen.dart +++ b/lib/screens/activity_list_screen.dart @@ -13,6 +13,7 @@ class ActivityListScreen extends StatefulWidget { class _ActivityListScreenState extends State { int _selectedIndex = 0; + bool _showFriendsOverlay = false; final _feedKey = GlobalKey(); String? _selectedTime; @@ -83,10 +84,6 @@ class _ActivityListScreenState extends State { } void _onItemTapped(int index) { - if (index == 0 && _selectedIndex == 0) { - _feedKey.currentState?.show(); - return; - } if (index == 2) { // 中间按钮 - 跳转到发布页面 Navigator.push( @@ -95,24 +92,26 @@ class _ActivityListScreenState extends State { ); return; } + if (index == 1) { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const FriendsScreen()), - ); + setState(() { + _showFriendsOverlay = !_showFriendsOverlay; + if (_showFriendsOverlay) { + _selectedIndex = 0; + } + }); return; } - if (index == 3 || index == 4) { - if (_selectedIndex != index) { - setState(() { - _selectedIndex = index; - }); - } + + if (index == 0 && _selectedIndex == 0 && !_showFriendsOverlay) { + _feedKey.currentState?.show(); return; } - if (_selectedIndex != index) { + + if (_selectedIndex != index || _showFriendsOverlay) { setState(() { _selectedIndex = index; + _showFriendsOverlay = false; }); } } @@ -123,27 +122,29 @@ class _ActivityListScreenState extends State { if (_selectedIndex == 3 || _selectedIndex == 4) { return Scaffold( backgroundColor: const Color(0xFFFFF8F0), - body: _buildBody(), + body: _buildBodyWithFriendsOverlay(), bottomNavigationBar: _buildBottomNavigationBar(), ); } return Scaffold( backgroundColor: const Color(0xFFFFF8F0), - appBar: AppBar( - title: Text('伴享', style: TextStyle(fontWeight: FontWeight.bold)), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(Icons.search), - onPressed: () {}, - ), - IconButton( - icon: Icon(Icons.notifications_none), - onPressed: () {}, - ), - ], - ), - body: _buildBody(), + appBar: _showFriendsOverlay + ? null + : AppBar( + title: Text('伴享', style: TextStyle(fontWeight: FontWeight.bold)), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(Icons.search), + onPressed: () {}, + ), + IconButton( + icon: Icon(Icons.notifications_none), + onPressed: () {}, + ), + ], + ), + body: _buildBodyWithFriendsOverlay(), bottomNavigationBar: _buildBottomNavigationBar(), floatingActionButton: _buildFloatingActionButton(), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, @@ -161,6 +162,15 @@ class _ActivityListScreenState extends State { } } + Widget _buildBodyWithFriendsOverlay() { + return Stack( + children: [ + _buildBody(), + if (_showFriendsOverlay) const Positioned.fill(child: FriendsScreen()), + ], + ); + } + Widget _buildFeed() { final filteredActivities = _getFilteredActivities(); return RefreshIndicator( @@ -413,7 +423,7 @@ class _ActivityListScreenState extends State { } Widget _buildNavItem(int index, IconData icon, String label) { - final isSelected = _selectedIndex == index; + final isSelected = index == 1 ? _showFriendsOverlay : _selectedIndex == index; return Expanded( child: GestureDetector( onTap: () => _onItemTapped(index), diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart index 7aa75f2..9c9bfcf 100644 --- a/lib/screens/main_screen.dart +++ b/lib/screens/main_screen.dart @@ -4,6 +4,7 @@ import 'services_screen.dart'; import 'ai_chat_screen.dart'; import 'messages_screen.dart'; import 'profile_screen.dart'; +import 'create_activity_screen.dart'; class MainScreen extends StatefulWidget { const MainScreen({super.key}); @@ -26,6 +27,8 @@ class _MainScreenState extends State { Widget build(BuildContext context) { return Scaffold( body: IndexedStack(index: _currentIndex, children: _screens), + floatingActionButton: _buildGlobalFab(), + floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, bottomNavigationBar: BottomNavigationBar( currentIndex: _currentIndex, onTap: (i) => setState(() => _currentIndex = i), @@ -39,4 +42,23 @@ class _MainScreenState extends State { ), ); } + + Widget? _buildGlobalFab() { + if (_currentIndex == 0) { + return null; + } + + return FloatingActionButton.extended( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (_) => CreateActivityScreen()), + ); + }, + icon: const Icon(Icons.add), + label: const Text('发起活动', style: TextStyle(fontSize: 16)), + backgroundColor: const Color(0xFF1976D2), + foregroundColor: Colors.white, + ); + } } diff --git a/releases/banxiang-v1.2.0-bugfix.apk b/releases/banxiang-v1.2.0-bugfix.apk new file mode 100644 index 0000000..5a60cdc Binary files /dev/null and b/releases/banxiang-v1.2.0-bugfix.apk differ