diff --git a/lib/pages/service_browse/service_browse_detail_page.dart b/lib/pages/service_browse/service_browse_detail_page.dart new file mode 100644 index 00000000..d3997d1e --- /dev/null +++ b/lib/pages/service_browse/service_browse_detail_page.dart @@ -0,0 +1,87 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/models/service_browse/service_browse_list_mode.dart'; +import 'package:aku_community/utils/link_text_parase.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class ServiceBrowseDetailPage extends StatefulWidget { + final ServiceBrowseListModel model; + ServiceBrowseDetailPage({Key? key, required this.model}) : super(key: key); + + @override + _ServiceBrowseDetailPageState createState() => + _ServiceBrowseDetailPageState(); +} + +class _ServiceBrowseDetailPageState extends State { + ServiceBrowseListModel get _detailModel => widget.model; + late List _parasedText; + late TapGestureRecognizer _tapLinkUrlLancher; //设置单击手势识别器 + @override + void initState() { + super.initState(); + _tapLinkUrlLancher = TapGestureRecognizer(); + _parasedText = LinkTextParase.stringParase(widget.model.content); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '服务浏览', + bodyColor: Colors.white, + body: ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + children: [ + _detailModel.name.text + .size(32.sp) + .color(ktextPrimary) + .bold + .align(TextAlign.center) + .make(), + 24.w.heightBox, + SizedBox( + width: double.infinity, + 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.createDate, format: 'MM-dd HH:mm')}' + .text + .size(24.sp) + .color(ktextSubColor) + .make(), + ], + ) + ], + ), + ); + } +} diff --git a/lib/pages/service_browse/service_browse_page.dart b/lib/pages/service_browse/service_browse_page.dart index 2ffe1dea..0fed5e6a 100644 --- a/lib/pages/service_browse/service_browse_page.dart +++ b/lib/pages/service_browse/service_browse_page.dart @@ -56,10 +56,14 @@ class _ServiceBrowsePageState extends State { } Widget _buildCard(ServiceBrowseListModel model) { - return Container( + return MaterialButton( + onPressed: () { + + }, + elevation: 0, color: Colors.white, padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), - width: double.infinity, + minWidth: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [