84 lines
2.0 KiB
Dart
84 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../main_color.dart';
|
|
|
|
import '../store/store.dart';
|
|
import '../dtx/dtx.dart';
|
|
import '../user/user.dart';
|
|
|
|
class TabPages extends StatefulWidget {
|
|
const TabPages({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<TabPages> createState() => _TabPagesState();
|
|
}
|
|
|
|
class _TabPagesState extends State<TabPages> {
|
|
int _currentIndex = 0;
|
|
|
|
final List _pages = const <Widget>[
|
|
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,
|
|
),
|
|
);
|
|
}
|
|
}
|