build method
- @override
- BuildContext context,
- PresetBuilder model
override
Builds the UI according to the state in model
.
Implementation
@override
Widget build(BuildContext context, PresetBuilder model) => AlertDialog(
title: const Text("Save a preset"),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 50,
width: double.infinity,
child: TextField(
controller: model.nameController,
decoration: const InputDecoration(hintText: "Preset Name"),
),
),
],
),
actions: [
TextButton(child: const Text("Cancel"), onPressed: () => Navigator.of(context).pop()),
ElevatedButton(
onPressed: model.isValid ? () {model.save(); Navigator.of(context).pop(); } : null,
child: const Text("Save"),
),
],
);