how to reduce Flutter launch_background.xml display time? - flutter

I have set an image in launch_background.xml file for splash screen. it takes around 5sec to switch to next page. how to reduce display time.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <item android:drawable="#android:color/white" />-->
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#mipmap/splash_screen" />
</item>
</layer-list>
Please suggest how to reduce display time?

I think you are running app in debug mode so it will take time. I will suggest you run the app in release mode. by running this command in terminal.
flutter run --release
By default, flutter run compiles to debug mode. Your IDE supports this mode. Android Studio, for example, provides a Run > Debug… menu option, as well as a green bug icon overlayed with a small triangle on the project page.
Read more about Flutter's build modes here

Related

How to change cursor color in html-editor-enhanced flutter

I am using html-editor-enhanced to compose.
I'm having problems synchronizing the cursor colors with the app's colors. when I focus on Editor, the default color of the cusor is green. while my app has a different color. How do I change the color of this cursor?
Hope to get help from the community.
I have found the answer to my question.
In android native. > Res>value> style.xml
add this line
<item name="android:colorControlActivated">#2F93EF</item>
Full code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:colorControlActivated">#2F93EF</item>
</style>
</resources>

White Screen before SplashScreen for no reason

I am having trouble removing the white screen that appears before my splash screen. I saw many videos and followed their instructions but still, that white screen don't go away. I am a beginner so I don't have much knowledge to solve it, kindly help!
I am using initState to show the splash screen. I have also put my splash image inside the drawable folder and this is how my launch_background.xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/black" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash" />
</item>
</layer-list>
Okay, so my problem was solved when I added my splash in styles.xml file:
<item name="android:windowBackground">#drawable/splash</item>

When I swipe from left to right, I don't want it to exit the wearos application in flutter

When I swipe from left to right, I don't want it to exit the wearos application (in flutter/wearos). What can I do for this?
actually, this path writes for kotlin and java in androiddevelopers but l can't see for flutter. so l wrote it for flutter. almost everything is same.
you should open styles.xml(android/app/src/main/res/values/styles.xml).Then you should write false this in Launch theme.
so it should looks like this
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowSwipeToDismiss">false</item>
</style>

Add a splash screen in flutter

i try to add a splash screen in flutter i place the splash image in drawable folder and update the launch_background.xml but the quality of image is very low as compare to original image.
How to get the original image in the splash
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash" />
</item>
</layer-list>

Start an activity with FLAG_SHOW_WHEN_LOCKED. The previous activity disappears and slides in again

I lock the device screen, start the activity LockAct. LockAct starts another activity which has a SurfaceView.
If I don't add <item name="android:windowBackground">#android:color/transparent</item> to the activity with the SurfaceView, neither surfaceCreated nor surfaceChanged will be called.
If I add <item name="android:windowBackground">#android:color/transparent</item> to the activity with the SurfaceView, LockAct disappears and slides in on Android 5.0 only as shown in the video. It looks ugly.
How to prevent LockAct from disappearing and sliding in again?
What I've already tried:
ActivityOptions for LockAct
Intent intent = new Intent(getApplicationContext(), LockAct.class);
startActivity(intent, ActivityOptions.makeCustomAnimation(getApplicationContext(), 0, 0).toBundle());
android:windowAnimationStyle for LockAct
<style name="NoAnim" parent="#style/AppTheme">
<item name="android:windowAnimationStyle">#null</item>
</style>
<activity android:name="com.admin.LockAct"
android:theme="#style/NoAnim" />
android:windowEnterTransition and android:windowExitTransition for LockAct
<style name="NoAnim" parent="#style/AppTheme">
<item name="android:windowEnterTransition">#null</item>
<item name="android:windowExitTransition">#null</item>
</style>
<activity android:name="com.admin.LockAct"
android:theme="#style/NoAnim" />
Here is an archive with my sample Android app: https://www.dropbox.com/s/mc4pzqwc2o8lsej/Sample-Android-Lock.rar?dl=0
Activities are not started or finished smoothly when the device screen is locked. I noticed that on Android 5.0, but everything looks pretty good on my Samsung Galaxy S3 with CyanogenMod (Android 4.3.1). So different behavior may be on different devices and/or OS versions.
A co-worker gave me the link https://stackoverflow.com/a/23022023/1065835, and I'm going to use fragments instead of activities.