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.

136 lines
4.3 KiB

4 years ago
import 'dart:ui';
import 'package:aku_community_manager/mock_models/anouncement/anouncement_model.dart';
import 'package:aku_community_manager/provider/anouncement_provider.dart';
4 years ago
import 'package:aku_community_manager/style/app_style.dart';
4 years ago
import 'package:aku_community_manager/ui/home/announcement/anouncement_details.dart';
4 years ago
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community_manager/const/resource.dart';
4 years ago
import 'package:get/get.dart';
import 'package:provider/provider.dart';
4 years ago
class AllAnouncement extends StatefulWidget {
AllAnouncement({Key key}) : super(key: key);
@override
AllAnouncementState createState() => AllAnouncementState();
4 years ago
}
class AllAnouncementState extends State<AllAnouncement> {
static Widget anounceCard(
AnouncementCardModel model
4 years ago
) {
4 years ago
return Column(
children: [
AkuButton(
4 years ago
onPressed: () {
Get.to(AnouncementDetails(
title: model.title,
date: model.date,
body: model.body==null?'':model.body,
4 years ago
));
},
4 years ago
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,
4 years ago
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,),
4 years ago
),
SizedBox(
width: 24.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
4 years ago
Text(
model.title,
4 years ago
style: AppStyle().primaryStyle,
),
4 years ago
SizedBox(height: 12.w),
Row(
children: [
Text('智慧管家', style: AppStyle().minorStyle),
SizedBox(
width: 24.w,
),
Text(
model.date,
4 years ago
style: AppStyle().minorStyle,
),
Spacer(),
],
),
],
),
),
],
),
),
),
4 years ago
SizedBox(
height: 16.w,
),
4 years ago
],
);
}
4 years ago
Widget _anouncementList(
String date,
List<AnouncementCardModel> cards,
4 years ago
) {
4 years ago
return Column(
children: [
Container(
alignment: Alignment.center,
width: double.infinity,
4 years ago
height: 48.w + 33.w,
4 years ago
child: Text(
date,
style: AppStyle().minorStyle,
)),
...(cards
.map(
(e) => anounceCard(e),
4 years ago
)
.toList()),
],
);
}
@override
Widget build(BuildContext context) {
final AnouncementProvider _anouncementProvider=Provider.of<AnouncementProvider>(context);
4 years ago
return AkuScaffold(
title: '全部公告',
body: ListView(
4 years ago
padding: EdgeInsets.only(left: 32.w, right: 32.w),
4 years ago
children: [
_anouncementList('2020-10-22', _anouncementProvider.anouncementCardModels.sublist(0,2)),
_anouncementList('2020-10-20', _anouncementProvider.anouncementCardModels.sublist(2,2)),
4 years ago
],
),
);
}
}