[yew-devel] [PATCH yew-widget-toolkit 05/11] touch: material app: allow pass through of page animation style

Dominik Csapak d.csapak at proxmox.com
Fri Jun 27 15:38:57 CEST 2025


On 6/27/25 15:37, Shannon Sterz wrote:
> On Fri Jun 27, 2025 at 2:08 PM CEST, Dominik Csapak wrote:
>> to the page stack. Otherwise it's impossible to set the animation style
>> for a material app.
>>
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>>   src/touch/material_app.rs | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/touch/material_app.rs b/src/touch/material_app.rs
>> index d9ea2a0..6d7ac54 100644
>> --- a/src/touch/material_app.rs
>> +++ b/src/touch/material_app.rs
>> @@ -13,7 +13,7 @@ use pwt_macros::builder;
>>
>>   use crate::prelude::*;
>>   use crate::state::{NavigationContainer, SharedState, SharedStateObserver};
>> -use crate::touch::{SnackBarController, SnackBarManager};
>> +use crate::touch::{PageAnimationStyle, SnackBarController, SnackBarManager};
>>   use crate::widget::{Container, ThemeLoader};
>>
>>   use super::{PageStack, SideDialog, SideDialogController, SideDialogLocation};
>> @@ -207,6 +207,11 @@ pub struct MaterialApp {
>>       #[builder(IntoPropValue, into_prop_value)]
>>       #[prop_or_default]
>>       pub history: Option<AnyHistory>,
> 
> could we implement `Default` on `PageAnimationStyle` here and remove the
> `Option`? that would also clean up the code below a bit. or is there a
> reason not to do that?
> 

sounds good to me, will do in a v2

>> +
>> +    /// Page animation style used when switching between pages
>> +    #[builder(IntoPropValue, into_prop_value)]
>> +    #[prop_or_default]
>> +    pub page_animation: Option<PageAnimationStyle>,
>>   }
>>
>>   impl MaterialApp {
>> @@ -372,7 +377,10 @@ impl Component for PwtMaterialApp {
>>
>>           let app = Container::new()
>>               .class("pwt-viewport")
>> -            .with_child(PageStack::new(page_stack))
>> +            .with_child(
>> +                PageStack::new(page_stack)
>> +                    .animation_style(props.page_animation.unwrap_or(PageAnimationStyle::Push)),
>> +            )
>>               .with_child(
>>                   SnackBarManager::new()
>>                       .controller(self.snackbar_controller.clone())
> 





More information about the yew-devel mailing list