content: import 'package:flutter/material.dart';
  import 'package:horopic/pages/home_page.dart';
  import 'package:horopic/album/album_page.dart';
  import 'package:horopic/configure_page/configure_page.dart';
  import 'package:horopic/picture_host_manage/picture_host_manage_entry.dart';
  
  class PicHoroAPP extends StatefulWidget {
    final int selectedIndex;
  
    const PicHoroAPP({super.key, this.selectedIndex = 0});
  
    @override
    State<PicHoroAPP> createState() => _PicHoroAPPState();
  }
  
  class _PicHoroAPPState extends State<PicHoroAPP> {
    late int _selectedIndex;
    late final PageController _pageController;
  
    final List<Widget> _pages = const [
      HomePage(),
      UploadedImages(),
      PsHostHomePage(),
      ConfigurePage(),
    ];
  
    @override
    void initState() {
      super.initState();
      _selectedIndex = widget.selectedIndex;
      _pageController = PageController(initialPage: _selectedIndex);
    }
  
    @override
    void dispose() {
      _pageController.dispose();
      super.dispose();
    }
  
    void _onItemTapped(int index) {
      if (_selectedIndex == index) return;
  
      setState(() {
        _selectedIndex = index;
        _pageController.jumpToPage(index);
      });
    }
  
    @override
    Widget build(BuildContext context) {
      final theme = Theme.of(context);
  
      return Scaffold(
        body: PageView(
          controller: _pageController,
          physics: const NeverScrollableScrollPhysics(),
          children: _pages,
        ),
        bottomNavigationBar: _buildBottomNavigationBar(theme),
      );
    }
  
    Widget _buildBottomNavigationBar(ThemeData theme) {
      return Container(
        decoration: const BoxDecoration(
          boxShadow: [
            BoxShadow(
              color: Colors.black12,
              blurRadius: 8,
              offset: Offset(0, -1),
            ),
          ],
        ),
        child: BottomNavigationBar(
          currentIndex: _selectedIndex,
          showSelectedLabels: true,
          showUnselectedLabels: true,
          selectedItemColor: theme.colorScheme.primary,
          unselectedItemColor: Colors.grey.shade600,
          selectedFontSize: 12,
          unselectedFontSize: 10,
          elevation: 15,
          backgroundColor: theme.colorScheme.surface,
          onTap: _onItemTapped,
          type: BottomNavigationBarType.fixed,
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.file_upload_outlined),
              activeIcon: Icon(Icons.file_upload),
              label: '上传',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.photo_outlined),
              activeIcon: Icon(Icons.photo),
              label: '相册',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.storage_outlined),
              activeIcon: Icon(Icons.storage),
              label: '仓库',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.settings_outlined),
              activeIcon: Icon(Icons.settings),
              label: '设置',
            ),
          ],
        ),
      );
    }
  }
  