/* * @Author: zhangdongxue zhangdongxue@uz.cn * @Date: 2022-05-26 13:16:03 * @LastEditors: Aimee * @LastEditTime: 2022-05-31 13:57:44 * @FilePath: /gl_dao/lib/pages/tabs/tabs.dart * @Description: 路由 * */ import 'package:flutter/material.dart'; import '../../main_color.dart'; import '../store/index/index_page.dart'; import '../dtx/dtx.dart'; import '../user/user.dart'; class TabPages extends StatefulWidget { const TabPages({Key? key}) : super(key: key); @override State createState() => _TabPagesState(); } class _TabPagesState extends State { int _currentIndex = 0; final List _pages = const [ StorePages(), DtxPages(), UserPages(), ]; Widget _currentPages = const StorePages(); void _onTab(index) { setState(() { _currentPages = _pages[index]; _currentIndex = index; }); } @override Widget build(BuildContext context) { return Scaffold( body: _currentPages, bottomNavigationBar: BottomNavigationBar( items: [ BottomNavigationBarItem( label: '首页', icon: Image.asset( 'assets/tabBar/tabBar_00.png', width: 24.0, ), activeIcon: Image.asset( 'assets/tabBar/tabBar_show_00.png', width: 24.0, ), ), BottomNavigationBarItem( label: 'DTX积分', icon: Image.asset( 'assets/tabBar/tabBar_01.png', width: 24.0, ), activeIcon: Image.asset( 'assets/tabBar/tabBar_show_01.png', width: 24.0, ), ), BottomNavigationBarItem( label: '我的', icon: Image.asset( 'assets/tabBar/tabBar_02.png', width: 24.0, ), activeIcon: Image.asset( 'assets/tabBar/tabBar_show_02.png', width: 24.0, ), ), ], currentIndex: _currentIndex, selectedLabelStyle: const TextStyle( fontSize: 10.0, ), selectedItemColor: tMainColor, unselectedLabelStyle: const TextStyle(fontSize: 10.0), onTap: _onTab, ), ); } }