diff --git a/lib/pages/player_page.dart b/lib/pages/player_page.dart index 97e15e2..e93de21 100644 --- a/lib/pages/player_page.dart +++ b/lib/pages/player_page.dart @@ -249,21 +249,25 @@ class _PlayerPageState extends BaseState { ), ], ), - body: PageView( - controller: _pageController, - onPageChanged: (index) => setState(() => _pageIndex = index), - children: [ - _buildInfoPage(song), - _buildMainPage(service, song, isPlaying), - _buildLyricsPage(song), - ], + body: SafeArea( + top: false, + child: PageView( + controller: _pageController, + onPageChanged: (index) => setState(() => _pageIndex = index), + children: [ + _buildInfoPage(song), + _buildMainPage(service, song, isPlaying), + _buildLyricsPage(song), + ], + ), ), ); } - /// 顶部两点指示器:左点=信息页,右点=歌词页,中间不亮表示在主页 + /// 顶部指示器:当前页对应"长条",另外两页是小点。 + /// 主页=中间长条,信息页=左长条,歌词页=右长条。 Widget _buildPageIndicator() { - Widget dot(int index) { + Widget segment(int index) { final active = _pageIndex == index; return GestureDetector( onTap: () => _pageController.animateToPage( @@ -271,13 +275,18 @@ class _PlayerPageState extends BaseState { duration: const Duration(milliseconds: 280), curve: Curves.easeOutCubic, ), - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - width: 7, - height: 7, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: active ? Colors.white : Colors.white24, + behavior: HitTestBehavior.opaque, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 2), + child: AnimatedContainer( + duration: const Duration(milliseconds: 220), + curve: Curves.easeOutCubic, + width: active ? 30 : 7, + height: 7, + decoration: BoxDecoration( + color: active ? Colors.white : Colors.white24, + borderRadius: BorderRadius.circular(4), + ), ), ), ); @@ -286,14 +295,11 @@ class _PlayerPageState extends BaseState { return Row( mainAxisSize: MainAxisSize.min, children: [ - dot(0), - Container( - width: 56, - height: 1, - margin: const EdgeInsets.symmetric(horizontal: 8), - color: Colors.white12, - ), - dot(2), + segment(0), + const SizedBox(width: 6), + segment(1), + const SizedBox(width: 6), + segment(2), ], ); }