[yew-devel] [PATCH yew-widget-toolkit 1/1] touch: material app: add option for the theme dir prefix

Dominik Csapak d.csapak at proxmox.com
Thu Jul 10 12:28:12 CEST 2025


otherwise we can't use different paths for the css/font files when using
a material app.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/touch/material_app.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/touch/material_app.rs b/src/touch/material_app.rs
index 2c72e00..079dd5c 100644
--- a/src/touch/material_app.rs
+++ b/src/touch/material_app.rs
@@ -212,6 +212,11 @@ pub struct MaterialApp {
     #[builder(IntoPropValue, into_prop_value)]
     #[prop_or(Some(PageAnimationStyle::FadeFromRight))]
     pub page_animation: Option<PageAnimationStyle>,
+
+    #[builder]
+    #[prop_or_default]
+    /// The directory prefix for the css files. (E.g. "/css/")
+    pub theme_dir_prefix: AttrValue,
 }
 
 impl MaterialApp {
@@ -385,11 +390,14 @@ impl Component for PwtMaterialApp {
             )
             .with_optional_child(self.dialog.as_ref().map(|(_, dialog)| dialog.clone()));
 
+        let theme_loader = ThemeLoader::new(NavigationContainer::new().with_child(app))
+            .dir_prefix(props.theme_dir_prefix.clone());
+
         html! {
             <Router history={self.history.clone()} basename={props.basename.clone()}>
                 <ContextProvider<SnackBarController> context={self.snackbar_controller.clone()}>
                     <ContextProvider<PageController> context={self.page_controller.clone()}>
-                    { ThemeLoader::new(NavigationContainer::new().with_child(app))}
+                    { theme_loader }
                     </ContextProvider<PageController>>
                 </ContextProvider<SnackBarController>>
             </Router>
-- 
2.39.5





More information about the yew-devel mailing list