import 'package:flutter/material.dart'; import 'package:flutter_tracker/pages/tabs/mine_page.dart'; import 'package:flutter_tracker/pages/tabs/home_page.dart'; import 'package:flutter_tracker/pages/tabs/track_page.dart'; /// Description: /// Time : 2021年12月03日 Friday /// Author : liuyuqi.gov@msncn class IndexPage extends StatefulWidget { const IndexPage({Key? key}) : super(key: key); @override _IndexPageState createState() => _IndexPageState(); } class _IndexPageState extends State { int navIndex = 0; List pages = [ HomePage(url: "http://app.21jingji.com/html/2020yiqing/"), //https://xw.qq.com/act/qgfeiyan // https://www.ipe.org.cn/MapGZBD/XQMap.html //http://m.look.360.cn/subject/400?sign=360_6aa05217&stab=0 const TrackPage(), MinePage(), ]; late Widget currentPage; @override void initState() { super.initState(); currentPage = pages[navIndex]; } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xF1F6F9ff), body: currentPage, bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, currentIndex: navIndex, items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: "首页"), BottomNavigationBarItem(icon: Icon(Icons.art_track), label: "追踪"), BottomNavigationBarItem(icon: Icon(Icons.person), label: "我的"), ], onTap: (index) { setState(() { navIndex = index; currentPage = pages[navIndex]; }); }, ), ); } }