import 'package:dating_touchme_app/components/page_appbar.dart'; import 'package:dating_touchme_app/pages/chat_page.dart'; import 'package:dating_touchme_app/pages/index_page.dart'; import 'package:dating_touchme_app/pages/live_page.dart'; import 'package:dating_touchme_app/pages/my_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); @override State createState() => _HomePageState(); } class _HomePageState extends State { int active = 1; String title = "首页"; @override Widget build(BuildContext context) { return Scaffold( appBar: PageAppbar(title: title,), body: Column( children: [ Expanded( child: SingleChildScrollView( child: active == 1 ? IndexPage() : active == 2 ? LivePage() : active == 3 ? ChatPage() : active == 4 ? MyPage() : Container(), ), ), ], ), bottomNavigationBar: Container( padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), child: SizedBox( height: ScreenUtil().setWidth(50), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: InkWell( onTap: (){ active = 1; title = "首页"; setState(() { }); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.home, size: ScreenUtil().setWidth(26), color: active == 1 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), Text( "首页", style: TextStyle( fontSize: ScreenUtil().setWidth(12), color: active == 1 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), ) ], ), ), ), Expanded( child: InkWell( onTap: (){ active = 2; title = "直播"; setState(() { }); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.home, size: ScreenUtil().setWidth(26), color: active == 2 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), Text( "直播", style: TextStyle( fontSize: ScreenUtil().setWidth(12), color: active == 2 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), ) ], ), ), ), Expanded( child: InkWell( onTap: (){ active = 3; title = "信息"; setState(() { }); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.home, size: ScreenUtil().setWidth(26), color: active == 3 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), Text( "信息", style: TextStyle( fontSize: ScreenUtil().setWidth(12), color: active == 3 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), ) ], ), ), ), Expanded( child: InkWell( onTap: (){ active = 4; title = "我的"; setState(() { }); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.home, size: ScreenUtil().setWidth(26), color: active == 4 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), Text( "我的", style: TextStyle( fontSize: ScreenUtil().setWidth(12), color: active == 4 ? const Color.fromRGBO(208, 116, 67, 1) : const Color.fromRGBO(208, 205, 216, 1) ), ) ], ), ), ), ], ), ), ), ); } }