import 'package:flutter/material.dart'; class _Action { String title; VoidCallback callback; _Action(this.title, this.callback); } class DisplayOptionsDialog extends StatelessWidget { final List<_Action> _actions = [ _Action('Blank', () { print('Blank screen'); }), _Action('Theme', () { print('Theme screen'); }), _Action('Desktop', () { print('Desktop screen'); }), _Action('Show', () { print('Show screen'); }), ]; @override Widget build(BuildContext context) { return SimpleDialog( contentPadding: EdgeInsets.all(20.0), children: _actions .map((action) => OutlineButton( color: Colors.red, child: Text(action.title), onPressed: () { action.callback(); Navigator.of(context).pop(); }, )) .toList(), ); } }