Uno.Themes icon indicating copy to clipboard operation
Uno.Themes copied to clipboard

feat: Introducing Header and Placeholder

Open eriklimakc opened this issue 1 year ago • 27 comments

GitHub Issue: #974 #842

PR Type

What kind of change does this PR introduce?

  • Feature

Description

Introducing Header as Label and Placeholder to TextBox.

The former PlaceholderText was replaced by Header and a new Placeholder was added. The goal is to reproduce the Material 3 Textbox behavior.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Commits must be following the Conventional Commits specification
  • [X] Tested UWP
  • [ ] Tested iOS
  • [X] Tested Android
  • [X] Tested WASM
  • [X] Tested GTK
  • [ ] Tested MacOS
  • [ ] Contains No breaking changes

    If the pull request contains breaking changes, commit message must contain a detailed description of the action to take for the consumer of this library. As explained by the Conventional Commits specification

eriklimakc avatar May 30 '23 15:05 eriklimakc

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 30 '23 15:05 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 30 '23 15:05 github-actions[bot]

Windows

image image image image

WASM

image image image image

GTK

Gtk cursor seems to be a bit bugged image image image image

Android

image image image image

Android Obs

It feels like Android TextBox Header and Placeholder are a bit below of the center when unfocused. Do you feel the same? Would we add a proper Margin/Padding/Alignment only for Android to fix it?

image

@kazo0 @agneszitte @Xiaoy312

eriklimakc avatar May 30 '23 15:05 eriklimakc

While testing the azure static web link, seems that the icon is not properly aligned vertically image

agneszitte avatar May 30 '23 19:05 agneszitte

While testing the azure static web link, seems that the icon is not properly aligned vertically

image

Thanks @agneszitte, will fix it ☺️

eriklimakc avatar May 30 '23 20:05 eriklimakc

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Jun 01 '23 17:06 github-actions[bot]

I'm having a problem with the TextBox cursor:

When I have Placeholder and Header the ContentElement_CompositeTransform.TranslateY (cursor position) has value of 8 which means the cursor is aligned with the Placeholder position like this:

image

But when I have only Header the cursor should start with the position 0, which means it would be aligned with the Header text and when I type something it would go down (position 8). But ContentElement_CompositeTransform.TranslateY (cursor position) is starting with value 8 already, like this:

image

When I type:

image

I can't find a way of check Text, PlaceholderText and Header at the same time to manipulate the cursor position as desired. Do you guys have any ideas?

I have pushed my changes.

@agneszitte @kazo0

eriklimakc avatar Jun 01 '23 17:06 eriklimakc

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Jun 02 '23 12:06 github-actions[bot]

@eriklimakc I will pull your branch to take a look and help you fix this issue

agneszitte avatar Jun 02 '23 13:06 agneszitte

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Jun 02 '23 17:06 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Jun 06 '23 00:06 github-actions[bot]

@eriklimakc I have pushed on your branch a commit to fix the MaterialFilledTextBoxStyle so it can follow the proper specs we agreed on for the related issue.

Here some things to note:

  • The style follows the specs and works appropriately on Windows at the moment if I did not miss anything (I quickly added more samples so it is easy to test all the scenarios for MaterialFilledTextBoxStyle)
  • I quickly tested the style on the other platforms and on specific cases we have some issues, so you will need to check them more closely. Since it works properly on Windows, the goal will be to determine what is not working on the Uno side.
  • You will be able to use the same logic for the MaterialOutlinedTextBoxStyle
  • Naming for the converter I added (+ related resources) will need to be adjusted for something better at the end if it will be the way to go for the final changes

(cc @kazo0)

agneszitte avatar Jun 06 '23 00:06 agneszitte

@eriklimakc I have pushed on your branch a commit to fix the MaterialFilledTextBoxStyle so it can follow the proper specs we agreed on for the related issue.

