content: import 'package:flutter/material.dart';
  
  import 'home_page.dart';
  import 'category_page.dart';
  import 'radio_page.dart';
  
  /// ONE阅读模块主页面
  class OneMainPage extends StatefulWidget {
    const OneMainPage({super.key});
  
    @override
    State<OneMainPage> createState() => _OneMainPageState();
  }
  
  class _OneMainPageState extends State<OneMainPage> {
    int _currentIndex = 0;
    late PageController _pageController;
  
    final List<Widget> _pages = [
      const OneHomePage(),
      const OneCategoryPage(),
      const OneRadioPage(),
    ];
  
    @override
    void initState() {
      super.initState();
      _pageController = PageController();
    }
  
    @override
    void dispose() {
      _pageController.dispose();
      super.dispose();
    }
  
    void _onTabTapped(int index) {
      if (_currentIndex != index) {
        setState(() {
          _currentIndex = index;
        });
        _pageController.animateToPage(
          index,
          duration: const Duration(milliseconds: 300),
          curve: Curves.easeInOut,
        );
      }
    }
  
    void _onPageChanged(int index) {
      setState(() {
        _currentIndex = index;
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: PageView(
          controller: _pageController,
          onPageChanged: _onPageChanged,
          children: _pages,
        ),
        bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          currentIndex: _currentIndex,
          selectedItemColor: Theme.of(context).primaryColor,
          unselectedItemColor: Colors.grey,
          onTap: _onTabTapped,
          items: const [
            BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
            BottomNavigationBarItem(icon: Icon(Icons.category), label: '分类'),
            BottomNavigationBarItem(icon: Icon(Icons.radio), label: '收音机'),
          ],
        ),
      );
    }
  }
  