showPop function
void
showPop({
- required BuildContext context,
- required List<
Widget> items, - double? top,
- double? left,
- double? right,
- double width = 100,
- double cellHeight = 40,
- Color backgroundColor = Colors.white,
- Color dividerColor = const Color(0xFFE6E6E6),
- required Color barrierColor,
- bool barrierDismissible = true,
- ClickCallBack? clickCallback,
Implementation
void showPop({
required BuildContext context,
required List<Widget> items,
double? top,
double? left,
double? right,
double width = 100,
double cellHeight = 40,
Color backgroundColor = Colors.white,
Color dividerColor = const Color(0xFFE6E6E6),
required Color barrierColor,
bool hiddenArrow = false,
bool barrierDismissible = true,
ClickCallBack? clickCallback,
}) {
Widget _buildMenuLineCell(dataArr) {
return MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView.separated(
itemCount: dataArr.length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
Navigator.pop(context);
if (clickCallback != null) {
clickCallback(index);
}
},
child: Container(
height: cellHeight,
margin: EdgeInsets.only(
left: 10,
),
child: Align(
alignment: Alignment.centerLeft,
child: dataArr[index],
),
));
},
separatorBuilder: (context, index) {
return Divider(
height: 0.1,
color: dividerColor,
);
},
),
);
}
showPopView(
context: context,
widget: _buildMenuLineCell(items),
top: top,
left: left,
right: right,
width: width,
height: cellHeight * items.length,
backgroundColor: backgroundColor,
barrierColor: barrierColor,
hiddenArrow: hiddenArrow,
barrierDismissible: barrierDismissible,
);
}