You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
3.9 KiB
107 lines
3.9 KiB
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:open_file/open_file.dart';
|
|
|
|
import 'package:aku_new_community/constants/saas_api.dart';
|
|
import 'package:aku_new_community/models/home/announce_detail_model.dart';
|
|
import 'package:aku_new_community/utils/headers.dart';
|
|
import 'package:aku_new_community/utils/network/base_model.dart';
|
|
import 'package:aku_new_community/utils/network/net_util.dart';
|
|
import 'package:aku_new_community/widget/bee_image_network.dart';
|
|
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
|
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
|
|
import 'package:aku_new_community/widget/views/bee_download_view.dart';
|
|
import 'package:aku_new_community/widget/views/doc_view.dart';
|
|
|
|
class NoticeDetailPage extends StatefulWidget {
|
|
final int? id;
|
|
|
|
NoticeDetailPage({Key? key, required this.id}) : super(key: key);
|
|
|
|
@override
|
|
_NoticeDetailPageState createState() => _NoticeDetailPageState();
|
|
}
|
|
|
|
class _NoticeDetailPageState extends State<NoticeDetailPage> {
|
|
EasyRefreshController _refreshController = EasyRefreshController();
|
|
AnnounceDetailModel? model;
|
|
|
|
Widget get emptyWidget => Column(
|
|
children: [],
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BeeScaffold(
|
|
title: '社区公告',
|
|
body: EasyRefresh(
|
|
controller: _refreshController,
|
|
header: MaterialHeader(),
|
|
onRefresh: () async {
|
|
BaseModel baseModel = await NetUtil().get(
|
|
SAASAPI.announce.detail,
|
|
params: {'announcementId': widget.id},
|
|
);
|
|
if (baseModel.data != null) {
|
|
model = AnnounceDetailModel.fromJson(baseModel.data);
|
|
}
|
|
setState(() {});
|
|
},
|
|
firstRefresh: true,
|
|
firstRefreshWidget: emptyWidget,
|
|
child: model == null
|
|
? SizedBox()
|
|
: ListView(
|
|
padding: EdgeInsets.all(32.w),
|
|
children: [
|
|
model!.title.text.size(32.sp).bold.make(),
|
|
50.hb,
|
|
...model!.annexImgList
|
|
.map(
|
|
(e) => GestureDetector(
|
|
onTap: () {
|
|
BeeImagePreview.toPath(
|
|
path: e.url,
|
|
tag: '${e.url!}${e.hashCode}',
|
|
);
|
|
},
|
|
child: Hero(
|
|
tag: '${e.url!}${e.hashCode}',
|
|
child: Container(
|
|
clipBehavior: Clip.antiAlias,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
color: Colors.black12,
|
|
),
|
|
child: BeeImageNetwork(
|
|
urls: [e.url ?? ''],
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
.toList(),
|
|
44.hb,
|
|
model!.content.text.size(28.sp).make(),
|
|
43.hb,
|
|
...model!.annexImgList
|
|
.map((e) => DocViw(
|
|
title: e.url ?? '',
|
|
onPressed: () async {
|
|
String? result = await Get.dialog(BeeDownloadView(
|
|
file: SAASAPI.image(e.url),
|
|
));
|
|
if (result != null) OpenFile.open(result);
|
|
},
|
|
))
|
|
.toList(),
|
|
],
|
|
),
|
|
).material(color: Colors.white),
|
|
);
|
|
}
|
|
}
|