createItems static method

List<Widget> createItems(
  1. BuildContext context,
  2. String title,
  3. dynamic values,
  4. String id, {
  5. bool hasTitle = true,
})

Implementation

static List<Widget> createItems(BuildContext context, String title, values, String id, {bool hasTitle = true}) {
  final line = Container(color: Colors.grey.shade300, height: 2.sp);
  List<Widget> list = [];
  if (hasTitle) {list.add(SizedBox(height: 120.sp, child: Center(
        child: LabelCustom(title, color: Colors.black87))));}
  for (var i = 0; i < values.length; i++) {
    list.add(line);
    list.add(OutlinedButton(
        style: OutlinedButton.styleFrom(
            side: const BorderSide(
              color: Colors.transparent,
            ),
            padding: EdgeInsets.zero),
        onPressed: () => Navigator.of(context).pop(values[i]),
        child: Container(color: id != values[i].id.toString() ? Colors.transparent : StyleCustom.buttonColor,
            width: 1.sw, height: 148.sp, alignment: Alignment.center,
            child: LabelCustom(values[i].name,
                color: id != values[i].id.toString() ? StyleCustom.primaryColor : Colors.white))));
  }
  return list;
}