import 'package:aman_kassa_flutter/core/models/choice.dart'; import 'package:aman_kassa_flutter/shared/app_colors.dart'; import 'package:flutter/material.dart'; const List choices = const [ const Choice(title: 'Обновить номенклатуру', icon: Icons.update, command: 'update'), const Choice(title: 'Помощь', icon: Icons.help, command: 'help'), const Choice(title: 'О Программе', icon: Icons.info_outline, command: 'info'), const Choice(title: 'Язык', icon: Icons.language, command: 'language'), const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit') ]; class PopupMenu extends StatelessWidget { final void Function(Choice value) onSelectChoice; PopupMenu({this.onSelectChoice}); @override Widget build(BuildContext context) { return PopupMenuButton( icon: Icon( Icons.more_vert, color: menuColor, ), onSelected: onSelectChoice, itemBuilder: (BuildContext context) { return choices.map((Choice choice) { return PopupMenuItem( value: choice, child: Row(children: [ Icon(choice.icon, color: primaryColor,), Text(choice.title) ], ), ); }).toList(); }, ); } }