How can I style a Toolbar to act like an AppBar - material-ui

It looks like a Toolbar is a more customizable version of the AppBar. I would like to stick a few icons into the AppBar. I would like to replace the AppBar with a Toolbar. However, I'm currently using the lightUITheme.
It looks like Toolbars look different. Is there a way I can style a Toolbar just like an Appbar and still honor the theme so that if the theme changes, my toolbar still looks like an Appbar?

You can use the style property of the Toolbar.
For example:
const toolbarStyle = {
backgroundColor: indigo500
}
<Toolbar style={toolbarStyle}>
<ToolbarGroup firstChild={true}>
<ToolbarTitle text="Options" />
<RaisedButton onTouchTap={this.handleOpenMenu} label="Downloads" />
</ToolbarGroup>
</Toolbar>
If you use the built in colours then be sure to include them too e.g.:
import {indigo500} from 'material-ui/styles/colors';

Related

Change text/icon color in top bar

How do I change the color of the text and icon's in the very top bar. I want to change the backgroundcolor of that bar to a light color, which I know how to do, I can't figure out how to make the text/icon's darker.
You can use StatusBarBehavior from MAUI toolkit package, as a Behavior at a ContentPage level:
<ContentPage.Behaviors>
<toolkit:StatusBarBehavior StatusBarColor="LightGreen" StatusBarStyle="DarkContent" />
</ContentPage.Behaviors>
or by calling the provided methods:
CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor(Colors.LightGreen);
CommunityToolkit.Maui.Core.Platform.StatusBar.SetStyle(StatusBarStyle.DarkContent);
StatusBarBehavior docs

Different icons and text color in navBar Flutter

I'm working on my flutter project and trying to figure out how to make in bottom navBar make each item in a different color. For example, I have:
[icon]Home [icon]Settings [icon]Help [icon]Chat
I need to make the first item (icon&text) in one color, item2(icon&text) in another color, etc
As on the screenshot. Is that even possible? navBarScreenshot
if you using the bottom navigation bar widget there is a function called selectedItemColor: which can be used to change the color of the selected item or you can just give a container as a widget in BottomNavigationBarItem(icon: Container()) and give it a custom color according to your liking

how can i make the same style dropdown menu

How can i make this dropdown style in flutter,
also the CupertinoSwitch color change like this one ---background color white & Button color Amber.
Thanks
You could probably use an AnimatedContainer in combination with the expandable package to achieve most of the UI for this widget.
As for the Cupertino switch, you have a property in the widget itself to set a color when the button is active:
https://api.flutter.dev/flutter/cupertino/CupertinoSwitch/activeColor.html

how to reduce spacing in material-ui?

i am building web app for desktops and i find material-ui wastes lot of space when displaying the components right out of the box.
AppBar is rendered with padding of 24.
Passing the style to the appbar is only adding in addition to 24 instead of overriding.
Just compare the height of menubar of stackoverflow vs material-ui appbar
How to reduce AppBar height atleast 10px less?
You can override component style. You need to apply a className or a style like this :
<AppBar className={classes.appBar} />
With web inspector, you can find your css class. Something like MuiAppBar-XXXXXX
Hope this help!

How to create non-static, custom content in an AppBar

I have a material-ui AppBar that sits up high in the composition, something like this:
<App>
<AppBar/>
<Main>
<Route component={FooPage}/>
<Route component={BarPage}/>
</Main
</App>
I would like FooPage and BarPage to be able to "inject" their own content into the AppBar, such as Menus, Selects, etc. -- Without the AppBar or the component that hosts the AppBar to be specifically aware of Foo and/or Bar or any other player that does this. I can imagine a novel way of doing it by having Foo announce to the world that "Foo is active" and having the FooBar-aware AppBar component, respond by saying "Fine...I'll render a Foo-Menu for you.."
What I want is to be able to do is pull this off without the React version of gnarly switch/case. I am pretty newish to React, and I think this is not specifically a material-ui question, but I wonder...Is there is a direct way of loading children into an AppBar (or ToolBar) where AppBar is agnostic towards its contents? And if so, what does that look like syntactically speaking?
AppBar has two properties that can accept elements as values. As such, you could utilize the iconElementLeft or iconElementRight properties to pass in whatever element you want to display.
Check out this JSFiddle as an example:
https://jsfiddle.net/Asalem1/ha6v1714/26/