import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:wgshare/pages/userPage/user_logic.dart'; import 'package:wgshare/pages/userPage/user_view.dart'; import '../utils/color_util.dart'; import 'homePage/home_logic.dart'; import 'homePage/home_view.dart'; import 'start_page_logic.dart'; import 'start_page_state.dart'; class StartPage extends StatefulWidget { const StartPage({super.key}); @override State createState() => _StartPageState(); } class _StartPageState extends State { final StartPageLogic logic = Get.put(StartPageLogic()); final StartPageState state = Get.find().state; final List bottomNavItems = [ BottomNavigationBarItem( icon: Image.asset( 'assets/images/home_index_select_n.png', width: 22, height: 22, ), activeIcon: Image.asset( 'assets/images/home_index_select_y.png', width: 22, height: 22, ), label: "้ฆ–้กต", ), BottomNavigationBarItem( icon: Image.asset( 'assets/images/home_user_select_n.png', width: 22, height: 22, ), activeIcon: Image.asset( 'assets/images/home_user_select_y.png', width: 22, height: 22, ), label: "ๆˆ‘็š„", ), ]; late final List pages; @override void initState() { Get.put(HomeLogic()); Get.lazyPut(() => HomeLogic()); Get.put(UserLogic()); Get.lazyPut(() => UserLogic()); pages = [ HomePage(), UserPage(), ]; } @override Widget build(BuildContext context) { return Scaffold( bottomNavigationBar: Theme( data: ThemeData( splashColor: Colors.transparent, highlightColor: Colors.transparent, ), child: Obx(() => BottomNavigationBar( items: bottomNavItems, currentIndex: state.currentIndex.value, type: BottomNavigationBarType.fixed, backgroundColor: Colors.white, selectedFontSize: 14, selectedItemColor: ColorUtil.Color_85_117_242, unselectedFontSize: 14, unselectedItemColor: ColorUtil.Color_80_87_103, onTap: (index) { if(index != state.currentIndex.value){ state.currentIndex.value = index; } }, )), ), body: Obx(() => pages[state.currentIndex.value]) ); } @override void dispose() { Get.delete(); super.dispose(); } }