Skip to content

Instantly share code, notes, and snippets.

@Zujaj
Last active February 9, 2021 08:54
Show Gist options
  • Save Zujaj/379da35c443f32d16293772757d53fc6 to your computer and use it in GitHub Desktop.
Save Zujaj/379da35c443f32d16293772757d53fc6 to your computer and use it in GitHub Desktop.
A Demo page that displays an Elevated Button
import 'package:flutter/material.dart';
import 'package:multiple_selection_dialogue_app/widgets/multi_select_dialog.dart';
/// A demo page that displays an [ElevatedButton]
class DemoPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
/// Stores the selected flavours
List<String> flavours = [];
return ElevatedButton(
child: Text('Flavours'),
onPressed: () async {
flavours = await showDialog<List<String>>(
context: context,
builder: (_) => MultiSelectDialog(
question: Text('Select Your Flavours'),
answers: [
'Chocolate',
'Caramel',
'Vanilla',
'Peanut Butter'
])) ??
[];
print(flavours);
// Logic to save selected flavours in the database
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment