A difference in the visibility animation of StatusBar and BottomNavigationBar is perceptible.
All I did was
onTap:(){
makeItFullScreen
? SystemChrome.setEnabledSystemUIOverlays([])
: SystemChrome.setEnabledSystemUIOverlays(
[SystemUiOverlay.bottom, SystemUiOverlay.top]);
makeItFullScreen = !makeItFullScreen;
}
The flickering of that particular part(bottom) of the screen needs to be fixed I guess.
Most of us might not have noticed this because we usually use the white(default) background of our Scaffold.
P.S I tested it on Emulator and on an actual device.
Related
I use privacy-screen plugin to hide content when app is in the background, but it shows just gray background. I need to set splashScreen instead. Any suggestions?
I tried splashScreen plugin, but it is not working for me.
I don't know if it's the best way but I think that using Capacitor appStateChange from #capacitor/app (documentation) you could show and hide a screen with your logo when app is in background or foreground.
import { App } from '#capacitor/app';
App.addListener('appStateChange', ({ isActive }) => {
console.log('App state changed. Is active?', isActive);
if(!isActive) showLogoScreen();
else hideLogoScreen();
});
I hope it helps :)
For iOS, I did it simply in native code: just find the "applicationWillResignActive" method in AppDelegate and insert a view on top of the window.
For Android, sadly I couldn't find a better solution. The "gray background" you described is likely the implementation of Hide screen in 'Recent Apps List', but allow screenshots
I use a function that checks MediaQuery.of(context).platformBrightness to determine the platform dark-mode setting:
This is called from the didChangeAppLifecycleState() and during startup - and it mostly works, except that I find that I need to minimise and re-open the app for it to receive the updated display mode.
The MediaQuery platformBrightness value appears to not be updated when the app comes to the foreground, but if you just minimise and bring the app back to forground, it is correct. This is on the Pie emulator using SDK 29.0.2.
Is there a way to directly listen for notifications about platform dark mode?
Note: There are a number of reasons why I don't use the Flutter Theme engine - The app themes are more complex than what Flutter provides and the user is given a preference setting to override the dark mode / normal setting to force the app to go use dark mode or normal mode and even provide dark and normal mode to older versions of android. However when the user selects "Auto" for dark/normal display mode the app should follow the platform mode, and in fact should switch even if th user does not actually leave the app, such as by just pulling down the shade and setting dark mode on or off. For this I would need a way to listen to the events.
UPDATE:
Futher testing shows the the MediaQuery is in fact updated, but that the value is still reflecting the old value when didChangeAppLifecycleState() is called.
For example the following works:
#override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(
if (displayModePreferenceSetting == DISPLAY_MODE_AUTO) {
Timer(Duration(milliseconds: 333), () {
switchDisplayMode(DISPLAY_MODE_AUTO);
});
}
}
It's much simpler than I thought, though I had to find the answer by accident.
A State widget allows you to override a method didChangePlatformBrightness()
Example:
#override
void didChangePlatformBrightness() {
if (MediaQuery.of(context).platformBrightness == Brightness.dark) {
print('PROBED DISPLAY MODE: DARK');
// DO DARK MAGIC HERE
} else {
print('PROBED DISPLAY MODE: NORMAL');
// NORMAL MODE HERE
}
}
I have a screen in my app with an image as the background, this image is on my asset folder. When I navigate to this screen the background is blank for an instant and then the image is loaded and it appears. This makes my screen look weird for a half a second or less, but enough for the user to notice.
I wanted to be able to only navigate to that screen once the image is loaded (I can wait on the previous screen), so I can avoid this behavior and have the screen as a whole when the user navigates there.
I know can make the image fade in, but that's not the experience that I want.
You need to use ImageProvider.resolve method
So suppose you have some image registered in you assets.
Then you may obtain the image provider as
_imageProvider = Image.asset("your_asset").image.
Then you may add such method:
import 'dart:ui';
Image _image;
bool _resolved;
void _resolveImageProvider() {
ImageStream stream = _imageProvider.resolve(createLocalImageConfiguration(context));
stream.addListener(ImageStreamListener((info, _) {
setState(() {
//here you may set some flags or anything which indicates the image is in memory now.
_resolved = true;
_image = info.image;
});
}));
}
Then you can call this method on the "previous screen", wait till the listener is triggered and only then navigate to the next view.
I started Xamarin.Forms and it is great with MVVM pattern.
As main page I use NavigationPage and navigate with PushAsync and PopAsync brteen different pages. This works great if the phone stays in the same orientation. If I rotate screen, Xamarin shows always the first page after rotation.
How can I prevent this? I want to support the screen rotation and don't loose the navigation stack after rotation.
This is possible when running Android. Make sure that your MainActivity class has the ConfigurationChanges attributes. Here is an example:
[Activity(Label = "MYProject.Droid", Icon = "#drawable/icon", Theme = "#style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
I have an issue with iScroll4 when I change the orienatation from portrait to landscape. It is working on AppMobi XDK, but on iPhone, it is not rendering properly. I have tried to trap the orientationchange event and called the refresh method of iScroll with different timeout values, but no luck.
please use jq.scroller.js from the link:
https://github.com/appMobi/jQ.Mobi/tree/master/plugins
It is easy to use with like this:
var options={
verticalScroll:true, //vertical scrolling
horizontalScroll:false, //horizontal scrolling
scrollBars:true //display scrollbars
vScrollCSS : "scrollBarV", //CSS class for veritcal scrollbar
hScrollCSS : "scrollBarH", //CSS class for horizontal scrollbar
refresh:true, //Adds 'Pull to refresh' at the top
refreshFunction:updateMessage //callback function to execute on pull to refresh
}
var scroller = $("#my_div").scroller(options);
Replace #my_div with your Div ID.It will work perfectly.
Thanks
This is a bug with iScroll. I'm a developer at appMobi, and lead developer of jqMobi and our scrolling library does not have this problem.