buildCheckItem function

Widget buildCheckItem(
  1. String label,
  2. bool selected, {
  3. Color color = MiniColor.white,
  4. String? iconUrl,
})

é€‰æ‹Ščœå•

Implementation

Widget buildCheckItem(String label, bool selected,
    {Color color = MiniColor.white, String? iconUrl}) {
  List<Widget> items = [];
  if (iconUrl != null && UrlUtil.isUrl(iconUrl)) {
    items
      ..add(Image.network(iconUrl, width: 38, height: 28, fit: BoxFit.cover))
      ..add(const SizedBox(width: 8));
  }
  items.addAll([
    Expanded(
      child: Text(
        label,
        style: selected
            ? const TextStyle(
                fontSize: 14.0,
                color: MiniColor.blue,
                fontWeight: FontWeight.w400)
            : const TextStyle(fontSize: 14.0),
      ),
    ),
    Icon(Icons.check, color: selected ? Colors.transparent : MiniColor.blue),
  ]);

  return Container(
    color: color,
    padding: const EdgeInsets.only(left: 10, right: 10, top: 10),
    child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: items),
  );
}