123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import 'package:dotted_border/dotted_border.dart';
- import 'package:flutter/material.dart';
- import '../../base/YSTools.dart';
- class YSInstitutionListItemView extends StatefulWidget {
- final Map item;
- const YSInstitutionListItemView({Key key, this.item}) : super(key: key);
- @override
- _YSInstitutionListItemViewState createState() => _YSInstitutionListItemViewState();
- }
- class _YSInstitutionListItemViewState extends State<YSInstitutionListItemView> {
- @override
- Widget build(BuildContext context) {
- List array = widget.item['voucherDepartmentList']??[];
- bool isOpen = widget.item['isOpen']??false;
- int length = array.length;
- if(isOpen==false){
- length = array.length>2?2:array.length;
- }
- return DottedBorder(
- color: Color(0xFFFF6D96),
- borderType: BorderType.RRect,
- radius: Radius.circular(9),
- strokeWidth: 1,
- padding: EdgeInsets.all(0),
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(9))
- ),
- child: LayoutBuilder(
- builder: (context,conSize){
- return Column(
- children: [
- Container(
- child: Text(widget.item['hospitalName'],style: TextStyle(fontSize: 16,color: Color(0xFFEE6B8F)),maxLines: 1,),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(top: 10),
- ),
- SizedBox(
- height: 30,
- child: Row(
- children: [
- Container(
- width: conSize.maxWidth*0.7,
- child: Text('服务券',style: TextStyle(fontSize: 14,color: Color(0xFF444444)),),
- alignment: Alignment.centerLeft,
- ),
- Container(
- width: conSize.maxWidth*0.3,
- child: Text('科室',style: TextStyle(fontSize: 14,color: Color(0xFF444444)),),
- alignment: Alignment.centerRight,
- )
- ],
- ),
- ),
- ListView.builder(
- itemBuilder: (context,indexSub){
- Map itemSub = array[indexSub];
- return SizedBox(
- height: 20,
- child: Row(
- children: [
- Container(
- width: conSize.maxWidth*0.7,
- child: Text(itemSub['couponName'],style: TextStyle(fontSize: 12,color: Color(0xFF8A8A8A)),),
- alignment: Alignment.centerLeft,
- ),
- Container(
- width: conSize.maxWidth*0.3,
- child: Text(itemSub['departmentName'],style: TextStyle(fontSize: 12,color: Color(0xFF8A8A8A)),),
- alignment: Alignment.centerRight,
- )
- ],
- ),
- );
- },
- itemCount: length,
- padding: EdgeInsets.all(0),
- physics: NeverScrollableScrollPhysics(),
- shrinkWrap: true,
- ),
- array.length>2?Container(
- height: 30,
- child: GestureDetector(
- onTap: (){
- if(widget.item['isOpen']==true){
- widget.item['isOpen'] = false;
- }else{
- widget.item['isOpen'] = true;
- }
- setState(() {});
- },
- behavior: HitTestBehavior.opaque,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(isOpen?'收起':'显示更多',style: TextStyle(fontSize: 10,color: Color(0xFFD8D8D8)),),
- Icon(isOpen?Icons.keyboard_arrow_up:Icons.keyboard_arrow_down,size: 15,color: Color(0xFFD8D8D8),)
- ],
- ),
- ),
- ):Container(height: 10,),
- DashLine(height: 1,color: Color(0xFF979797),),
- Padding(
- padding: EdgeInsets.only(top: 10,bottom: 10),
- child: Row(
- children: [
- Container(
- width: conSize.maxWidth-10,
- child: Text('${widget.item['hospitalAddress']} | ${widget.item['businessHoursInformation']}',style: TextStyle(fontSize: 14,color: Color(0xFF444444)),),
- alignment: Alignment.centerLeft,
- ),
- // Image.asset('lib/images/地址_fy.png',height: 10,width: 10,)
- ],
- ),
- )
- ],
- );
- },
- ),
- padding: EdgeInsets.only(left: 15,right: 15),
- ),
- );
- }
- }
|