|
|
@@ -24,6 +24,11 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
+ bool immersive() {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
return PopScope(
|
|
|
canPop: false,
|
|
|
@@ -38,92 +43,49 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
}
|
|
|
|
|
|
Widget buildBottomAppBar() {
|
|
|
- return Container(
|
|
|
- // height: 100.h,
|
|
|
- // decoration: BoxDecoration(
|
|
|
- // color: "#0F0F16".color,
|
|
|
- // boxShadow: [
|
|
|
- // BoxShadow(
|
|
|
- // color: Colors.black.withOpacity(0.1),
|
|
|
- // spreadRadius: 1,
|
|
|
- // blurRadius: 10,
|
|
|
- // offset: const Offset(0, 0),
|
|
|
- // ),
|
|
|
- // ],
|
|
|
- // borderRadius: BorderRadius.only(
|
|
|
- // topLeft: Radius.circular(20.r),
|
|
|
- // topRight: Radius.circular(20.r),
|
|
|
- // ),
|
|
|
- // ),
|
|
|
- child: ConvexAppBar(
|
|
|
- height: 80.h,
|
|
|
- items: [
|
|
|
- TabItem(icon: Assets.images.iconTabHomeUnselect.image(width: 24.w, height: 24.w), activeIcon: Assets.images.iconTabHomeSelected.image(width: 66.w, height: 66.w)),
|
|
|
- TabItem(icon: Assets.images.iconTabMoreUnselect.image(width: 24.w, height: 24.w), activeIcon: Assets.images.iconTabMoreSelected.image(width: 66.w, height: 66.w)),
|
|
|
- ],
|
|
|
- onTap: (int i) {
|
|
|
- if (controller.currentIndex != i) {
|
|
|
- controller.changeIndex(i);
|
|
|
- }
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
-
|
|
|
- // BottomAppBar(
|
|
|
- // color: Colors.transparent,
|
|
|
- // height: 100.h,
|
|
|
- // padding: EdgeInsets.zero,
|
|
|
- // shape: CircularNotchedRectangle(),
|
|
|
- // child: Flex(
|
|
|
- // direction: Axis.horizontal,
|
|
|
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
- // children: [
|
|
|
- // Expanded(flex: 1, child: bottomAppBarItem(0)),
|
|
|
- // const Expanded(flex: 1, child: SizedBox()),
|
|
|
- // Expanded(flex: 1, child: bottomAppBarItem(1))
|
|
|
- // ],
|
|
|
- // ),
|
|
|
- // ),
|
|
|
+ return StyleProvider(
|
|
|
+ style: BottomTabBarStyle(),
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
+ ),
|
|
|
+ child: ConvexAppBar(
|
|
|
+ height: 65.h,
|
|
|
+ backgroundColor: "#0F0F16".color,
|
|
|
+ activeColor: Colors.transparent,
|
|
|
+ items: [
|
|
|
+ TabItem(
|
|
|
+ icon: Assets.images.iconTabHomeUnselect.image(),
|
|
|
+ activeIcon: Assets.images.iconTabHomeSelected.image()),
|
|
|
+ TabItem(
|
|
|
+ icon: Assets.images.iconTabMoreUnselect.image(),
|
|
|
+ activeIcon: Assets.images.iconTabMoreSelected.image()),
|
|
|
+ ],
|
|
|
+ onTap: (int i) {
|
|
|
+ if (controller.currentIndex != i) {
|
|
|
+ controller.changeIndex(i);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- Widget bottomAppBarItem(int index) {
|
|
|
- return Obx(() {
|
|
|
- TabBean tabBean = controller.tabBeans[index];
|
|
|
- String imagePath = controller.currentIndex == index
|
|
|
- ? tabBean.selectedIcon
|
|
|
- : tabBean.normalIcon;
|
|
|
+// tabbar样式
|
|
|
+class BottomTabBarStyle extends StyleHook {
|
|
|
+ @override
|
|
|
+ double get activeIconSize => 52.w;
|
|
|
|
|
|
- return GestureDetector(
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- onTap: () {
|
|
|
- if (controller.currentIndex != index) {
|
|
|
- controller.changeIndex(index);
|
|
|
- }
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- child: SizedBox(
|
|
|
- height: 100.h,
|
|
|
- child: Column(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- controller.currentIndex == index
|
|
|
- ? Image.asset(
|
|
|
- imagePath,
|
|
|
- width: 66.w,
|
|
|
- height: 66.w,
|
|
|
- )
|
|
|
- : Image.asset(
|
|
|
- imagePath,
|
|
|
- width: 24.w,
|
|
|
- height: 24.w,
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ @override
|
|
|
+ double get activeIconMargin => 12.w;
|
|
|
|
|
|
- );
|
|
|
- });
|
|
|
+ @override
|
|
|
+ double get iconSize => 24.w;
|
|
|
+
|
|
|
+ @override
|
|
|
+ TextStyle textStyle(Color color, String? fontFamily) {
|
|
|
+ // TODO: implement textStyle
|
|
|
+ return TextStyle(fontSize: 20, color: color);
|
|
|
}
|
|
|
}
|