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?
Related
I've seen some posts recommending to set fontSize or TextStyle for Text widget using Theme
// textStyle
Theme.of(context).textTheme.bodySmall
OR
// fontSize
Theme.of(context).textTheme.bodySmall.fontSize
What benefit will I get by setting these parameters using Theme.of(context) at runtime, when I can simply declare font sizes as constants?
You can either define app-wide themes or use Theme widgets that represent the colors and font styles for a particular part of the application. App-wide themes are Theme widgets created at the root of an app by the MaterialApp.
After defining a Theme, use it within your widgets. Flutter’s Material widgets also use your Theme to set the background colors and font styles for AppBars, Buttons, Checkboxes, and more.
You can ref this below link:
https://docs.flutter.dev/cookbook/design/themes
Basically CupertinoThemeData has only 4 Colors that can be set. There is no parameter for let's say tiles. Should I just define some colors globally that I change inside the same function that switches theme? Or should I wrap my CupertinoThemeData inside a normal ThemeData (which has way more parameters)?
I am new to theming and was wondering what the best practices are.
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?
I have 3 themes based on colours like a red theme, blue theme and a dark theme as well. I want to change the theme of the app while the app is running.
I want to show an alert dialog from where the user can select the color of the theme.
When you present an AlertDialog (using await showDialog()), there is a Future<dynamic> return value. So, have some buttons in the dialog that lets the user choose their theme. Once the user is done choosing the theme, return the chosen theme using Navigator.of(context).pop(selectedTheme).
Wait for this value wherever you're showing the dialog like final userSelectedTheme = await showDialog(...). Once you have the new value, then update whatever state model is holding the theme and your app should update accordingly.
Since themes are generally at the top-level of the app, you'll probably need something more than just stateful widgets if you aren't using anything else. I'd look into Provider if you aren't familiar with anything else:
https://pub.dev/packages/provider
How to change Widget style in SWT, of existing widget, Means i am working on ProgressBar and i want to change it's style SWT.VERTICAL from SWT.HORIZONTAL
You can't, styles are fixed once the control has been created.
In some cases SWT may use a completely different native control to implement the SWT control depending on the style flags. For example on macOS a Combo with the SWT.READ_ONLY style uses a different macOS control to a read/write Combo. This would make allowing you to change the style very complex.