@@ -5,7 +5,6 @@ import 'package:arabic_learning/vars/license_storage.dart';
55import 'package:arabic_learning/vars/statics_var.dart' ;
66import 'package:flutter/foundation.dart' ;
77import 'package:flutter/material.dart' ;
8- import 'package:convex_bottom_bar/convex_bottom_bar.dart' ;
98import 'package:flutter/services.dart' ;
109import 'package:flutter_markdown_plus/flutter_markdown_plus.dart' ;
1110import 'package:window_manager/window_manager.dart' ;
@@ -86,9 +85,9 @@ class MyHomePage extends StatefulWidget {
8685
8786class _MyHomePageState extends State <MyHomePage > {
8887 late List <Widget > _pageList;
89- int currentIndex = 0 ;
88+ int currentIndex = 1 ;
9089 bool onSlip = false ;
91- final PageController _pageController = PageController ();
90+ final PageController _pageController = PageController (initialPage : 1 );
9291 static const Duration _duration = Duration (milliseconds: 500 );
9392 bool disPlayedFirst = false ;
9493
@@ -110,26 +109,21 @@ class _MyHomePageState extends State<MyHomePage> {
110109 labelType: NavigationRailLabelType .selected,
111110 backgroundColor: Theme .of (context).colorScheme.onPrimary.withAlpha (150 ),
112111 destinations: const [
113- NavigationRailDestination (
114- icon: Icon (Icons .home_outlined),
115- selectedIcon: Icon (Icons .home),
116- label: Text ('主页' ),
117- ),
118112 NavigationRailDestination (
119113 icon: Icon (Icons .book_outlined),
120114 selectedIcon: Icon (Icons .book),
121115 label: Text ('学习' ),
122116 ),
117+ NavigationRailDestination (
118+ icon: Icon (Icons .home_outlined),
119+ selectedIcon: Icon (Icons .home),
120+ label: Text ('主页' ),
121+ ),
123122 NavigationRailDestination (
124123 icon: Icon (Icons .edit_outlined),
125124 selectedIcon: Icon (Icons .edit),
126125 label: Text ('测试' ),
127126 ),
128- NavigationRailDestination (
129- icon: Icon (Icons .settings_outlined),
130- selectedIcon: Icon (Icons .settings),
131- label: Text ('设置' ),
132- ),
133127 ],
134128 ),
135129 // 垂直分隔线
@@ -172,20 +166,33 @@ class _MyHomePageState extends State<MyHomePage> {
172166 ),
173167 ),
174168 // 底部导航栏
175- ConvexAppBar (
176- key: ValueKey <int >(currentIndex),
177- curve: StaticsVar .curve,
178- style: TabStyle .flip,
179- backgroundColor: Theme .of (context).colorScheme.primary.withAlpha (150 ),
180- items: const [
181- TabItem (icon: Icons .home_outlined, title: '主页' , activeIcon: Icons .home_filled),
182- TabItem (icon: Icons .book_outlined, title: '学习' , activeIcon: Icons .book),
183- TabItem (icon: Icons .edit_outlined, title: '测试' , activeIcon: Icons .edit),
184- TabItem (icon: Icons .settings_outlined, title: '设置' , activeIcon: Icons .settings),
185- ],
186- initialActiveIndex: currentIndex,
187- onTap: _onNavigationTapped,
188- ),
169+ NavigationBar (
170+ selectedIndex: currentIndex,
171+ onDestinationSelected: (int index) {
172+ _onNavigationTapped (index);
173+ },
174+ height: MediaQuery .of (context).size.height * 0.1 ,
175+ animationDuration: Duration (milliseconds: 500 ),
176+ labelBehavior: NavigationDestinationLabelBehavior .onlyShowSelected,
177+ backgroundColor: Theme .of (context).colorScheme.onPrimary.withAlpha (150 ),
178+ destinations: const [
179+ NavigationDestination (
180+ icon: Icon (Icons .book_outlined),
181+ selectedIcon: Icon (Icons .book),
182+ label: '学习' ,
183+ ),
184+ NavigationDestination (
185+ icon: Icon (Icons .home_outlined),
186+ selectedIcon: Icon (Icons .home),
187+ label: '主页' ,
188+ ),
189+ NavigationDestination (
190+ icon: Icon (Icons .edit_outlined),
191+ selectedIcon: Icon (Icons .edit),
192+ label: '测试' ,
193+ ),
194+ ]
195+ )
189196 ],
190197 );
191198 }
@@ -213,7 +220,6 @@ class _MyHomePageState extends State<MyHomePage> {
213220 if (gob.firstStart) {
214221 return Scaffold (
215222 body: PopScope (
216- canPop: false ,
217223 child: Column (
218224 children: [
219225 Expanded (
@@ -278,35 +284,31 @@ class _MyHomePageState extends State<MyHomePage> {
278284 );
279285 }
280286 _pageList = [
281- HomePage (toPage: (index) {
282- _pageController.animateToPage (
283- index,
284- duration: _duration,
285- curve: StaticsVar .curve,
286- );
287- setState (() {
288- currentIndex = index;
289- });
290- }),
291287 LearningPage (),
292- TestPage (),
293- SettingPage (),
288+ HomePage (),
289+ TestPage ()
294290 ];
295291 return Scaffold (
296292 backgroundColor: context.read <Global >().settingData["eggs" ]["stella" ] ? Colors .transparent : null ,
297293 appBar: AppBar (
298294 centerTitle: true ,
299295 backgroundColor: Theme .of (context).colorScheme.inversePrimary.withAlpha (150 ),
300296 title: Text (widget.title),
301- actions: kIsWeb && ! gob.settingData[ 'regular' ][ 'hideAppDownloadButton' ] ? [
302- ElevatedButton .icon (
297+ actions: [
298+ if (kIsWeb && ! gob.settingData[ 'regular' ][ 'hideAppDownloadButton' ]) ElevatedButton .icon (
303299 icon: Icon (Icons .add_to_home_screen),
304300 label: Text ('下载APP版本' ),
305301 onPressed: () {
306302 launchUrl (Uri .parse ("https://github.com/OctagonalStar/arabic_learning/releases/latest" ));
307303 }
304+ ),
305+ IconButton (
306+ onPressed: () {
307+ Navigator .of (context).push (MaterialPageRoute (builder: (context) => SettingPage ()));
308+ },
309+ icon: Icon (Icons .settings)
308310 )
309- ] : [] ,
311+ ],
310312 ),
311313 body: LayoutBuilder (
312314 builder: (context, constraints) {
0 commit comments