Skip to content
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

Change "DONE" button text #2

Closed
88hitman opened this issue Nov 25, 2020 · 7 comments
Closed

Change "DONE" button text #2

88hitman opened this issue Nov 25, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@88hitman
Copy link

Hi ! Firstly, thanks a lot for this plugin, its awesome

Then, I would like to be able to change the "DONE" button text by a text of my choice.
Can you please take a look to provide us a way to change it ? Thank you

@mehdizarepour
Copy link
Owner

Hi @88hitman, Thank you for opening this issue.
Actually, I was thinking about it! I was planning to add a decoration property to make customizable every text or icon.

Something like this:

TextEditor(
  fonts: fonts,
  text: text,
  textStyle: textStyle,
  textAlingment: textAlign,
  decoration: EditorDecoration(
    doneButton: Text('Close'), // Or Icon(Icons.close)
    alignment: AlignmentDecoration(
      right: ...,
      left: ...,
      center: ...,
    ),
    ...
  )
  onEditCompleted: (style, align, text) {
    setState(() {
      _text = text;
      _textStyle = style;
      _textAlign = align;
    });
  },
)

@mehdizarepour mehdizarepour self-assigned this Nov 26, 2020
@mehdizarepour mehdizarepour added the enhancement New feature or request label Nov 26, 2020
@88hitman
Copy link
Author

This is exactly what I was looking for:)

By the way, do you plan to let us choose a list of colors in this EditorDecoration widget ?
Thks !

@mehdizarepour
Copy link
Owner

Do you mean the colors of the palette?

@88hitman
Copy link
Author

Yes exactly, I saw that you hard coded color values in your ColorPalette class. Is it final ?

@mehdizarepour
Copy link
Owner

No, It's not final.
You would be able to change those colors by EditorDecoration too.

@88hitman
Copy link
Author

Glad to hear it, thank you

@mehdizarepour
Copy link
Owner

Hi @88hitman
I've decided not to add the palette's color property to decoration. Instead, I added an optional property named paletteColors to TextEditor class, you can pass your custom colors to paletteColors property.

TextEditor(
  fonts: fonts,
  text: text,
  textStyle: textStyle,
  textAlingment: textAlign,
+  paletteColors: [
+    Colors.black,
+    Colors.white,
+    Colors.blue,
+    Colors.red,
+    Colors.green,
+    Colors.yellow,
+    Colors.pink,
+    Colors.cyanAccent,
+  ],
+  decoration: EditorDecoration(
+    doneButton: Icon(Icons.close, color: Colors.white),
+    fontFamily: Icon(Icons.title, color: Colors.white),
+    colorPalette: Icon(Icons.palette, color: Colors.white),
+    alignment: AlignmentDecoration(
+      left: Text(
+        'left',
+        style: TextStyle(color: Colors.white),
+      ),
+      center: Text(
+        'center',
+        style: TextStyle(color: Colors.white),
+      ),
+      right: Text(
+        'right',
+        style: TextStyle(color: Colors.white),
+      ),
+    ),
+  ),
),

I'm closing this issue, feel free to reopen it if you have any problem.
thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants