|
|
@ -1,13 +1,16 @@
|
|
|
|
import 'package:aku_community/base/base_style.dart';
|
|
|
|
import 'package:aku_community/base/base_style.dart';
|
|
|
|
import 'package:aku_community/constants/api.dart';
|
|
|
|
import 'package:aku_community/constants/api.dart';
|
|
|
|
import 'package:aku_community/models/news/news_detail_model.dart';
|
|
|
|
import 'package:aku_community/models/news/news_detail_model.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community/utils/link_text_parase.dart';
|
|
|
|
import 'package:aku_community/utils/network/base_model.dart';
|
|
|
|
import 'package:aku_community/utils/network/base_model.dart';
|
|
|
|
import 'package:aku_community/utils/network/net_util.dart';
|
|
|
|
import 'package:aku_community/utils/network/net_util.dart';
|
|
|
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
|
|
|
import 'package:aku_community/widget/bee_scaffold.dart';
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
import 'package:flustars/flustars.dart';
|
|
|
|
import 'package:flustars/flustars.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/gestures.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -25,15 +28,19 @@ class _PublicInformationDetailPageState
|
|
|
|
late EasyRefreshController _easyRefreshController;
|
|
|
|
late EasyRefreshController _easyRefreshController;
|
|
|
|
bool _onload = true;
|
|
|
|
bool _onload = true;
|
|
|
|
late NewsDetailModel _detailModel;
|
|
|
|
late NewsDetailModel _detailModel;
|
|
|
|
|
|
|
|
late List<String> _parasedText;
|
|
|
|
|
|
|
|
late TapGestureRecognizer _tapLinkUrlLancher; //设置单击手势识别器
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
_easyRefreshController = EasyRefreshController();
|
|
|
|
_easyRefreshController = EasyRefreshController();
|
|
|
|
|
|
|
|
_tapLinkUrlLancher = TapGestureRecognizer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
_easyRefreshController.dispose();
|
|
|
|
_easyRefreshController.dispose();
|
|
|
|
|
|
|
|
_tapLinkUrlLancher.dispose(); //释放手势识别器资源
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -52,6 +59,7 @@ class _PublicInformationDetailPageState
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (baseModel.status! && baseModel.data != null) {
|
|
|
|
if (baseModel.status! && baseModel.data != null) {
|
|
|
|
_detailModel = NewsDetailModel.fromJson(baseModel.data);
|
|
|
|
_detailModel = NewsDetailModel.fromJson(baseModel.data);
|
|
|
|
|
|
|
|
_parasedText = LinkTextParase.stringParase(_detailModel.content);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
BotToast.showText(text: '无法获取信息');
|
|
|
|
BotToast.showText(text: '无法获取信息');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -72,10 +80,29 @@ class _PublicInformationDetailPageState
|
|
|
|
24.w.heightBox,
|
|
|
|
24.w.heightBox,
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: _detailModel.content.text
|
|
|
|
child: RichText(
|
|
|
|
.size(28.sp)
|
|
|
|
text: TextSpan(
|
|
|
|
.color(ktextPrimary)
|
|
|
|
children: List.generate(_parasedText.length, (index) {
|
|
|
|
.make(),
|
|
|
|
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,
|
|
|
|
40.w.heightBox,
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|