-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom color of image editor icon #38
Comments
Thanks for your future request. May I ask, do you need to change the color of every icon differently, or you just want to change a set of color? For example, if you want to change the icon color of all icons inside the As example: imageEditorTheme: const ImageEditorTheme(
appBarBackgroundColor: Color(0xFF000000),
appBarForegroundColor: Color(0xFFFFFFFF),
paintingEditor: PaintingEditorTheme(
appBarBackgroundColor: Color.fromARGB(255, 20, 99, 189),
appBarForegroundColor: Color(0xFFE1E1E1),
bottomBarColor: Color.fromARGB(255, 136, 0, 84),
bottomBarActiveItemColor: Color.fromARGB(255, 46, 0, 58),
bottomBarInactiveItemColor: Color.fromARGB(255, 223, 255, 210),
),
textEditor: TextEditorTheme(
appBarBackgroundColor: Color.fromARGB(255, 0, 17, 255),
appBarForegroundColor: Color(0xFFE1E1E1),
),
) |
Hi @hm21. Some icon dont have such as |
Move all theme based configurations from `EmojiEditorConfigs` to `EmojiEditorTheme` within `ImageEditorTheme`. This resolves issue #38.
Hi @thanglq1 Exactly, the The Is this enough, or do you need to have the possibility to change the color of each icon separately? Actually, I can add an option for each icon to set a separate color, but I'm a bit afraid that it will be too many theme configurations which will make it hard for users to understand the theme configurations. For a lot of customization, I currently give the users the option to replace the full |
Thank you. I will close this issue. |
Hi @hm21. Sorry, I think I need reopen this issue. In |
Do you need to change a different color for each icon, or just the same color for all? If you want to change the same color for all, you can change the imageEditorTheme: const ImageEditorTheme(
appBarForegroundColor: Colors.black,
) |
How to custom a different color of each icon? And when I use custom widget Icon, dont have option to change color of |
In the paint editor in the bottom bar you can set |
Yes, I saw your example and I tried to change the color of paint editor. I added the below code but it does not work (when we custom widget, custom bottomBar)
|
Did I understand you correctly that in custom widgets you set your own appbar and bottombar for the image editor, right? If yes, then you need to set the color in the custom widget because you are overriding the existing stuff with your widget. If you use the code from the example, you can change it here: Builder(
builder: (_) {
var item = paintModes[index];
var color = editorKey.currentState?.paintingEditor
.currentState?.paintMode ==
item.mode
? imageEditorPrimaryColor // TODO: set here your selected color
: const Color(0xFFEEEEEE);
return FlatIconTextButton(
label: Text(
item.label,
style: TextStyle(fontSize: 10.0, color: color),
),
icon: Icon(item.icon, color: color),
onPressed: () {
editorKey
.currentState?.paintingEditor.currentState
?.setMode(item.mode);
setState(() {});
},
);
},
), |
I'm following your example. I can not change color of paint editor.
following your example code here
|
As I said in my post before, you need to change the color inside the custom widget because you are overriding the existing one. It's useless to do anything in the theme if you create your own widget. Below is the updated version of your code that you use from the example that set the color to red and yellow: final List<PaintModeBottomBarItem> paintModes = [
const PaintModeBottomBarItem(
mode: PaintModeE.freeStyle,
icon: Icons.edit,
label: 'Freestyle',
),
const PaintModeBottomBarItem(
mode: PaintModeE.arrow,
icon: Icons.arrow_right_alt_outlined,
label: 'Arrow',
),
const PaintModeBottomBarItem(
mode: PaintModeE.line,
icon: Icons.horizontal_rule,
label: 'Line',
),
const PaintModeBottomBarItem(
mode: PaintModeE.rect,
icon: Icons.crop_free,
label: 'Rectangle',
),
const PaintModeBottomBarItem(
mode: PaintModeE.circle,
icon: Icons.lens_outlined,
label: 'Circle',
),
const PaintModeBottomBarItem(
mode: PaintModeE.dashLine,
icon: Icons.power_input,
label: 'Dash line',
),
];
Widget _bottomBarPaintingEditor(BoxConstraints constraints) {
return StreamBuilder(
stream: _updateUIStream.stream,
builder: (_, __) {
return Scrollbar(
controller: _bottomBarScrollCtrl,
scrollbarOrientation: ScrollbarOrientation.top,
thickness: isDesktop ? null : 0,
child: BottomAppBar(
height: kBottomNavigationBarHeight,
// color: Colors.black,
color: Colors.green,
padding: EdgeInsets.zero,
child: Center(
child: SingleChildScrollView(
controller: _bottomBarScrollCtrl,
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: min(constraints.maxWidth, 500),
maxWidth: 500,
),
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.spaceAround,
children: <Widget>[
FlatIconTextButton(
label: Text('My Button',
style:
_bottomTextStyle.copyWith(color: Colors.amber)),
icon: const Icon(
Icons.new_releases_outlined,
size: 22.0,
color: Colors.amber,
),
onPressed: () {},
),
...List.generate(
paintModes.length,
(index) => Builder(
builder: (_) {
var item = paintModes[index];
/// TODO: set your colors below
var color = editorKey.currentState?.paintingEditor
.currentState?.paintMode ==
item.mode
? Colors.red
: Colors.yellow;
return FlatIconTextButton(
label: Text(
item.label,
style: TextStyle(fontSize: 10.0, color: color),
),
icon: Icon(item.icon, color: color),
onPressed: () {
editorKey
.currentState?.paintingEditor.currentState
?.setMode(item.mode);
setState(() {});
},
);
},
),
),
],
),
),
),
),
),
);
},
);
} |
Yes, my bad. I forgot change this. So will close this issue.
|
Platforms
Android, iOS
Description
Currently, ImageEditorIcons only support custom image editor icons. It would be even better if we could customize the color of the image editor icons as well
The text was updated successfully, but these errors were encountered: