Flutter Web: URL Bar not hiding on scroll - flutter

I have a Flutter web app that contains a SingleChildScrollView and a number of elements in it. When viewed on my iPhone's Safari, the URL and bottom bars do not hide as I scroll downwards as it would on any other site.
I've tried a number of things including using different elements like ListViews and playing with the physics, but the URL and bottom bars still are not dismissed.
Any ideas how I could configure a web flutter app to help the browser recognize the scroll and dismiss them?

Check out this thread in GitHub: Flutter for Web does not hide url bar and navigation bar on scroll in iOS's Safari
Credit: jamesblasco
You can add this to the of the index.hml file of any flutter project and try it also there.
<style>
body {
height: 500vh !important; /* Bigger than 100% to allow scroll */
position: static !important; /* Override absolute from flutter */
overflow-y: scroll !important; /* Allows verticall scrolling */
overflow-x: hidden !important;
touch-action: pan-y !important; /* Allows vertical scrolling */
overscroll-behavior: none; /* Avoid bouncing scrolling on top/bottom edget */
}
/* Centers flutter canvas with a size of the viewport*/
flt-glass-pane {
position: fixed !important; /* Overrides absolute from flutter */
top: 50vh !important;
left: 50vw !important;
max-width: 100vw !important;
max-height: 100vh !important;
transform: translate(-50vw, -50vh) !important;
}
/*
Scrollbar hide doesn't work on iOS, they add a default one when overflow:true and -webkit-overflow-scrolling: touch;
Sadly since iOS 13, this value is forced on iOS -> https://developer.apple.com/documentation/safari-release-notes/safari-13-release-notes
*/
::-webkit-scrollbar {
display: false;
width: 0px;
height: 0px; /* Remove scrollbar space */
background: transparent; /* Optional: just make scrollbar invisible */
}
</style>

Related

lineheight too big for textwrap/autoHeight

The data I want to display in ag-grid is predominantly blocks of text. I would like the text to wrap and the cell height to auto.
wrapText: true,
autoHeight: true
However, when the text wraps, it maintains a line-height of 40px, which is not attractive. I also notice it doesn't try to wrap on word.
I tried resetting the line-height, but then I lose any top or bottom padding. When I add the padding, the top padding is fine, but the bottom padding is hidden - the row height does not account for the padding.
How do I get an attractive block text display in a cell with decent padding of the cell contents?
You could add some CSS to directly target the cell content to add padding:
.ag-theme-alpine .ag-cell-value {
line-height: 20px !important;
word-break: normal; /* prevent words from breaking */
padding-top: 5px; /* space top */
padding-bottom: 5px; /* space bottom */
}
See this implemented in the following plunkr

Ionic 5 Modal over modal is missing ion-backdrop

