动我项目仓库 flutter:3.22 dart:3.4.4
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

166 lines
5.7 KiB

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<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
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)
),
)
],
),
),
),
],
),
),
),
);
}
}