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.

163 lines
5.4 KiB

// Dart imports:
import 'dart:ui';
// Project imports:
import 'package:aku_new_community_manager/const/api.dart';
import 'package:aku_new_community_manager/const/resource.dart';
import 'package:aku_new_community_manager/models/announce/announcement_detail_model.dart';
import 'package:aku_new_community_manager/models/announce/announcement_list_model.dart';
import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart';
import 'package:aku_new_community_manager/style/app_style.dart';
import 'package:aku_new_community_manager/tools/widget_tool.dart';
import 'package:aku_new_community_manager/ui/home/announcement/anouncement_details.dart';
// Flutter imports:
import 'package:aku_new_community_manager/ui/widgets/common/aku_button.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_new_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:aku_new_community_manager/utils/network/net_util.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
class AllAnouncement extends StatefulWidget {
AllAnouncement({Key? key}) : super(key: key);
@override
AllAnouncementState createState() => AllAnouncementState();
}
class AllAnouncementState extends State<AllAnouncement> {
EasyRefreshController _refreshController = EasyRefreshController();
static Widget anounceCard(AnnouncementListModel model, {String? body}) {
return Column(
children: [
AkuButton(
onPressed: () async {
BaseModel baseModel = await NetUtil().get(
API.message.announcementFindByld,
params: {'announcementId': model.id});
AnnouncementDetailModel detailModel =
AnnouncementDetailModel.fromJson(baseModel.data);
Get.to(
AnouncementDetails(
model: detailModel,
),
);
},
child: Container(
color: Color(0xFFFFFFFF),
width: double.infinity,
height: 152.w,
padding: EdgeInsets.only(top: 24.w, left: 24.w, bottom: 24.w),
child: Row(
children: [
Container(
alignment: Alignment.center,
width: 104.w,
height: 104.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(52.w),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF7EB4FF),
Color(0xFF3F8FFE),
])),
child: Image.asset(
R.ASSETS_MANAGE_IC_ANNOUNCE_PNG,
width: 74.w,
height: 60.w,
),
),
SizedBox(
width: 24.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.title!,
style: AppStyle().primaryStyle,
),
SizedBox(height: 12.w),
Row(
children: [
Text('智慧管家', style: AppStyle().minorStyle),
SizedBox(
width: 24.w,
),
Text(
model.releaseTime!,
style: AppStyle().minorStyle,
),
Spacer(),
],
),
],
),
),
],
),
),
),
SizedBox(
height: 16.w,
),
],
);
}
// Widget _anouncementList(
// String date,
// List<AnnouncementListModel> cards,
// ) {
// return Column(
// children: [
// Container(
// alignment: Alignment.center,
// width: double.infinity,
// height: 48.w + 33.w,
// child: Text(
// date,
// style: AppStyle().minorStyle,
// )),
// ...(cards
// .map(
// (e) => Container(),
// )
// .toList()),
// ],
// );
// }
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '全部公告',
body: BeeListView(
path: API.message.announcementList,
controller: _refreshController,
convert: (models) {
return models.rows
.map((e) => AnnouncementListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
itemBuilder: (context, index) {
return anounceCard(items[index]);
},
separatorBuilder: (_, __) {
return AkuBox.h(10);
},
itemCount: items.length);
}),
);
}
}