|
@@ -1,32 +1,32 @@
|
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
|
|
|
+import 'package:electronic_assistant/main.dart';
|
|
|
import 'package:electronic_assistant/module/main/controller.dart';
|
|
import 'package:electronic_assistant/module/main/controller.dart';
|
|
|
|
|
+import 'package:electronic_assistant/resource/assets.gen.dart';
|
|
|
|
|
+import 'package:electronic_assistant/resource/colors.gen.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
|
|
+import '../files/view.dart';
|
|
|
|
|
+import '../home/view.dart';
|
|
|
|
|
+
|
|
|
class MainTabPage extends BasePage<MainController> {
|
|
class MainTabPage extends BasePage<MainController> {
|
|
|
- const MainTabPage({super.key});
|
|
|
|
|
|
|
+ MainTabPage({super.key});
|
|
|
|
|
+
|
|
|
|
|
+ final pages = [
|
|
|
|
|
+ const HomePage(),
|
|
|
|
|
+ const FilesPage(),
|
|
|
|
|
+ ];
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget? buildBody(BuildContext context) {
|
|
Widget? buildBody(BuildContext context) {
|
|
|
return Scaffold(
|
|
return Scaffold(
|
|
|
- body: const Center(
|
|
|
|
|
- child: Text('MainTabPage'),
|
|
|
|
|
- ),
|
|
|
|
|
- bottomNavigationBar: BottomAppBar(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- height: 68,
|
|
|
|
|
- shape: const CircularNotchedRectangle(),
|
|
|
|
|
- child: Obx(() {
|
|
|
|
|
- return Row(
|
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- SizedBox(child: bottomAppBarItem(0)),
|
|
|
|
|
- const SizedBox(),
|
|
|
|
|
- SizedBox(child: bottomAppBarItem(1)),
|
|
|
|
|
- ],
|
|
|
|
|
- );
|
|
|
|
|
- }),
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ body: Obx(() {
|
|
|
|
|
+ return pages[controller.currentIndex];
|
|
|
|
|
+ }),
|
|
|
|
|
+ floatingActionButton: buildAIChatBtn(),
|
|
|
|
|
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
|
+ bottomNavigationBar: buildBottomAppBar(),
|
|
|
drawer: Drawer(
|
|
drawer: Drawer(
|
|
|
child: Center(
|
|
child: Center(
|
|
|
child: Column(
|
|
child: Column(
|
|
@@ -44,6 +44,48 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Container buildAIChatBtn() {
|
|
|
|
|
+ return Container(
|
|
|
|
|
+ width: 68.w,
|
|
|
|
|
+ height: 68.w,
|
|
|
|
|
+ decoration: const BoxDecoration(
|
|
|
|
|
+ color: ColorName.white,
|
|
|
|
|
+ shape: BoxShape.circle,
|
|
|
|
|
+ ),
|
|
|
|
|
+ margin: EdgeInsets.only(top: 36.w),
|
|
|
|
|
+ padding: EdgeInsets.all(6.w),
|
|
|
|
|
+ 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),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Widget bottomAppBarItem(int index) {
|
|
Widget bottomAppBarItem(int index) {
|
|
|
//设置默认未选中的状态
|
|
//设置默认未选中的状态
|
|
|
TextStyle style;
|
|
TextStyle style;
|
|
@@ -51,10 +93,10 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
String imagePath;
|
|
String imagePath;
|
|
|
if (controller.currentIndex == index) {
|
|
if (controller.currentIndex == index) {
|
|
|
//选中的话
|
|
//选中的话
|
|
|
- style = TextStyle(fontSize: 10, color: tabBean.txtSelectedColor);
|
|
|
|
|
|
|
+ style = TextStyle(fontSize: 10.sp, color: tabBean.txtSelectedColor);
|
|
|
imagePath = tabBean.selectedIcon;
|
|
imagePath = tabBean.selectedIcon;
|
|
|
} else {
|
|
} else {
|
|
|
- style = TextStyle(fontSize: 10, color: tabBean.txtNormalColor);
|
|
|
|
|
|
|
+ style = TextStyle(fontSize: 10.sp, color: tabBean.txtNormalColor);
|
|
|
imagePath = tabBean.normalIcon;
|
|
imagePath = tabBean.normalIcon;
|
|
|
}
|
|
}
|
|
|
//构造返回的Widget
|
|
//构造返回的Widget
|
|
@@ -64,9 +106,9 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
child: Column(
|
|
child: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- Image.asset(imagePath, width: 24, height: 24),
|
|
|
|
|
|
|
+ Image.asset(imagePath, width: 24.w, height: 24.w),
|
|
|
Text(
|
|
Text(
|
|
|
- tabBean.title,
|
|
|
|
|
|
|
+ tabBean.title.tr,
|
|
|
style: style,
|
|
style: style,
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
@@ -80,25 +122,4 @@ class MainTabPage extends BasePage<MainController> {
|
|
|
);
|
|
);
|
|
|
return item;
|
|
return item;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-// List<BottomNavigationBarItem> get _buildBottomBarItem {
|
|
|
|
|
-// return [
|
|
|
|
|
-// BottomNavigationBarItem(
|
|
|
|
|
-// icon: Assets.images.mainTabHomeUnSelect.image(width: 24, height: 24),
|
|
|
|
|
-// activeIcon:
|
|
|
|
|
-// Assets.images.mainTabHomeSelected.image(width: 24, height: 24),
|
|
|
|
|
-// label: 'main_tab_home'.tr,
|
|
|
|
|
-// ),
|
|
|
|
|
-// const BottomNavigationBarItem(
|
|
|
|
|
-// icon: SizedBox(width: 24, height: 24),
|
|
|
|
|
-// label: '',
|
|
|
|
|
-// ),
|
|
|
|
|
-// BottomNavigationBarItem(
|
|
|
|
|
-// icon: Assets.images.mainTabFileUnSelect.image(width: 24, height: 24),
|
|
|
|
|
-// activeIcon:
|
|
|
|
|
-// Assets.images.mainTabFileSelected.image(width: 24, height: 24),
|
|
|
|
|
-// label: 'main_tab_file'.tr,
|
|
|
|
|
-// ),
|
|
|
|
|
-// ];
|
|
|
|
|
-// }
|
|
|
|
|
}
|
|
}
|