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

Custom track labels #248

Merged
merged 248 commits into from
Oct 25, 2023
Merged

Conversation

LudoPL
Copy link
Contributor

@LudoPL LudoPL commented Aug 10, 2023

Allow to customize track labels.
New version of #246
Do not hesitate to modify it as it suits you.

Afroz-Shaikh and others added 30 commits March 23, 2023 17:03
hasnentai and others added 24 commits May 31, 2023 12:35
[FEAT]: Interactivity for Needle & Shape Pointer
…ity-problem

FIX: Shape & Needle Pointer Interactivity ListView
- Due to the double/string conversion, steps were not respected
- Rename mapTrackLabel into trackLabelFormater
@hasnentai
Copy link
Contributor

Hi, @LudoPL I appreciate your efforts in adding custom labels in Radial Gauge. Since we are following an architecture and we have built a custom label for linear gauge something like the below and would like to have the same for RadialGauge as well by using the same class. Will you be willing to take a look at how we have done that by reading the Linear Guage code?

class CustomRulerLabel {
const CustomRulerLabel({
required this.text,
required this.value,
});
///
/// `text` Sets the text of the ruler label on [LinearGauge]
///
/// ```dart
/// const CustomRulerLabel(
/// text : "10$"
/// ),
/// ```
final String? text;
///
/// `value` Sets the value of the ruler label on [LinearGauge]
///
/// ```dart
/// const CustomRulerLabel(
/// value : 10
/// ),
/// ```
final double? value;
}

and here is how we are using it

void addCustomLabels({
required List<CustomRulerLabel> labelList,
}) {
_linearGaugeLabel.clear();
for (int i = 0; i < labelList.length; i++) {
_linearGaugeLabel.add(
LinearGaugeLabel(text: labelList[i].text, value: labelList[i].value));
}
}

@LudoPL
Copy link
Contributor Author

LudoPL commented Aug 25, 2023

Hi !
Sorry for the response delay, I'm in holidays.
I don't think I will spend time on it, as I am not sure I understand what you want exactly.
Of course it would be good to have more consistency between you linear and radial widget (I haven't use the linear one on my side).
But as I understand, here you have "steps" and primary and secondary rulers parameters that are all linked to the labels.
I mean if you authorize to configure Label with a list of "text + value", labels won't be aligned with rulers, and it seems to me that the library will be harder to configured.
Moreover you already have "RadialWidgetPainter" which I think are dedicated to place a list of element at a specific place on the track (can be "Text" element with label). I have done a PR to fix what seems to be some issue with it #247. My PR probably lack the possibility to configure a "shift" to place the label more inside or outside the track.
Of course it's your project so totally feel free to implement it as it suit you.
I will be happy to follow the evolution of your very useful library.

@hasnentai hasnentai changed the base branch from main to development October 25, 2023 04:52
@hasnentai hasnentai merged commit 08532dc into GeekyAnts:development Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants