|
|
@@ -71,77 +71,77 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
onTap: () {
|
|
|
controller.onChatClick();
|
|
|
},
|
|
|
- child: Container(
|
|
|
- width: 76.w,
|
|
|
- height: 76.w,
|
|
|
- margin: EdgeInsets.only(top: 48.w),
|
|
|
- child: Assets.images.mainTabSecretary.image(),
|
|
|
- ),
|
|
|
- );
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.bottomCenter,
|
|
|
+ child: SizedBox(
|
|
|
+ width: 62.w,
|
|
|
+ child: AspectRatio(
|
|
|
+ aspectRatio: 195 / 223,
|
|
|
+ child: Assets.images.mainTabSecretary.image()),
|
|
|
+ ),
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
BottomAppBar buildBottomAppBar() {
|
|
|
return BottomAppBar(
|
|
|
color: Colors.white,
|
|
|
- height: 68.h,
|
|
|
- child: Obx(() {
|
|
|
- return Flex(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
- direction: Axis.horizontal,
|
|
|
- children: <Widget>[
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
- child: bottomAppBarItem(0),
|
|
|
- ),
|
|
|
- const Expanded(
|
|
|
- flex: 1,
|
|
|
- child: SizedBox(),
|
|
|
- ),
|
|
|
- const SizedBox(),
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
- child: bottomAppBarItem(1),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
- }),
|
|
|
+ height: 56.h,
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ child: Flex(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
+ direction: Axis.horizontal,
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: bottomAppBarItem(0),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 62.w),
|
|
|
+ const SizedBox(),
|
|
|
+ Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: bottomAppBarItem(1),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
Widget bottomAppBarItem(int index) {
|
|
|
- //设置默认未选中的状态
|
|
|
- TextStyle style;
|
|
|
- TabBean tabBean = controller.tabBeans[index];
|
|
|
- String imagePath;
|
|
|
- if (controller.currentIndex == index) {
|
|
|
- //选中的话
|
|
|
- style = TextStyle(fontSize: 10.sp, color: tabBean.txtSelectedColor);
|
|
|
- imagePath = tabBean.selectedIcon;
|
|
|
- } else {
|
|
|
- style = TextStyle(fontSize: 10.sp, color: tabBean.txtNormalColor);
|
|
|
- imagePath = tabBean.normalIcon;
|
|
|
- }
|
|
|
- //构造返回的Widget
|
|
|
- Widget item = GestureDetector(
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- child: Center(
|
|
|
- child: Column(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- children: <Widget>[
|
|
|
- Expanded(child: Image.asset(imagePath)),
|
|
|
- Text(
|
|
|
- tabBean.title.tr,
|
|
|
- style: style,
|
|
|
- )
|
|
|
- ],
|
|
|
+ return Obx(() {
|
|
|
+ TextStyle style;
|
|
|
+ TabBean tabBean = controller.tabBeans[index];
|
|
|
+ String imagePath;
|
|
|
+ if (controller.currentIndex == index) {
|
|
|
+ //选中的话
|
|
|
+ style = TextStyle(fontSize: 10.sp, color: tabBean.txtSelectedColor);
|
|
|
+ imagePath = tabBean.selectedIcon;
|
|
|
+ } else {
|
|
|
+ style = TextStyle(fontSize: 10.sp, color: tabBean.txtNormalColor);
|
|
|
+ imagePath = tabBean.normalIcon;
|
|
|
+ }
|
|
|
+ return GestureDetector(
|
|
|
+ behavior: HitTestBehavior.opaque,
|
|
|
+ child: SizedBox(
|
|
|
+ height: 56.h,
|
|
|
+ child: Center(
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset(imagePath, width: 24.w, height: 24.w),
|
|
|
+ Text(
|
|
|
+ tabBean.title.tr,
|
|
|
+ style: style,
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- onTap: () {
|
|
|
- if (controller.currentIndex != index) {
|
|
|
- controller.updateIndex(index);
|
|
|
- }
|
|
|
- },
|
|
|
- );
|
|
|
- return item;
|
|
|
+ onTap: () {
|
|
|
+ if (controller.currentIndex != index) {
|
|
|
+ controller.updateIndex(index);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
}
|