Here some things to note:

  • The style follows the specs and works appropriately on Windows at the moment if I did not miss anything (I quickly added more samples so it is easy to test all the scenarios for MaterialFilledTextBoxStyle)
  • I quickly tested the style on the other platforms and on specific cases we have some issues, so you will need to check them more closely. Since it works properly on Windows, the goal will be to determine what is not working on the Uno side.
  • You will be able to use the same logic for the MaterialOutlinedTextBoxStyle
  • Naming for the converter I added (+ related resources) will need to be adjusted for something better at the end if it will be the way to go for the final changes

(cc @kazo0)

As an additional note, the converter is working fine on Windows but for the other platforms, the converter is only trigged once for each state. It seems like once it is triggered it won't trigger anymore for that state.

agneszitte avatar Jun 06 '23 13:06 agneszitte

Related Issue for the Converter/VisualStates issue: https://github.com/unoplatform/uno/issues/12556

agneszitte avatar Jun 06 '23 18:06 agneszitte

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Sep 08 '23 12:09 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Sep 08 '23 13:09 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Sep 12 '23 12:09 github-actions[bot]

Regarding animations all seems to be working fine after https://github.com/unoplatform/uno/issues/12556.

Only getting this behavior on non-windows platforms:

When TextBox is pressed and Placeholder/Text + Header is present they get back to the center and then animates to their right position:

https://github.com/unoplatform/Uno.Themes/assets/114886335/675e4f89-8f9d-4e1d-bf62-c38f30582dae

eriklimakc avatar Sep 12 '23 13:09 eriklimakc

@eriklimakc what's the current status of this? Any remaining blockers?

kazo0 avatar Sep 27 '23 15:09 kazo0

Regarding animations all seems to be working fine after #974.

Only getting this behavior on non-windows platforms:

When TextBox is pressed and Placeholder/Text + Header is present they get back to the center and then animates to their right position:

TextBox.PnH.issue.mp4

@kazo0, there is only this behavior on non-windows platforms that I mentioned above with the video.

eriklimakc avatar Sep 28 '23 11:09 eriklimakc

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Nov 02 '23 17:11 github-actions[bot]

Skia X Win

Skia_vs_Win_issue

Apparently when the animation code is executed, the Text, Header, and Placeholder are quickly set to their default state and after that they are animated.

In order to test I replaced the animation code for Setters like below and we don't have that behavior.

<Setter Target="HeaderElement_CompositeTransform.TranslateY"
	Value="-11" />
<Setter Target="ContentElement_CompositeTransform.TranslateY"
	Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="PlaceholderElement_CompositeTransform.TranslateY"
	Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToFocusedContentCompositeTransformTranslateY}, TargetNullValue=0, FallbackValue=0}" />
<Setter Target="HeaderElement_CompositeTransform.ScaleX"
	Value="0.7" />
<Setter Target="HeaderElement_CompositeTransform.ScaleY"
	Value="0.7" />

cc @Xiaoy312 @kazo0 @agneszitte

eriklimakc avatar Nov 03 '23 10:11 eriklimakc

@eriklimakc re: https://github.com/unoplatform/Uno.Themes/pull/1014#issuecomment-1792223480 At a glance, this seems like an issue with the animation not picking up the current set/animated value as the starting point for the (start...end) animation. This is not probably not something we will fix here, but in uno. Can you can open an issue in uno and @ me there. Also, is this happening on other platforms as well, like ios/droid or wasm?

Xiaoy312 avatar Nov 03 '23 14:11 Xiaoy312

Thanks for the info @Xiaoy312

Yes, this happens in all platforms except Windows.

Here's the issue on Uno https://github.com/unoplatform/uno/issues/14262.

eriklimakc avatar Nov 03 '23 16:11 eriklimakc

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar Dec 22 '23 11:12 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 15 '24 13:05 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 15 '24 14:05 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 23 '24 11:05 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 23 '24 15:05 github-actions[bot]

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net

github-actions[bot] avatar May 23 '24 15:05 github-actions[bot]