diff --git a/lib/models/manager/rules_manage/rules_manage_list_model.dart b/lib/models/manager/rules_manage/rules_manage_list_model.dart index b02f5fd..9bb6a58 100644 --- a/lib/models/manager/rules_manage/rules_manage_list_model.dart +++ b/lib/models/manager/rules_manage/rules_manage_list_model.dart @@ -1,3 +1,5 @@ +import 'package:common_utils/common_utils.dart'; + class RulesManageListModel { int id; String title; @@ -21,4 +23,6 @@ class RulesManageListModel { data['releaseDate'] = this.releaseDate; return data; } + + String get releaseDateString => DateUtil.formatDateStr(this.releaseDate); } diff --git a/lib/ui/manage_pages/rules_manage/rules_manage_detail_page.dart b/lib/ui/manage_pages/rules_manage/rules_manage_detail_page.dart new file mode 100644 index 0000000..02520cd --- /dev/null +++ b/lib/ui/manage_pages/rules_manage/rules_manage_detail_page.dart @@ -0,0 +1,78 @@ +import 'package:aku_community_manager/models/manager/rules_manage/rules_manage_list_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class RulesManageDetailPage extends StatefulWidget { + final RulesManageListModel model; + RulesManageDetailPage({Key key, this.model}) : super(key: key); + + @override + _RulesManageDetailPageState createState() => _RulesManageDetailPageState(); +} + +class _RulesManageDetailPageState extends State { + RulesManageListModel get _detailModel => widget.model; + @override + Widget build(BuildContext context) { + return AkuScaffold( + backgroundColor: Colors.white, + title: '规程管理', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + children: [ + _detailModel.title.text + .size(32.sp) + .color(kTextPrimaryColor) + .bold + .align(TextAlign.center) + .make(), + 24.w.heightBox, + SizedBox( + width: double.infinity, + child: _detailModel.content.text + .size(28.sp) + .color(kTextPrimaryColor) + .make(), + // child: RichText( + // text: TextSpan( + // children: List.generate(_parasedText.length, (index) { + // if (index.isEven) { + // return TextSpan( + // text: _parasedText[index], + // style: TextStyle(fontSize: 28.sp, color: ktextPrimary), + // ); + // } else { + // return TextSpan( + // text: _parasedText[index], + // style: TextStyle( + // fontSize: 28.sp, + // color: Colors.lightBlue, + // ), + // recognizer: _tapLinkUrlLancher + // ..onTap = () { + // launch(_parasedText[index]); + // }); + // } + // })), + // ), + ), + 40.w.heightBox, + Row( + children: [ + Spacer(), + '发布于 ${DateUtil.formatDateStr(_detailModel.releaseDate, format: 'MM-dd HH:mm')}' + .text + .size(24.sp) + .color(kTextSubColor) + .make(), + ], + ) + ], + ), + ); + } +} diff --git a/lib/ui/manage_pages/rules_manage/rules_manage_page.dart b/lib/ui/manage_pages/rules_manage/rules_manage_page.dart index 6870de7..e9bb620 100644 --- a/lib/ui/manage_pages/rules_manage/rules_manage_page.dart +++ b/lib/ui/manage_pages/rules_manage/rules_manage_page.dart @@ -1,10 +1,12 @@ // Flutter imports: +import 'package:aku_community_manager/ui/manage_pages/rules_manage/rules_manage_detail_page.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:common_utils/common_utils.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; // Project imports: @@ -62,40 +64,45 @@ class _RulesManagePageState extends State { } Widget _buildCard(RulesManageListModel model) { - return Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.title.text - .size(32.sp) - .color(kTextPrimaryColor) - .maxLines(1) - .overflow(TextOverflow.ellipsis) - .bold - .make(), - 32.w.heightBox, - model.content.text - .size(24.sp) - .color(kTextSubColor) - .maxLines(3) - .overflow(TextOverflow.ellipsis) - .make(), - 32.w.heightBox, - Row( - children: [ - '南宁人才公寓'.text.size(20.sp).color(kTextSubColor).make(), - Spacer(), - '发布于 ${DateUtil.formatDateStr(model.releaseDate, format: 'MM-dd HH:mm')}' - .text - .size(20.sp) - .color(kTextSubColor) - .make(), - ], - ), - ], - )); + return GestureDetector( + onTap: () { + Get.to(() => RulesManageDetailPage(model: model,)); + }, + child: Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.title.text + .size(32.sp) + .color(kTextPrimaryColor) + .maxLines(1) + .overflow(TextOverflow.ellipsis) + .bold + .make(), + 32.w.heightBox, + model.content.text + .size(24.sp) + .color(kTextSubColor) + .maxLines(3) + .overflow(TextOverflow.ellipsis) + .make(), + 32.w.heightBox, + Row( + children: [ + '南宁人才公寓'.text.size(20.sp).color(kTextSubColor).make(), + Spacer(), + '发布于 ${DateUtil.formatDateStr(model.releaseDate, format: 'MM-dd HH:mm')}' + .text + .size(20.sp) + .color(kTextSubColor) + .make(), + ], + ), + ], + )), + ); } }