satz
April 20, 2018, 6:48pm
1
I have created Material Design Toast base on tutorials. But the animation part not working as expected. What’s wrong in my approach.
<Panel ux:Class="Toast" Layer="Overlay">
<string ux:Property="Text" />
<bool ux:Property="Visible" />
<WhileTrue Value="{ReadProperty Visible}">
<ActivatingAnimation>
<DropShadow/>
<BringToFront Target="btn"/>
<Change btn.Visibility="Visible" Delay="0" DelayBack="0.26" />
<Change btn.Opacity="0.6" Duration="0.36" />
</ActivatingAnimation>
</WhileTrue>
<Rectangle ux:Name="btn" Visibility="Collapsed" Opacity="0" Height="36" CornerRadius="20" Color="#323232" Padding="16,0" Margin="16">
<Text Value="{Property this.Text}" Font="RobotoRegular" Color="#FFFFFF" FontSize="14" Alignment="CenterLeft"/>
</Rectangle>
</Panel>
And to call Toast component
<Toast Text="Error: Please fill all fields" Visible="{isError}" Alignment="Center" ux:Name="toastError">
</Toast>
Arturs
April 21, 2018, 8:44am
2
Hey.
Your component looks great, but ActivatingAnimation
is used to animate page when a specific page gets active and visible. Also, I would suggest using Shadow over DropShadow
. Shadow class is known as a better solution. I think shadow belongs to rectangle so I moved it inside the rectangle.
Here is modified code:
<Panel ux:Class="Toast" Layer="Overlay">
<string ux:Property="Text" />
<bool ux:Property="Visible" />
<WhileTrue Value="{ReadProperty Visible}">
<BringToFront Target="btn"/>
<Change btn.Visibility="Visible" Delay="0" DelayBack="0.26" />
<Change btn.Opacity="0.6" Duration="0.36" />
</WhileTrue>
<Rectangle ux:Name="btn" Visibility="Collapsed" Opacity="0" Height="36" CornerRadius="20" Color="#323232" Padding="16,0" Margin="16">
<Shadow Size="10"/>
<Text Value="{Property this.Text}" Font="RobotoRegular" Color="#FFFFFF" FontSize="14" Alignment="CenterLeft"/>
</Rectangle>
</Panel>
Hope this helps.
satz
April 21, 2018, 9:44am
3
Thank You Arturs! You have saved my day.
satz
April 21, 2018, 9:49am
4
Does foreign code support swift lang now?
I dont see any tutorials on that!
Uldis
April 23, 2018, 1:09pm
5
Yes, it does (kind of), and here’s the docs . No tutorials I’m afraid, but that link should get you started.
satz
April 23, 2018, 2:42pm
6
Hey Uldis,
Thanks for the info! It seems hack at the moment. somewhere in forum i read that swift will be supported in future release.
I hope it will be out soon!
Best Regards,
Satz