Why is my ion-backdrop + modal shadow styling not working when I open a modal on top of another modal?
PREFACE: This was working fine with V4, but broken on the upgrade to V5. I don’t want to change my page approach, just fix the CSS/whatever is actually causing the issue below.
My app opens a modal page with custom css to make it full screen.
I can then open another normal modal (but not full screen) over the
top. This 2nd modal is missing the ion-backdrop and its border shadow
styling.
I can see the ion-backdrop is definitely in the DOM, but it’s
obviously not showing.
Step1 Fine
enter image description here
Step 2 - broken ion-backdrop:
enter image description here
Showing my custom modal:
async showClipboard() {
const modal = await this._ModalController.create({
component: ClipboardPage,
cssClass: 'custom-round-modal',
componentProps: {
user: this.user
},
showBackdrop: true
});
await modal.present();
}
The CSS:
#media only screen and (min-width: 768px) {
.custom-round-modal {
.modal-wrapper {
border-radius: 15px !important;
-moz-border-radius: 15px !important;
-webkit-border-radius: 15px !important;
.ion-page {
border-radius: 15px !important;
-moz-border-radius: 15px !important;
-webkit-border-radius: 15px !important;
}
}
}
}
First off, I think you pasted the same screenshot twice by mistake. But I'm having the same issue, so I know what you mean.
It looks like Ionic 5 introduced this css for the modals:
.sc-ion-modal-ios-h:first-of-type {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.4);
}
Which means when you show multiple modals at the same time, only the first one will get the backdrop.
A possible workaround is to add the backdrop yourself to your global css using something like this:
ion-modal {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.4);
}
Or use the css class Ionic is using (but note that this one is iOS specific, so you'd likely need to do the same with the Android-equivalent class):
.sc-ion-modal-ios-h {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.4);
}
NOTE: This will likely not look good if you are showing multiple modals on top of each other that are not fullscreen, since you'll be getting multiple backdrops on top of each other (so they'll get increasingly darker). But since your issue is a non-fullscreen modal on top of a fullscreen one, I think it will work in your case.
Hopefully the Ionic team will come up with a more elegant solution to this issue.
Thank you krisloekkegaard for your code, that helped me really out.
I want to add that it will only work if placed in the global sass or css files! You cannot do that from a component's style-file, because the modal will be created outside of it.
The following lines are a bit more precise, because they will activate the backdrop only on the last modal. Even if you have 10 stacked modals, there will be only the backdrop of the first and the backdrop of the last element overlaying each other.
.sc-ion-modal-md-h:last-of-type {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);
}
.sc-ion-modal-ios-h:last-of-type {
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);
}
This is addressed now in the Ionic Documentation.
Please see under 'Customization' section for ion-modal : https://ionicframework.com/docs/api/modal
Add the following CSS to your modal class -
ion-modal.stack-modal {
--box-shadow: 0 28px 48px rgba(0, 0, 0, 0.4);
--backdrop-opacity: var(--ion-backdrop-opacity, 0.32);
}
I solved the issue adding the following css into variables.css file in Ionic v5. Give a chance.
.backdrop-no-scroll {
ion-router-outlet {
background: white;
}

Display tabs in multiple rows [duplicate]

I commonly have 10+ tabs open per editor window which makes it tedious to scroll back and forth (or use ctrl+tab) to find the file I want.
Is there any way to have the tabs wrap?
Similar to Atom's multirow-tabs.
Update: Looks like it is a work in progress.
UPDATE Feb 2021: In-built support for tabs-wrapping in VSCode v1.53.0+
Just set the workbench.editor.wrapTabs to true in the settings.
I still use my configuration mentioned below to make tabs smaller as per my usage.
UPDATED 28 March 2020 for VSCode v1.43.2
Fixed CSS for tab-close button
Added CSS for smaller bread-crumbs and acion-bar (at the right of tab-bar)
I do the following for multirow tabs in visual-studio-code (until there is official support or an easier solution):
STEP 1: Install the extension VSCode Custom CSS. (Check out the extension page for proper installation instruction. It's a bit of a hack as VSCode does not officially support altering internal CSS.)
STEP 2: Create a CSS file (say, "/home/user/vscode/custom.css") and add the following contents:
/* Following CSS to wrap the tab-bar into multiple rows: */
.tabs-and-actions-container > .monaco-scrollable-element {
height: auto !important;
}
.tabs-and-actions-container > .monaco-scrollable-element > .tabs-container {
height: auto !important;
flex-wrap: wrap;
}
/* Following CSS to make the tabs thinner/smaller (so that they take lesser vertical space): */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab {
height: 25px;
padding-left: 4px;
font-size: 0.8em; /* smaller font-size for tab icons and label */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .label-name {
font-size: inherit !important; /* inherit updated font-size for label */
}
/* Following CSS for smaller close button on tabs: */
.monaco-workbench .part.editor>.content .editor-group-container>.title .tabs-container>.tab>.tab-close {
width: 20px;
}
.monaco-workbench .part.editor>.content .editor-group-container>.title .tabs-container>.tab>.tab-close .action-label {
height: 12px;
width: 12px;
background-size: 12px;
}
.monaco-workbench .part.editor>.content .editor-group-container.active>.title .tabs-container>.tab>.tab-close .action-label.codicon {
font-size: 12px;
}
/* OPTIONAL: Following CSS for smaller breadcrumbs (below tab-bar) */
.monaco-breadcrumbs {
font-size:0.65em;
opacity: 0.8;
height:18px !important;
}
.tabs-breadcrumbs .breadcrumbs-control {
height: 18px !important;
}
.monaco-workbench .symbol-icon.block {
height: 8px;
width: 8px;
min-height: 8px;
min-width: 14px;
background-position: 50%;
background-size: contain;
}
.breadcrumbs-control .monaco-breadcrumb-item:before {
min-width: 12px !important;
height: 12px !important;
background-size: contain !important;
}
/* OPTIONAL: Following CSS for smaller action-bar (beside the tab-bar) with menu, split, etc. */
.monaco-workbench .part.editor>.content .editor-group-container>.title .editor-actions {
height: 20px;
padding:0;
}
.monaco-workbench .part.editor>.content .editor-group-container>.title .editor-actions .action-label, .monaco-workbench .part.editor>.content .editor-group-container>.title .title-actions .action-label {
height: 20px;
line-height: 20px;
min-width: 14px;
background-size: 8px;
}
.tabs-and-actions-container > .editor-actions > .monaco-toolbar > .monaco-action-bar > .actions-container {
max-width:60px;
flex-wrap:wrap;
}
STEP 3: Point the extension to your custom CSS. Open the VSCode settings.json [Ctrl+Shift+P > "Open Settings(JSON)"] and add the following lines (with your path to custom.css file):
"vscode_custom_css.imports": [
"file:///home/user/vscode/custom.css"
],
"vscode_custom_css.policy": true
STEP 4: Make sure you have gone through the VSCode Custom CSS extension's readme and enabled it properly. You may have to reload VSCode. Also, edit the CSS as per your preferences!
CREDIT: This solution (link to extension and the CSS to wrap tab-bar into multi-lines) was originally posted by Steven Laidlaw in this Github thread. I just extended the CSS for smaller tabs.
UPDATE: Version 1.53 includes wrap tabs!
The new "Wrap Tabs" setting is a checkbox under File > Preferences > Settings > Workbench > Editor Management.
Alternatively, you can set paste the following into your settings.json: "workbench.editor.wrapTabs": true
Significant progress has been made on this issue Allow tabs to wrap to multi-line and the feature is now in the Insiders' Build (and presumably in v1.53 Stable as it works well in my testing):
As seen in the demo, you can even drag tabs from one row to another. There is currently no limit on the number of rows until the editor itself gets too small.
You enable this functionality with
workbench.editor.wrapTabs: true or
Workbench > Editor: Wrap Tabs in the Settings gui.
A couple of notes from testing tab wrapping:
make sure you have configured workbench.editor.tabSizing: fit (this will make the last tab fill the entire row for a more homogeneous look when tabs wrap) [ed. note: you can still use shrink, it just doesn't look as nice]
if the space for the editor or editor toolbar becomes too small, wrapping turns off automatically and turns on again when the size get's larger
you can still drag and drop tabs around even when they wrap
you can still pin a tab and it shows pinned in the beginning of the tabs
when tabs wrap, the tab.border color is not only applied to the right of each tab but also below to separate tabs from each other
Also, depending on your color theme, consider modifying these settings:
"workbench.colorCustomizations": {
"tab.border": "#fff6",
"titleBar.border": "#fff6",
"editorGroupHeader.tabsBorder": "#647c64",
}
to set off the borders of each tab.
There is some hope for a second row of tabs - albeit with pinned tabs but still sounds pretty useful. See Pinned tabs: show them in a secondary tab row above others. Added to the Backlog.
By the way, pinned tabs are coming to v1.46. More on their functionality: v1.46 release notes: pinned tabs
Since multirow tabs are still not officialy supported in VSCode, I wanted to bring a feature request to your attention that I just posted on their github.
Instead of always wrapping tabs to a new row I propose to have them laid out on rows that are completely independent from each other. The user decides, they can mix short rows with long rows that still require scrolling. See the details here:
github.com/microsoft/vscode/issues/80510
My proposed solution certainly requires more work than unceremoniously wrapping tabs to a new row but in return it lets the user organize their tabs in a way that could increase productivity.
I just played with the vscode developer tools console, and looks like this CSS will be enough to do that if incorporated with an extension:
.tabs-and-actions-container .monaco-scrollable-element {
height: auto;
}
.tabs-and-actions-container .monaco-scrollable-element .tabs-container {
flex-wrap: wrap; flex: 1 1 auto;
height: auto;
}
You can add this code to file:///C:/Users/[username]/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.main.css file to use it until your application updates.
Note: When you add this to workbench.main.css file, VSCode will alert that the integrity of VScode is corrupted, ignore that message. VSCode will function as before because it's a CSS change (if any javascript doesn't use some positions of the tabs, or something else).
Otherwise as #Bene said, this is a restricted area by VSCode development team. They say:
Restrictions
There are certain restrictions we impose upon extensions.
Here are the restrictions and their purposes.
No DOM Access
Extensions have no access to the DOM of VS Code UI. You
cannot write an extension that applies custom CSS to VS Code or adds
an HTML element to VS Code UI.
At VS Code, we're continually trying to optimize use of the underlying
web technologies to deliver an always available, highly responsive
editor and we will continue to tune our use of the DOM as these
technologies and our product evolve. To ensure that extensions cannot
interfere with the stability and performance of VS Code, and that we
can continue to improve the DOM of VS Code without breaking existing
extensions, we run extensions in an Extension Host process and prevent
direct access to the DOM.
# https://code.visualstudio.com/api/extension-capabilities/overview#no-dom-access
I have found/developed a solution to display pinned tabs in their own row.. It's an addition to what people might be using already, not the answer to this thread per se.
Original reply on github: https://github.com/microsoft/vscode/issues/98160#issuecomment-989276052
vscode v1.62.3
extension: Custom CSS and JS Loader v6.0.2
settings.json
{
"workbench.editor.wrapTabs": true,
"git.decorations.enabled": false,
"workbench.editor.decorations.badges": false,
"workbench.editor.decorations.colors": false,
"vscode_custom_css.imports": ["file:///C:/temp/VScode/custom.css"],
"vscode_custom_css.policy": true
}
p.s. In config above I also disabled some git stuff from tabs to make them more readable.. not sure if it affects other places, use with caution.
custom.css
.tabs-container {
display: flex !important;
flex-wrap: wrap !important;
height: auto !important;
}
.tabs-container::before,
.tabs-container::after {
content: "" !important;
width: 100% !important;
order: 1 !important;
}
.tab {
display: flex !important;
}
.tab:not(.sticky) {
order: 1 !important;
}
Result (gif):

How to implement Media queries in Ionic

I Wanted to add full background image for my ionic app & different image for each device.
Here is my css code.
Media Query for iphone 6
#media(max-width:750px) and (max-height:1334px){
.pane, .view{
background: url(../img/home/Default-667h.png) no-repeat center top fixed;
background-size: 100% auto;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
media query for iphone 4
#media(max-width:640px) and (max-height:960px){
.pane, .view{
background: url(../img/home/Default#2x~iphone.png) no-repeat center top fixed;
background-size: 100% auto;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
This is not working in my app.
Whether ionic supports media query?
I'm not sure how/if ionic handles media queries.
But your max-width and max-height do not match the iPhone screen resolutions.
You have to use device independent pixels, not actual pixels.
More info on iPhone media queries here.
Ionic does support media queries (I'm using them myself in my company's app), but I think you're missing a parameter.
Here is an example I am using
This one is used for large screens (iPhone 6)
#media screen and (min-height : 600px) and (max-height : 700px) {
.Landing-formContainer{
padding-top: 35px;
}
}
This one is used for small screens (like iPhone 5s)
#media screen and (min-height : 320px) and (max-height : 500px) {
.Landing .slider-pager {
top: 195px !important;
}
}

GWT Vertical Tabs like iGoogle

I am using GWT and would like to develop a vertical tab panel like the one in iGoogle.
How can the same be achieved ?
I had the same problem and decided not to use third party library just for one small widget. Here is a lightweight solution I ended up using - it is based on tweaking styles.
verticaltabpanel.css:
#external gwt-TabLayoutPanel;
.gwt-TabLayoutPanel>div {
position: static !important;
}
.gwt-TabLayoutPanel {
margin-left: 30px;
}
#external gwt-TabLayoutPanelTabs;
.gwt-TabLayoutPanelTabs {
top: 0 !important;
width: 140px !important;
}
#external gwt-TabLayoutPanelTab;
.gwt-TabLayoutPanelTab {
display: block !important;
margin-top: 2px;
padding: 8px 6px !important;
}
#external gwt-TabLayoutPanelContentContainer;
.gwt-TabLayoutPanelContentContainer {
left: 150px !important;
top: 0 !important;
}
Add it to resources as usually:
public interface YouAppResources extends ClientBundle {
#Source("verticaltabpanel.css")
CssResource verticalTabPanelStyles();
}
Then inject it when your app starts:
resources.verticalTabPanelStyles().ensureInjected();
Define the tab panel in your templates like this:
<ui:style>
.tabPanel {
height: 400px;
width: 800px;
}
</ui:style>
<g:TabLayoutPanel addStyleNames="{style.tabPanel}" barUnit='PX' barHeight='0'>
</g:TabLayoutPanel>
Note that you have to set height and width and the style should be added not set.
The drawback of this approach is that all the tab panels in your application will be now vertical. If you need to have a horizontal one, you can use old TabPanel (note that it is deprecated). It is fine for my case as I have a number of vertical tab panels in my application and only one horizontal.
you can use ext-js's vertical tabs - see this demo http://iamtotti.com/playground/js/ext-3.1.1/examples/tabs/tabs.html
there is a gwt port of ext-js which you can use : http://code.google.com/p/gwt-ext/
Smart gwt also has a vertical tab implementation (its different to gwt-ext's) - http://www.smartclient.com/smartgwt/showcase and search for orientation on the left menu.
thx for your answer, megas.
One extension to make it possible to use some TabLayoutPanels with horizontal (original) and some with vertical (new) layout:
one could add ids (i.e. #myVertTab) to the css selectors.
I think what you're looking for is the TabLayoutPanel (scroll down a bit). It works great and it's a vanilla GWT widget, no third party libraries required.