|
@@ -1,3 +1,4 @@
|
|
|
|
+import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
@@ -27,8 +28,10 @@ class NoticeBoardPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
// 顶部tab 切换
|
|
// 顶部tab 切换
|
|
- 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 =
|
|
final curIdx =
|
|
ref.watch(noticeBoardVmProvider.select((value) => value.curIdx));
|
|
ref.watch(noticeBoardVmProvider.select((value) => value.curIdx));
|
|
@@ -44,29 +47,49 @@ class NoticeBoardPage extends HookConsumerWidget {
|
|
flex: 1,
|
|
flex: 1,
|
|
child: Column(
|
|
child: Column(
|
|
children: [
|
|
children: [
|
|
- MyAssetImage(
|
|
|
|
- item['icon'],
|
|
|
|
|
|
+ Container(
|
|
width: MediaQuery.of(context).size.width /
|
|
width: MediaQuery.of(context).size.width /
|
|
topSectionsData.length -
|
|
topSectionsData.length -
|
|
36,
|
|
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(
|
|
|
|
|
|
+ MyTextView(
|
|
item['title'],
|
|
item['title'],
|
|
maxLines: 1, // 设置最大行数为2
|
|
maxLines: 1, // 设置最大行数为2
|
|
- overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 13.0,
|
|
|
|
- color: curIdx == index
|
|
|
|
- ? ColorUtils.string2Color('#4161D0')
|
|
|
|
- : Colors.black,
|
|
|
|
- fontWeight: FontWeight.w500), // 设置字体大小
|
|
|
|
|
|
+ isTextEllipsis: true, // 超出部分用省略号表示
|
|
|
|
+ fontSize: 13,
|
|
|
|
+ textColor: currentTabIdx == index
|
|
|
|
+ ? ColorUtils.string2Color('#4161D0')
|
|
|
|
+ : Colors.black,
|
|
|
|
+ isFontMedium: true,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
@@ -80,29 +103,30 @@ class NoticeBoardPage extends HookConsumerWidget {
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final _vm = ref.read(noticeBoardVmProvider.notifier);
|
|
final _vm = ref.read(noticeBoardVmProvider.notifier);
|
|
- return DefaultTabController(
|
|
|
|
- length: 4,
|
|
|
|
- child: Scaffold(
|
|
|
|
- appBar: AppBar(
|
|
|
|
- title: const Text("Property"),
|
|
|
|
- bottomOpacity: 0.0, // 取消下横线
|
|
|
|
- titleTextStyle: const TextStyle(color: Colors.black),
|
|
|
|
- ),
|
|
|
|
- body: Row(
|
|
|
|
- children: [
|
|
|
|
- Expanded(
|
|
|
|
- child: Column(
|
|
|
|
- children: [
|
|
|
|
- _buildTopSection(context, ref, _vm),
|
|
|
|
- const Expanded(
|
|
|
|
- child: AutoRouter(),
|
|
|
|
- )
|
|
|
|
- ],
|
|
|
|
|
|
+ return Scaffold(
|
|
|
|
+ appBar: MyAppBar.appBar(
|
|
|
|
+ context,
|
|
|
|
+ "Property",
|
|
|
|
+ backgroundColor: context.appColors.whiteBG,
|
|
|
|
+ ),
|
|
|
|
+ body: AutoTabsRouter.pageView(
|
|
|
|
+ routes: const [
|
|
|
|
+ AnnounPageRoute(),
|
|
|
|
+ EventPageRoute(),
|
|
|
|
+ DocumentsPageRoute(),
|
|
|
|
+ ],
|
|
|
|
+ builder: (context, child, pageController) {
|
|
|
|
+ final tabsRouter = AutoTabsRouter.of(context);
|
|
|
|
+ return Column(
|
|
|
|
+ children: [
|
|
|
|
+ _buildTopSection(context, ref, _vm, tabsRouter),
|
|
|
|
+ Expanded(
|
|
|
|
+ child: child,
|
|
),
|
|
),
|
|
- )
|
|
|
|
- ],
|
|
|
|
- )),
|
|
|
|
- );
|
|
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
// @override
|
|
// @override
|
|
// Widget build(BuildContext context, WidgetRef ref) {
|
|
// Widget build(BuildContext context, WidgetRef ref) {
|