|
|
@ -5,7 +5,8 @@ class HomeAppbar extends StatefulWidget { |
|
|
|
|
|
|
|
|
final List<String> topNav; |
|
|
final List<String> topNav; |
|
|
final void Function(int) changeNav; |
|
|
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 |
|
|
@override |
|
|
State<HomeAppbar> createState() => _HomeAppbarState(); |
|
|
State<HomeAppbar> createState() => _HomeAppbarState(); |
|
|
@ -20,55 +21,67 @@ class _HomeAppbarState extends State<HomeAppbar> { |
|
|
return Container( |
|
|
return Container( |
|
|
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), |
|
|
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), |
|
|
color: Colors.transparent, |
|
|
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: [ |
|
|
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, |
|
|
|
|
|
), |
|
|
|
|
|
) |
|
|
|
|
|
], |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|