first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_app/config/index.dart';
import 'package:fancy_bottom_navigation/fancy_bottom_navigation.dart';
import 'package:flutter_app/view/page/home.dart';
import 'package:flutter_app/view/page/style.dart';
import 'package:flutter_app/view/page/like.dart';
import 'package:flutter_app/view/page/about.dart';
import 'package:flutter_app/view/page/login.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BottomNavigationWidget extends StatefulWidget {
_BottomNavigationWidgetState createState() => _BottomNavigationWidgetState();
}
class _BottomNavigationWidgetState extends State<BottomNavigationWidget> {
int _currentIndex = 0;
var _currentPage;
final List<Widget> tabBodies = [
Login(),
Home(),
Style(),
Like(),
About(),
];
@override
void initState() {
_currentPage = tabBodies[_currentIndex];
super.initState();
}
@override
Widget build(BuildContext context) {
// 适配屏幕尺寸
ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);
return Scaffold(
body: new IndexedStack(
index: _currentIndex,
children: tabBodies,
),
bottomNavigationBar: FancyBottomNavigation(
tabs: [
TabData(iconData: Icons.home, title: "首页"),
TabData(iconData: Icons.view_module, title: "分类"),
TabData(iconData: Icons.favorite, title: "喜欢"),
TabData(iconData: Icons.pperson, title: "我的")
],
onTabChangedListener: (position) {
setState(() {
_currentIndex = position;
_currentPage = tabBodies[_currentIndex];
});
},
),
);
}
Icon getTabIcon(int index) {
if (index == _currentIndex) {
return Config.tabSelectedImages[index];
} else {
return Config.tabImages[index];
}
}
}