Browse Source

完善顶层

master
YakumoChen 4 months ago
parent
commit
19c8bcec19
4 changed files with 93 additions and 46 deletions
  1. BIN
      assets/search.png
  2. 101
      lib/components/home_appbar.dart
  3. 14
      lib/pages/chat_page.dart
  4. 24
      lib/pages/live_page.dart

BIN
assets/search.png

Before After
Width: 60  |  Height: 64  |  Size: 1.1 KiB

101
lib/components/home_appbar.dart

@ -5,7 +5,8 @@ class HomeAppbar extends StatefulWidget {
final List<String> topNav;
final void Function(int) changeNav;
const HomeAppbar({super.key, required this.topNav, required this.changeNav});
final Widget right;
const HomeAppbar({super.key, required this.topNav, required this.changeNav, this.right = const SizedBox()});
@override
State<HomeAppbar> createState() => _HomeAppbarState();
@ -20,55 +21,67 @@ class _HomeAppbarState extends State<HomeAppbar> {
return Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
color: Colors.transparent,
child: Container(
height: ScreenUtil().setWidth(108),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(34)),
child: Stack(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
child: Stack(
children: [
Container(
height: ScreenUtil().setWidth(108),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(34)),
child: Stack(
children: [
...widget.topNav.asMap().entries.map((entry){
return InkWell(
onTap: (){
active = entry.key;
widget.changeNav(active);
setState(() {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
...widget.topNav.asMap().entries.map((entry){
return InkWell(
onTap: (){
active = entry.key;
widget.changeNav(active);
setState(() {
});
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(27)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
entry.value,
style: TextStyle(
fontSize: active == entry.key ? 38.w : 34.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: active == entry.key ? FontWeight.w600 : FontWeight.w400
),
});
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(27)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
entry.value,
style: TextStyle(
fontSize: active == entry.key ? 38.w : 34.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: active == entry.key ? FontWeight.w600 : FontWeight.w400
),
),
SizedBox(height: ScreenUtil().setWidth(9),),
if(active == entry.key) Image.asset(
"assets/home_top_active.png",
width: ScreenUtil().setWidth(25),
)
],
),
SizedBox(height: ScreenUtil().setWidth(9),),
if(active == entry.key) Image.asset(
"assets/home_top_active.png",
width: ScreenUtil().setWidth(25),
)
],
),
),
);
}),
),
);
}),
],
)
],
)
],
),
),
),
Positioned(
right: 0,
top: 0,
bottom: 0,
child: Center(
child: widget.right,
),
)
],
),
);
}

14
lib/pages/chat_page.dart

@ -58,7 +58,19 @@ class _ChatPageState extends State<ChatPage> {
),
child: Column(
children: [
HomeAppbar(topNav: topNav, changeNav: changeNav,),
Container(
padding: EdgeInsets.symmetric(horizontal: 36.w),
child: HomeAppbar(topNav: topNav, changeNav: changeNav, right: InkWell(
onTap: (){
print("12121");
},
child: Image.asset(
"assets/search.png",
width: 29.w,
height: 31.w,
),
),),
),
Container(
width: 750.w,
padding: EdgeInsets.only(

24
lib/pages/live_page.dart

@ -66,7 +66,29 @@ class _LivePageState extends State<LivePage> {
),
child: Column(
children: [
HomeAppbar(topNav: topNav, changeNav: changeNav,),
HomeAppbar(topNav: topNav, changeNav: changeNav, right: InkWell(
onTap: (){
print("12121");
},
child: Container(
width: 104.w,
height: 40.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(40.w)),
color: const Color.fromRGBO(108, 105, 244, 1)
),
child: Center(
child: Text(
"申请红娘",
style: TextStyle(
fontSize: 20.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
),
),
),),
Container(
width: 702.w,
height: 91.w,

Loading…
Cancel
Save