SukiToast.axaml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:content="clr-namespace:SukiUI.Content"
  4. xmlns:suki="clr-namespace:SukiUI.Controls">
  5. <Design.PreviewWith>
  6. <suki:SukiToast Title="Title" Content="Message" />
  7. </Design.PreviewWith>
  8. <ControlTheme x:Key="SukiToastTheme" TargetType="suki:SukiToast">
  9. <Setter Property="Template">
  10. <ControlTemplate>
  11. <Panel>
  12. <Border Name="PART_ToastCard"
  13. MinWidth="300" MaxWidth="400"
  14. Margin="40,5,30,10"
  15. Padding="0"
  16. Background="{DynamicResource SukiCardBackground}"
  17. BorderBrush="{DynamicResource SukiBorderBrush}"
  18. BorderThickness="1"
  19. BoxShadow="{DynamicResource SukiPopupShadow}"
  20. CornerRadius="15">
  21. <Border ClipToBounds="True" CornerRadius="15">
  22. <Panel>
  23. <Panel IsVisible="{DynamicResource IsDark}">
  24. <Panel Margin="0">
  25. <Panel.Background>
  26. <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
  27. <GradientStop Offset="0" Color="{DynamicResource SukiPrimaryColor5}" />
  28. <GradientStop Offset="1" Color="{DynamicResource SukiPrimaryColor10}" />
  29. </LinearGradientBrush>
  30. </Panel.Background>
  31. </Panel>
  32. </Panel>
  33. <Panel IsVisible="{DynamicResource IsLight}">
  34. <Panel Margin="0">
  35. <Panel.Background>
  36. <LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
  37. <GradientStop Offset="0" Color="{DynamicResource SukiAccentColor1}" />
  38. <GradientStop Offset="1" Color="{DynamicResource SukiPrimaryColor1}" />
  39. </LinearGradientBrush>
  40. </Panel.Background>
  41. </Panel>
  42. </Panel>
  43. <Panel Margin="20,22,20,8">
  44. <DockPanel Margin="0,-7,0,-4" LastChildFill="True">
  45. <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
  46. <ContentPresenter Margin="12,0,0,0"
  47. Content="{TemplateBinding Title}"
  48. FontSize="17"
  49. FontWeight="{DynamicResource DefaultDemiBold}"
  50. Foreground="{DynamicResource SukiText}" >
  51. <ContentPresenter.Styles>
  52. <Style Selector="TextBlock">
  53. <Setter Property="FontSize" Value="16" />
  54. </Style>
  55. </ContentPresenter.Styles>
  56. </ContentPresenter>
  57. </StackPanel>
  58. <ItemsControl DockPanel.Dock="Bottom"
  59. ItemsSource="{TemplateBinding ActionButtons}"
  60. Margin="0,10,0,0"
  61. HorizontalAlignment="Right">
  62. <ItemsControl.ItemsPanel>
  63. <ItemsPanelTemplate>
  64. <StackPanel Orientation="Horizontal"/>
  65. </ItemsPanelTemplate>
  66. </ItemsControl.ItemsPanel>
  67. </ItemsControl>
  68. <ContentPresenter Margin="12,10,0,0"
  69. Content="{TemplateBinding Content}"
  70. Foreground="{DynamicResource SukiText}"
  71. TextWrapping="Wrap" >
  72. <ContentPresenter.Styles>
  73. <Style Selector="TextBlock">
  74. <Setter Property="FontSize" Value="14" />
  75. </Style>
  76. </ContentPresenter.Styles>
  77. </ContentPresenter>
  78. </DockPanel>
  79. </Panel>
  80. </Panel>
  81. </Border>
  82. </Border>
  83. <Border Width="35"
  84. Height="35"
  85. Margin="22,0,0,3"
  86. HorizontalAlignment="Left"
  87. VerticalAlignment="Center"
  88. Background="{DynamicResource SukiCardBackground}"
  89. BoxShadow="{DynamicResource SukiSmallPopupShadow}"
  90. CornerRadius="35">
  91. <Border ClipToBounds="True" CornerRadius="35">
  92. <Panel>
  93. <Panel Background="{TemplateBinding Foreground}" Opacity="1" />
  94. <PathIcon Width="15"
  95. Height="15"
  96. Margin="0,0,0,0"
  97. HorizontalAlignment="Center"
  98. VerticalAlignment="Center"
  99. Data="{TemplateBinding Icon}"
  100. Foreground="White" />
  101. <Border IsVisible="{TemplateBinding LoadingState}" Background="{DynamicResource SukiCardBackground}">
  102. <suki:WaveProgress IsTextVisible="False" Value="50" Height="35" Width="35"></suki:WaveProgress>
  103. </Border>
  104. </Panel>
  105. </Border>
  106. </Border>
  107. </Panel>
  108. </ControlTemplate>
  109. </Setter>
  110. </ControlTheme>
  111. <ControlTheme x:Key="{x:Type suki:SukiToast}"
  112. BasedOn="{StaticResource SukiToastTheme}"
  113. TargetType="suki:SukiToast" />
  114. </ResourceDictionary>