Wrapping every component in shared-components with material-ui theme? - material-ui

I created a shared-components repository which is using material-ui theme to style each component. I import these components into my main repository which doesn't have material-ui installed.
I'm wondering if it's best practice to wrap every shared-component with my custom theme or if I should export the <ThemeProvider> and the main repository will wrap each shared-component it uses with the theme itself. The other option is to wrap the whole main repository's app with the theme provider but I'm not sure every page will be using material-ui.
Does anyone know what the best practice is in this case?

Related

Flutter: Using expansion panel with navigator animate the AppBar when expansion panel is open

In one section of a client's app an expansion panel / accordion is used to open some content. At the same time the AppBar is supposed to animated as is a new route has been pushed but the new route's content should display in the body of the expansion panel.
I have been able to implement this by creating an entirely independent Widget and using a state management library but it is not a tidy solution.
I wondered if it is possible to use the App's main Navigator but not remove the current route's body. This cannot be done with a nested navigator either as the AppBar uses Hero tags that are not reflected between Navigator's.
Is there a simple way to achieve this without using entirely customised state management.
Flutter's in built Navigator, even Navigator 2.0, is well known to not be a particularly friendly interface to use, so I'd recommend the use of a community library that makes things easier.
Auto Route is a popular solution that I use personally and can attest to its quality. For your particular problem it offers navigation observers which you can register. You could use this to trigger the animation of your app bar when the new route is pushed.
It will be a little bit of effort to replace your current navigation with a new library but I'd imagine you'll end up with a cleaner solution at the end instead of customized state management.

Merging and use both of default flutter ThemeData with NeumorphicThemeData

I was developing an app with neumorphic design and decide to use flutter_neumorphic package. I got some problem when give a theme, neumorphic package give an easier way to set the default style for neumorphic, but in other side i can't use the default ThemeData anymore. Meanwhile some property of ThemeData did'nt exist on NeumorpchicThemeData, e.g. buttonTheme, default font family, etc. How should i do with them, could i just combine two of them, or should i choose one of the theme class and then make a constants to create a new separated theme for one of them?

Exporting an Adobe-XD layout to Flutter

I'm trying to export a very basic XD layout to a Flutter project.
I'm using two component instances, drag-and-dropped from the Material Design light theme UI kit in library.
After exporting it, I get the following error for both instances:
"Master component could not be found".
When trying to reach the master component for either instance (pressing ctrl-shift-K), nothing happens. What should I do to export this layout to Flutter?
It seems to me that you can't use a UI kit widget (at least not out of the box). Is it correct?
I don't think that you can use a UI kit widget out of the box, but you can use the underlying widget. In your case, you would use the MaterialButton widget.

circular reveal theme switcher like telegram in flutter

I am using DayNight theme in my application. And I have a button that changes the theme. In Telegram app there is a beautiful reveal animation that changes the theme without restarting activity or something like that. How to achieve this in flutter? and also the theme change should be persistent using shared preference and provider.
i want to achieve something like this:-
Here is what you are looking for

Clone a panel of widgets

is it possible in GWT to clone a panel? If so, are all the handler settings copied as well?
Basically I have a Panel full of controls, all laid out, I want to copy it and pop it up in a PopupPanel without having to go through the code that created the controls in the first place.
I got as far as DOM.clone(), and this message post. But there is no wrap() in Widget, UIObject etc. setElement() is protected.
Quick way to build a Widget from a DOM element:
Widget widget = new Widget () {{
setElement(myElement);
}};
But no, AFAIK DOM.clone() isn't going to copy attached handlers as well. I suspect this won't work as well as you're hoping.
Have you considered creating a new GWT widget, consisting of all of those controls? That way you can host the widget panel in both places without resorting to cloning it. (And possibly saving you subtle bugs in the process.)
Create a new class with all the controls and other features that you have in your panel and treat this as a new widget... Now you don't have to worry about cloning them, you can use this as a regular widget in your program (you can initialize it the same way you do rest of the widgets)... This is how i started off for one of my projects, where i was trying to clone a panel...