| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:trackoffical_app/view/mapto/map_to_controller.dart';
- import '../../generated/assets.dart';
- import '../../screen.dart';
- import 'package:trackoffical_app/pb.dart' as pb;
- class ActivityView extends GetView {
- const ActivityView(this.data, {super.key});
- // final MapToController mapToController = Get.find();
- final List<pb.MapActivitySimpleInfo> data;
- @override
- Widget build(BuildContext context) {
- return Container(
- width: 25.69.wp,
- height: context.height,
- padding: EdgeInsets.symmetric(horizontal: 1.wp, vertical: 1.wp),
- decoration: BoxDecoration(
- color: Colors.white,
- // borderRadius: BorderRadius.circular(8),
- // shape: BoxShape.rectangle,
- boxShadow: [
- BoxShadow(
- color: const Color(0x33000000),
- offset: Offset(-0.28.wp, 0.21.wp),
- blurRadius: 0.42.wp)
- ],
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [wActivitys()],
- ),
- );
- }
- Widget wActivitys() {
- // var data = mapToController.mapActivitySimpleInfo;
- return Expanded(
- child: ListView.builder(
- padding: EdgeInsets.only(top: 0.wp),
- itemCount: data.length,
- itemBuilder: (ctx, i) {
- return _wElem(ctx, i);
- }));
- }
- Widget _wElem(BuildContext ctx, int i) {
- return Obx(() {
- var info = data[i].obs;
- return GestureDetector(
- // onTap: info.isOpen? ()=>ActivityDetailView.to(info): null,
- child: Container(
- margin: EdgeInsets.only(left: 0.wp, right: 0.wp, top: 0.wp, bottom: 1.wp),
- // padding: EdgeInsets.only(left: 0.8.wp, right: 0.8.wp, top: 0.8.wp, bottom: 0.8.wp),
- padding: EdgeInsets.all(0.8.wp),
- decoration: BoxDecoration(
- color: const Color(0xffe0e0e0),
- borderRadius: BorderRadius.circular(0.35.wp),
- ),
- child: Column(
- children: [
- _activityTitle(info.value.name, info.value.totalControlNum),
- _activityControl(info.value.totalControlNum),
- ],
- ),
- ));
- });
- }
- Widget _activityTitle(String title, int num) {
- return Container(
- padding: EdgeInsets.only(bottom: 1.wp),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- // SizedBox(
- // width: 20.wp,
- // child: Text.rich(
- // softWrap: false,
- // maxLines: 1,
- // overflow: TextOverflow.ellipsis,
- // TextSpan(
- // text: title,
- // style: TextStyle(fontSize: 1.39.wp, fontWeight: FontWeight.w700, color: Color(0xff333333)),
- // children: [
- // TextSpan(
- // text: "($num人)",
- // style: TextStyle(fontSize: 1.11.wp, fontWeight: FontWeight.w500, color: Color(0xff333333)),
- // ),
- // ])),
- // ),
- SizedBox(
- width: 16.8.wp,
- child: Text(title,
- softWrap: false,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 1.39.wp,
- fontWeight: FontWeight.w700,
- color: Color(0xff333333))),
- ),
- SizedBox(width: 0.3.wp),
- Text("($num人)",
- style: TextStyle(
- fontSize: 1.11.wp,
- fontWeight: FontWeight.w500,
- color: Color(0xff333333))),
- SizedBox(width: 0.6.wp),
- Image.asset(
- Assets.imagesIcArrowUp,
- height: 0.86.wp,
- fit: BoxFit.fitHeight,
- ),
- ],
- ),
- );
- }
- Widget _activityControl(int totalControlNum) {
- return Container(
- padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(0.42.wp),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Row(
- children: [
- Text("广播"),
- SizedBox(width: 0.5.wp),
- Image.asset(
- Assets.imagesIcBullhorn,
- height: 1.33.wp,
- fit: BoxFit.fitHeight,
- ),
- ],
- ),
- Row(
- children: [
- Image.asset(
- Assets.imagesIcCp,
- height: 1.35.wp,
- fit: BoxFit.fitHeight,
- ),
- SizedBox(width: 0.3.wp),
- Text("$totalControlNum"),
- ],
- ),
- Row(
- children: [
- Text("全部隐藏"),
- SizedBox(width: 0.5.wp),
- Image.asset(
- Assets.imagesIcEye,
- height: 1.1.wp,
- fit: BoxFit.fitHeight,
- ),
- ],
- ),
- ],
- )
- );
- }
- Widget wUserList() {
- return Expanded(
- child: ListView.builder(
- padding: EdgeInsets.only(top: 0.wp),
- itemCount: data.length,
- itemBuilder: (ctx, i) {
- return _wUserElem(ctx, i);
- }));
- }
- Widget _wUserElem(BuildContext ctx, int i) {
- return Container(
- padding: EdgeInsets.symmetric(vertical: 0.8.wp, horizontal: 1.wp),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(0.42.wp),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- ],
- )
- );
- }
- }
|