|
@@ -10,6 +10,7 @@ import 'package:widgets/ext/ex_widget.dart';
|
|
import 'package:widgets/my_text_view.dart';
|
|
import 'package:widgets/my_text_view.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
|
+import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
import '../../router/page/community_page_router.dart';
|
|
import '../../router/page/community_page_router.dart';
|
|
import 'community_vm.dart';
|
|
import 'community_vm.dart';
|
|
@@ -28,10 +29,11 @@ class CommunityPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- Widget _buildTopSection(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
|
|
+ Widget _buildTopSection(BuildContext context, WidgetRef ref, _vm, tabsRouter) {
|
|
final topSectionsData = _vm.topSectionsData;
|
|
final topSectionsData = _vm.topSectionsData;
|
|
|
|
+ final currentTabIdx = tabsRouter.activeIndex;
|
|
// 监听 curIdx 的变化
|
|
// 监听 curIdx 的变化
|
|
- final curIdx = ref.watch(communityVmProvider.select((value) => value.curIdx));
|
|
|
|
|
|
+ // final curIdx = ref.watch(communityVmProvider.select((value) => value.curIdx));
|
|
return Container(
|
|
return Container(
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
padding: const EdgeInsets.only(top: 30, bottom: 30),
|
|
padding: const EdgeInsets.only(top: 30, bottom: 30),
|
|
@@ -45,15 +47,30 @@ class CommunityPage extends HookConsumerWidget {
|
|
flex: 1,
|
|
flex: 1,
|
|
child: Column(
|
|
child: Column(
|
|
children: [
|
|
children: [
|
|
- MyAssetImage(
|
|
|
|
- item['icon'],
|
|
|
|
|
|
+ Container(
|
|
width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
|
|
width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
|
|
height: 70,
|
|
height: 70,
|
|
- ).onTap(
|
|
|
|
- () {
|
|
|
|
- _vm.switchPage(index, context);
|
|
|
|
- },
|
|
|
|
- type: ClickType.throttle,
|
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
|
|
|
|
+ shape: BoxShape.circle, // 设置为圆形
|
|
|
|
+ boxShadow: tabsRouter.activeIndex == index ? [
|
|
|
|
+ BoxShadow(
|
|
|
|
+ color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
|
|
|
|
+ blurRadius: 5, // 设置模糊半径
|
|
|
|
+ spreadRadius: 0.05, // 控制阴影扩散
|
|
|
|
+ offset: const Offset(0, 4), // 设置阴影偏移量
|
|
|
|
+ ),
|
|
|
|
+ ] : [],// 未选中时无阴影,
|
|
|
|
+ ),
|
|
|
|
+ child: MyAssetImage(
|
|
|
|
+ item['icon'],
|
|
|
|
+ width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
|
|
|
|
+ height: 70,
|
|
|
|
+ ).onTap(() {
|
|
|
|
+ tabsRouter.setActiveIndex(index);
|
|
|
|
+ },
|
|
|
|
+ type: ClickType.throttle,
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
SizedBox.fromSize(size: const Size(0, 9)),
|
|
SizedBox.fromSize(size: const Size(0, 9)),
|
|
Text(
|
|
Text(
|
|
@@ -62,7 +79,7 @@ class CommunityPage extends HookConsumerWidget {
|
|
overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 15.0,
|
|
fontSize: 15.0,
|
|
- color: curIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
|
|
|
|
|
|
+ color: currentTabIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
|
|
fontWeight: FontWeight.w500
|
|
fontWeight: FontWeight.w500
|
|
), // 设置字体大小
|
|
), // 设置字体大小
|
|
),
|
|
),
|
|
@@ -85,20 +102,23 @@ class CommunityPage extends HookConsumerWidget {
|
|
backgroundColor: context.appColors.whiteBG,
|
|
backgroundColor: context.appColors.whiteBG,
|
|
),
|
|
),
|
|
backgroundColor: context.appColors.backgroundDefault,
|
|
backgroundColor: context.appColors.backgroundDefault,
|
|
- body: Row(
|
|
|
|
- children: [
|
|
|
|
- Expanded(
|
|
|
|
- child: Column(
|
|
|
|
- children: [
|
|
|
|
- _buildTopSection(context, ref, vm),
|
|
|
|
- const Expanded(
|
|
|
|
- child: AutoRouter(),
|
|
|
|
- )
|
|
|
|
- ],
|
|
|
|
|
|
+ body: AutoTabsRouter.pageView(
|
|
|
|
+ routes: const [
|
|
|
|
+ NewsfeedPageRoute(),
|
|
|
|
+ GaragesalePageRoute(),
|
|
|
|
+ ],
|
|
|
|
+ builder: (context, child, pageController) {
|
|
|
|
+ final tabsRouter = AutoTabsRouter.of(context);
|
|
|
|
+ return Column(
|
|
|
|
+ children: [
|
|
|
|
+ _buildTopSection(context, ref, vm, tabsRouter),
|
|
|
|
+ Expanded(
|
|
|
|
+ child: child,
|
|
),
|
|
),
|
|
- )
|
|
|
|
- ],
|
|
|
|
- )
|
|
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|