123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- import 'package:common_project/public_view/test_page.dart';
- import 'package:flutter/foundation.dart';
- import 'package:flutter/material.dart';
- import 'package:common_project/common_project.dart';
- import 'package:module_chat/view/enter_room_page.dart';
- import 'package:module_home/view/home_index_page.dart';
- import 'package:module_home/view/home_main_page.dart';
- import 'package:module_im/view/message_dynamic/message_dynamic_list.dart';
- import 'package:module_im/view/message_list_view/conversation_page.dart';
- import 'package:module_im/view/message_list_view/message_conversation_page.dart';
- import 'package:module_im/view/message_notification_page.dart';
- import 'package:module_login/view/login_index_page.dart';
- import 'package:module_me/view/me_index_page.dart';
- import 'package:module_home/view/center_open_chat_page.dart';
- import 'package:module_chat/text_page/chat_init_page.dart';
- import 'package:module_chat/view/chat_room_index_page.dart';
- import 'package:module_im/view/textRecorder.dart';
- import 'package:module_me/view/me_main_page.dart';
- import 'package:module_me/view/me_voice_room_page.dart';
- import 'package:module_im/view/message_dynamic/message_dynamic_index.dart';
- class IndexPage extends StatefulWidget {
- @override
- _IndexPageState createState() => _IndexPageState();
- }
- class _IndexPageState extends State<IndexPage> {
- //tab页面数组
- List <Widget> tabPages=[
- // HomeIndexPage(),
- HomeMainPage(),
- // TestPage(),
- // ConversationPage({"coversationType":1,"targetId":"418663664451584"}),
- // MessageConversationPage(1,'418663664451584'),
- // MessageDynamicListPage(),
- MessageDynamicIndex(),
- CenterOpenChatPage(),
- MessageNotificationPage(),
- // ChatRoomIndexPage("13213"),
- // EnterRoomPage(),
- MeIndexPage(),
- //MeVoiceRoomPage(),
- // MeMainPage(null),
- // LoginIndexPage()
- // TextRecorder(),
- ];
- List bottomNavigationTitleList=['首页','我的',"房间","录音测试",];
- List bottomNavigationIconList=[Icon(Icons.home),Icon(Icons.add),Icon(Icons.ac_unit_rounded),Icon(Icons.animation)];
- //tab图标数组
- List <BottomNavigationBarItem> bottomNavigationList=[
- // BottomNavigationBarItem(icon: Icon(Icons.home),title: Text('首页')),
- // BottomNavigationBarItem(icon: Icon(Icons.add),title: Text('我的'))
- ];
- // int currentIndex = 0;
- @override
- void initState() {
- // TODO: implement initState
- // if(SpUtil.getString(SPKeys.loginInfo) != ""){
- //
- // Application.navigateTo(context: GlobalConstKey.getContext(), route: RouterPath().loginIndex);
- //
- // }
- super.initState();
- //
- for(int i=0;i<bottomNavigationTitleList.length;i++){
- bottomNavigationList.add( BottomNavigationBarItem(icon: bottomNavigationIconList[i],label: bottomNavigationTitleList[i]),);
- }
- }
- @override
- Widget build(BuildContext context) {
- return Builder(builder: (context){
- int currentIndex = context.select((TabIndexCubit value) => value.state.currentIndex! as int);
- TabIndexCubit cubit = BlocProvider.of<TabIndexCubit>(context);
- context.select((TabIndexCubit value) => cubit.state.timeStr);
- return Scaffold(
- backgroundColor: Theme.of(context).primaryColor,
- body: IndexedStack(
- index: currentIndex,
- children: tabPages,
- ),
- bottomNavigationBar: BottomNavigationBar(
- backgroundColor: Colors.white,
- type: BottomNavigationBarType.fixed,
- fixedColor: HexColor.fromHex("#6A00FE"),
- items: cubit.state.items as List<BottomNavigationBarItem>,
- currentIndex: currentIndex,
- onTap: (index){
- if(index!=currentIndex) { //过滤重复点击 导航栏
- if(index==2){
- DialogAddWidget(
- context: context,
- gravity: Gravity.bottom,
- decoration: BoxDecoration(
- color: Colors.transparent
- ),
- borderRadius: 0.0,
- barrierColor: Color(0xCC000000),
- backgroundColor: Color(0x80000000),
- widget: BeganGoPage(),
- );
- }else{
- context.read<TabIndexCubit>().changPage(index);
- }
- }
- },
- ),
- );
- });
- }
- }
|