-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christopher Wolf
committed
Aug 12, 2024
1 parent
72b58f2
commit e6e88e8
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ColorPickerDialog { | ||
static Future<Color?> selectColorDialog(List<Color> colors, BuildContext context) async { | ||
return await showDialog<Color>( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return SimpleDialog( | ||
title: const Text('Select color'), | ||
children: [ | ||
...colors.map((color) => | ||
SimpleDialogOption( | ||
onPressed: () { Navigator.pop(context, color); }, | ||
child: Container( | ||
width: 48, | ||
height: 48, | ||
decoration: BoxDecoration( | ||
shape: BoxShape.circle, | ||
color: color), | ||
), | ||
) | ||
)] | ||
); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters