PlansCompareFeedItemView.dart 4.11 KB
Newer Older
朱翠翠's avatar
朱翠翠 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';

class PlansCompareFeedItemView extends StatelessWidget {
  Plans plan;
  int groupValue = 1;

  PlansCompareFeedItemView(this.plan);

  @override
  Widget build(BuildContext context) {
    return Container(child: getItem());
  }

  getItem() {
    if (plan.planType == 1) {
      return getFirstLevelItem();
    } else {
      return getSecondLevelItem();
    }
  }

  getFirstLevelItem() {
    Container(
      margin: EdgeInsets.all(4.0),
      child: Row(
        children: <Widget>[
          Radio(
              value: 1,
              groupValue: groupValue,
              onChanged: (value) {
                groupValue = value;
              }),
          ClipRRect(
            borderRadius: BorderRadius.circular(2.0),
            child: Image.network(
              plan.projectImage,
              width: 50,
              height: 50,
              fit: BoxFit.fill,
            ),
          ),
          Expanded(
              child: Container(
            margin: EdgeInsets.only(left: 8.0),
            height: 50,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Row(
                  children: <Widget>[
                    Text(
                      plan.name,
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: 14,
                          color: Color(0xFF282828)),
                      maxLines: 1,
                    ),
                    Text(
                      "好评率 ",
                      style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
                      maxLines: 1,
                    ),
                    Text(
                      plan.positiveRate,
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: 14,
                          color: Color(0xFFFF5963)),
                      maxLines: 1,
                    ),
                  ],
                ),
                Row(
                  children: <Widget>[
                    Text(
                      '¥${plan.minPrice}-${plan.maxPrice})',
                      style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
                    ),
                    Text(
                      "销量${plan.salesCount}",
                      style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
                      maxLines: 1,
                    )
                  ],
                )
              ],
            ),
          ))
        ],
      ),
    );
  }

  getSecondLevelItem() {
    Container(
      margin: EdgeInsets.all(4.0),
      child: Row(
        children: <Widget>[
          Radio(
              value: 1,
              groupValue: groupValue,
              onChanged: (value) {
                groupValue = value;
              }),
          Expanded(
              child: Container(
            margin: EdgeInsets.only(left: 8.0),
            height: 50,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  plan.name,
                  style: TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: 14,
                      color: Color(0xFF282828)),
                  maxLines: 1,
                ),
                Row(
                  children: <Widget>[
                    Text(
                      '¥${plan.minPrice}-${plan.maxPrice})',
                      style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
                    ),
                    Text(
                      "指导价:¥${plan.guidePrice}",
                      style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
                      maxLines: 1,
                    )
                  ],
                )
              ],
            ),
          ))
        ],
      ),
    );
  }
}