|
@@ -1,11 +1,15 @@
|
|
-import 'package:cs_resources/theme/theme_config.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';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
|
|
+import 'package:shared/utils/color_utils.dart';
|
|
|
|
+import 'package:shared/utils/log_utils.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
import 'package:widgets/my_load_image.dart';
|
|
-import 'package:cs_resources/generated/assets.dart';
|
|
|
|
|
|
+import 'package:widgets/ext/ex_widget.dart';
|
|
|
|
+import 'package:widgets/my_text_view.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_appbar.dart';
|
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
|
+
|
|
import '../../../router/page/notice_board_page_router.dart';
|
|
import '../../../router/page/notice_board_page_router.dart';
|
|
import '../../notice_board/vm/notice_board_view_model.dart';
|
|
import '../../notice_board/vm/notice_board_view_model.dart';
|
|
|
|
|
|
@@ -22,76 +26,153 @@ class NoticeBoardPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @override
|
|
|
|
- Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
- final _viewModel = ref.read(noticeBoardViewModelProvider.notifier);
|
|
|
|
-
|
|
|
|
- return Scaffold(
|
|
|
|
- // appBar: MyAppBar.titleBar(context, "Test Title"),
|
|
|
|
- body: Container(
|
|
|
|
- child: Column(
|
|
|
|
- children: [
|
|
|
|
-
|
|
|
|
- MyAppBar.titleBar(context, "Test Title"),
|
|
|
|
- const Padding(
|
|
|
|
- padding: EdgeInsets.fromLTRB(15, 0, 15, 30),
|
|
|
|
- child: Row(
|
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
+ // 顶部tab 切换
|
|
|
|
+ Widget _buildTopSection(BuildContext context, WidgetRef ref, _vm) {
|
|
|
|
+ final topSectionsData = _vm.topSectionsData;
|
|
|
|
+ // 监听 curIdx 的变化
|
|
|
|
+ final curIdx =
|
|
|
|
+ ref.watch(noticeBoardVmProvider.select((value) => value.curIdx));
|
|
|
|
+ return Container(
|
|
|
|
+ color: Colors.white,
|
|
|
|
+ child: Center(
|
|
|
|
+ child: Row(
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
+ children: List.generate(topSectionsData.length, (index) {
|
|
|
|
+ final item = topSectionsData[index];
|
|
|
|
+ return Flexible(
|
|
|
|
+ flex: 1,
|
|
|
|
+ child: Column(
|
|
children: [
|
|
children: [
|
|
- Column(children: [
|
|
|
|
- MyAssetImage(
|
|
|
|
- Assets.noticeBoardAnnouncementIcon,
|
|
|
|
- height: 70,
|
|
|
|
- width: 70,
|
|
|
|
- ),
|
|
|
|
- Text(
|
|
|
|
- "Announcement",
|
|
|
|
- style: TextStyle(
|
|
|
|
- color: Colors.black,
|
|
|
|
- fontSize: 15,
|
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
|
- height: 1.5,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- ]),
|
|
|
|
- Column(children: [
|
|
|
|
- MyAssetImage(
|
|
|
|
- Assets.noticeBoardEventIcon,
|
|
|
|
- height: 70,
|
|
|
|
- width: 70,
|
|
|
|
- ),
|
|
|
|
- Text(
|
|
|
|
- "Event",
|
|
|
|
- style: TextStyle(
|
|
|
|
- color: Colors.black,
|
|
|
|
- fontSize: 15,
|
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
|
- height: 1.5,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- ]),
|
|
|
|
- Column(children: [
|
|
|
|
- MyAssetImage(
|
|
|
|
- Assets.noticeBoardDocumentsIcon,
|
|
|
|
- height: 70,
|
|
|
|
- width: 70,
|
|
|
|
- ),
|
|
|
|
- Text(
|
|
|
|
- "Documents",
|
|
|
|
- style: TextStyle(
|
|
|
|
- color: Colors.black,
|
|
|
|
- fontSize: 15,
|
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
|
- height: 1.5,
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
- ]),
|
|
|
|
|
|
+ MyAssetImage(
|
|
|
|
+ item['icon'],
|
|
|
|
+ width: MediaQuery.of(context).size.width /
|
|
|
|
+ topSectionsData.length -
|
|
|
|
+ 36,
|
|
|
|
+ height: 70,
|
|
|
|
+ ).onTap(
|
|
|
|
+ () {
|
|
|
|
+ _vm.switchPage(index, context);
|
|
|
|
+ },
|
|
|
|
+ type: ClickType.throttle,
|
|
|
|
+ ),
|
|
|
|
+ SizedBox.fromSize(size: const Size(0, 9)),
|
|
|
|
+ Text(
|
|
|
|
+ item['title'],
|
|
|
|
+ maxLines: 1, // 设置最大行数为2
|
|
|
|
+ overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 13.0,
|
|
|
|
+ color: curIdx == index
|
|
|
|
+ ? ColorUtils.string2Color('#4161D0')
|
|
|
|
+ : Colors.black,
|
|
|
|
+ fontWeight: FontWeight.w500), // 设置字体大小
|
|
|
|
+ ),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
|
|
|
|
+ }),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
+ 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(),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
|
|
+ )),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ // @override
|
|
|
|
+ // Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
+ // final _viewModel = ref.read(noticeBoardVmProvider.notifier);
|
|
|
|
+ // return Scaffold(
|
|
|
|
+ // // appBar: MyAppBar.titleBar(context, "Test Title"),
|
|
|
|
+ // body: Container(
|
|
|
|
+ // child: Column(
|
|
|
|
+ // children: [
|
|
|
|
+
|
|
|
|
+ // MyAppBar.titleBar(context, "Test Title"),
|
|
|
|
+ // const Padding(
|
|
|
|
+ // padding: EdgeInsets.fromLTRB(15, 0, 15, 30),
|
|
|
|
+ // child: Row(
|
|
|
|
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
+ // children: [
|
|
|
|
+ // Column(children: [
|
|
|
|
+ // MyAssetImage(
|
|
|
|
+ // Assets.noticeBoardAnnouncementIcon,
|
|
|
|
+ // height: 70,
|
|
|
|
+ // width: 70,
|
|
|
|
+ // ),
|
|
|
|
+ // Text(
|
|
|
|
+ // "Announcement",
|
|
|
|
+ // style: TextStyle(
|
|
|
|
+ // color: Colors.black,
|
|
|
|
+ // fontSize: 15,
|
|
|
|
+ // fontWeight: FontWeight.bold,
|
|
|
|
+ // height: 1.5,
|
|
|
|
+ // ),
|
|
|
|
+ // )
|
|
|
|
+ // ]),
|
|
|
|
+ // Column(children: [
|
|
|
|
+ // MyAssetImage(
|
|
|
|
+ // Assets.noticeBoardEventIcon,
|
|
|
|
+ // height: 70,
|
|
|
|
+ // width: 70,
|
|
|
|
+ // ),
|
|
|
|
+ // Text(
|
|
|
|
+ // "Event",
|
|
|
|
+ // style: TextStyle(
|
|
|
|
+ // color: Colors.black,
|
|
|
|
+ // fontSize: 15,
|
|
|
|
+ // fontWeight: FontWeight.bold,
|
|
|
|
+ // height: 1.5,
|
|
|
|
+ // ),
|
|
|
|
+ // )
|
|
|
|
+ // ]),
|
|
|
|
+ // Column(children: [
|
|
|
|
+ // MyAssetImage(
|
|
|
|
+ // Assets.noticeBoardDocumentsIcon,
|
|
|
|
+ // height: 70,
|
|
|
|
+ // width: 70,
|
|
|
|
+ // ),
|
|
|
|
+ // Text(
|
|
|
|
+ // "Documents",
|
|
|
|
+ // style: TextStyle(
|
|
|
|
+ // color: Colors.black,
|
|
|
|
+ // fontSize: 15,
|
|
|
|
+ // fontWeight: FontWeight.bold,
|
|
|
|
+ // height: 1.5,
|
|
|
|
+ // ),
|
|
|
|
+ // )
|
|
|
|
+ // ]),
|
|
|
|
+ // ],
|
|
|
|
+ // ),
|
|
|
|
+ // ),
|
|
|
|
+ // ],
|
|
|
|
+ // ),
|
|
|
|
+ // ),
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
}
|
|
}
|