aman-kassa-flutter/lib/views/home/components/popup_menu.dart

42 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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<Choice> choices = const <Choice>[
//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<Choice>(
icon: Icon(
Icons.more_vert,
color: menuColor,
),
onSelected: onSelectChoice,
itemBuilder: (BuildContext context) {
return choices.map((Choice choice) {
return PopupMenuItem<Choice>(
value: choice,
child: Row(children: <Widget>[
Icon(choice.icon, color: primaryColor,),
SizedBox(width: 5,),
Text(choice.title)
], ),
);
}).toList();
},
);
}
}