| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import 'package:clean/module/more/more_view.dart';
- import 'package:clean/utils/expand.dart';
- import 'package:convex_bottom_bar/convex_bottom_bar.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import '../../base/base_page.dart';
- import '../../resource/assets.gen.dart';
- import '../../router/app_pages.dart';
- import '../home/home_view.dart';
- import 'main_controller.dart';
- import 'package:flutter/Material.dart';
- import 'package:get/get.dart';
- class MainTabPage extends BasePage<MainController> {
- MainTabPage({super.key});
- final pages = [
- const HomePage(),
- const MorePage(),
- ];
- static void start() {
- Get.offNamed(RoutePath.mainTab, arguments: {});
- }
- @override
- bool immersive() {
- return true;
- }
- @override
- Widget buildBody(BuildContext context) {
- return PopScope(
- canPop: false,
- child: Scaffold(
- bottomNavigationBar: buildBottomAppBar(),
- drawerEdgeDragWidth: 0,
- body: Obx(() {
- return pages[controller.currentIndex];
- }),
- ),
- );
- }
- Widget buildBottomAppBar() {
- 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);
- }
- },
- ),
- ),
- );
- }
- }
- // tabbar样式
- class BottomTabBarStyle extends StyleHook {
- @override
- double get activeIconSize => 52.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);
- }
- }
|