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

Add new apply style feature #284

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

jessejiang0214
Copy link
Contributor

Format code
Fix ProgressBar and Slider style issue
Add new way to apply style

Format code
Fix ProgressBar and Slider style issue
@@ -232,7 +232,7 @@ public static T SetEnvironment<T>(this T contextualObject, Type type, string key
return contextualObject;
}

public static T SetEnvironment<T,TValue>(this T view, Type type, string key, Binding<TValue> binding, bool cascades = true, ControlState state = ControlState.Default)
public static T SetEnvironment<T, TValue>(this T view, Type type, string key, Binding<TValue> binding, bool cascades = true, ControlState state = ControlState.Default)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future lets try and avoid white noise changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to have some tools to format code in current code base.

public const string TrackColor = "SliderTrackColor";
public const string ProgressColor = "SliderProgressColor";
public const string ThumbColor = "SliderThumbColor";
public const string TrackColor = "MinimumTrackColor";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the values changing?

Copy link
Contributor Author

@jessejiang0214 jessejiang0214 May 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause the MAUI API changed, you know the Comet.SourceGenerator project, the Slider class output file is this.

Microsoft.Maui.Graphics.Color Microsoft.Maui.ISlider.MinimumTrackColor => this.GetEnvironment<Microsoft.Maui.Graphics.Color>("MinimumTrackColor") ?? default;

Microsoft.Maui.Graphics.Color Microsoft.Maui.ISlider.MaximumTrackColor => this.GetEnvironment<Microsoft.Maui.Graphics.Color>("MaximumTrackColor") ?? default;

Microsoft.Maui.Graphics.Color Microsoft.Maui.ISlider.ThumbColor => this.GetEnvironment<Microsoft.Maui.Graphics.Color>("ThumbColor") ?? default;

Microsoft.Maui.IImageSource Microsoft.Maui.ISlider.ThumbImageSource => this.GetEnvironment<Microsoft.Maui.IImageSource>("ThumbImageSource") ?? default;

@@ -60,6 +60,11 @@ public static class View
public const string Opacity = nameof(Microsoft.Maui.IView.Opacity);
}

public static class Button
{
public const string Padding = "Padding";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being added to Button? The Padding stuff already exists on layout, and should work for any view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is MAUI button Padding property, I think it should be different from the padding of layout?

@@ -86,7 +86,6 @@ public MaterialStyle(ColorPalette colorPalette)
ProgressBar = new ProgressBarStyle
{
ProgressColor = colorPalette.P500,
TrackColor = colorPalette.P100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAUI API changed, there's no TrackColor property in Progress class

@@ -5,7 +5,6 @@ namespace Comet.Styles
{
public class ProgressBarStyle : ViewStyle
{
public StyleAwareValue<ControlState, Color> TrackColor { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAUI API changed, there's no TrackColor property in Progress class

@@ -175,7 +175,6 @@ protected virtual void ApplySliderStyle(ContextualObject view)

protected virtual void ApplyProgresBarStyle(ContextualObject view)
{
SetEnvironment(view, "", EnvironmentKeys.ProgressBar.TrackColor, ProgressBar?.TrackColor);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with above

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.

2 participants