buildItem method
Implementation
Widget buildItem(int index, BuildContext context, TolyPopPickerTheme theme) {
bool disable = tasks[index].task == null;
TextStyle? itemStyle =
disable ? theme.disabledItemTextStyle : theme.itemTextStyle;
return Material(
child: InkWell(
onTap: disable
? null
: () async {
_cancelTap(context);
if (tasks[index].task != null) {
await tasks[index].task?.call();
}
},
child: Ink(
height: theme.itemHeight,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: theme.backgroundColor,
border: Border(
bottom: index != tasks.length - 1
? BorderSide(
color: Colors.grey.withOpacity(0.2), width: 0.5)
: BorderSide.none)),
child: Container(
padding: theme.itemPadding,
child: Center(
child: tasks[index].content ??
Text(
tasks[index].info,
style: itemStyle,
),
),
),
)),
);
}