Skip to content

Conversation

@igorls
Copy link
Contributor

@igorls igorls commented Jun 27, 2017

New class Material.Button according to the guidelines, adjustments are still needed. Current options are Raised/Flat, Enabled/Disabled, Background and Ink (ripple) colors.

Demo added to the MainView.ux

Also adding Roboto default font:
Default Material typeface should be Roboto per the guidelines, changed Material.Text class to comply with https://material.io/guidelines/style/typography.html

@@ -0,0 +1,71 @@
<Panel ux:Class="Material.Button" Alignment="Center" Enabled="true" Raised="true" Height="48" MinWidth="88" Padding="8,0" HitTestMode="LocalBoundsAndChildren" BackgroundColor="White" InkColor="#ccc">
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would use HitTestMode="LocalBounds" instead, that seems sufficient

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

<float4 ux:Property="BackgroundColor"/>
<float4 ux:Property="InkColor"/>

<Rectangle ux:Name="RaisedButton_body" ZOffset="1" Height="36" Padding="8,0" CornerRadius="2">
Copy link
Collaborator

Choose a reason for hiding this comment

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

When assigning a ux:Name to a node, the value should start with a lowercase letter and be in camelCase. This here, for example, should be ux:Name="raisedButtonBody".

Copy link
Collaborator

Choose a reason for hiding this comment

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

And more of a question rather than a request for changes - is the ZOffset necessary? Can't you instead reorder the nodes so that the ones on top would be on top of the others in UX file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reordered, but the ZOffset is necessary actually

Copy link
Collaborator

@eksperts eksperts Jun 27, 2017

Choose a reason for hiding this comment

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

Why is it necessary? I don't see any triggers involved in manipulating them, so I don't immediately see the reason.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@igorls I tested and the ZOffsets do not seem to be necessary at all. You only need to put the nodes in the right order, just like layers in photoshop - the ones on top in UX are rendered on top of others.

<float4 ux:Property="InkColor"/>

<Rectangle ux:Name="RaisedButton_body" ZOffset="1" Height="36" Padding="8,0" CornerRadius="2">
<SolidColor Color="{ReadProperty this.BackgroundColor}" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to prefix these properties with an explicit this.*, since they are referring to the whole ux:Class we are currently in and this.* is implied.


<Rectangle ux:Name="RaisedButton_body" ZOffset="1" Height="36" Padding="8,0" CornerRadius="2">
<SolidColor Color="{ReadProperty this.BackgroundColor}" />
<WhileTrue Value="{ReadProperty this.Raised}">
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to prefix these properties with an explicit this.*, since they are referring to the whole ux:Class we are currently in and this.* is implied.

</Rectangle>

<Rectangle ux:Name="innerPanel" ZOffset="3" Height="{ReadProperty RaisedButton_body.Height}" Padding="{ReadProperty RaisedButton_body.Padding}" CornerRadius="{ReadProperty RaisedButton_body.CornerRadius}" ClipToBounds="true">
<Text Value="{ReadProperty this.Text}" Font="RobotoMedium" ux:Name="text" Alignment="Center" FontSize="14" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to prefix these properties with an explicit this.*, since they are referring to the whole ux:Class we are currently in and this.* is implied.

<Text Value="{ReadProperty this.Text}" Font="RobotoMedium" ux:Name="text" Alignment="Center" FontSize="14" />
</Rectangle>

<WhileTrue Value="{ReadProperty this.Enabled}" Invert="true">
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to prefix these properties with an explicit this.*, since they are referring to the whole ux:Class we are currently in and this.* is implied.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using <WhileTrue Invert="true"> can't you use a plain <WhileFalse>?

</Rectangle>

<Rectangle ux:Name="innerPanel" ZOffset="3" Height="{ReadProperty RaisedButton_body.Height}" Padding="{ReadProperty RaisedButton_body.Padding}" CornerRadius="{ReadProperty RaisedButton_body.CornerRadius}" ClipToBounds="true">
<Text Value="{ReadProperty this.Text}" Font="RobotoMedium" ux:Name="text" Alignment="Center" FontSize="14" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

ux:Name should always be the first property on a node, followed by Value in case of <Text />.


</WhileTrue>

<WhileTrue Value="{ReadProperty this.Enabled}">
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to prefix these properties with an explicit this.*, since they are referring to the whole ux:Class we are currently in and this.* is implied.

<Set scaleAnimator.Duration="0.3" AtProgress="0" />
<Set showInk.Value="true" AtProgress="0" />
<Set showInk.Value="false" AtProgress="1" />
<Set scaleAnimator.Duration="0.6" AtProgress="1" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice if these triggers were grouped together by the AtProgress value (0/1), otherwise it's hard to read what happens when.

</Material.AppBar>

<Rectangle Dock="Top" Margin="5">
<StackLayout/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why use a Rectangle with a StackLayout when you can just have a StackPanel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to use a stroke to separate the button example area from other upcoming examples

Copy link
Collaborator

Choose a reason for hiding this comment

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

That still should be done differently though. Go with a StackPanel and we'll figure it out from there.

@igorls
Copy link
Contributor Author

igorls commented Jun 27, 2017

all requested changes were fixed, exception to the ZOffsets that were actually needed.

igorls added 4 commits June 27, 2017 19:44
Default Material typeface should be Roboto per the guidelines, changed Material.Text class to comply (https://material.io/guidelines/style/typography.html)
New class Material.Button according to the guidelines, adjustments are still needed. Current options are Raised/Flat Enabled/Disabled, as long as Background and Ink (ripple) colors.

Demo added to the MainView.ux
</StackPanel>
<StackPanel Orientation="Horizontal">
<Material.Button Text="Flat Button - Enabled" Raised="false" Enabled="true" BackgroundColor="#FFFFFF00" InkColor="Material.Blue300"/>
<Material.Button Text="Flat Button - Disabled" Raised="false" Enabled="false" BackgroundColor="#FFFFFF00"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the background on these fully transparent on purpose? Wouldn't you want to reuse the same color as on the raised buttons, Material.Blue200?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to put no background on those to show that the ink effect applies to the area in case of a flat button, what do you think?

Style/Fonts.ux Outdated
@@ -0,0 +1,5 @@
<Panel ux:Class="Material.Fonts">
Copy link
Owner

Choose a reason for hiding this comment

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

Please don't add these fonts, it severely bloats the app.

This theme will use the platform's default font, which is Roboto on Android and San Francisco on iOS.

Bundling full Roboto will add 10MB to the app.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, no problem, I also had a doubt about this

@igorls
Copy link
Contributor Author

igorls commented Jun 29, 2017

I think it's better for us to hold that PR until I replace my own implementation of the ink effect with the same one @Duckers has used in the other components, main reason being the glitch with the CornerRadius non-zero. Also to focus all effects on the same uno class, avoiding problems in the future

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.

3 participants