-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssetImage does not load on pushing a route after moving app from background to foreground #99057
Comments
Logs
Screen capture: MP4_20220224_092426.mp4 |
Hi @Glitchy-Tozier, Thanks for filing the issue. I ran your code sample when I clicked on |
@maheshmnj Thank you for trying out the bug! Am I correct in assuming this an iPhone-screenshot? If the answer is yes, please try out the bug on an android-device. |
@Glitchy-Tozier running the app on android makes no difference when I click on list of habits there are no options I could go forward to as per your reproducible steps. Please check the project shared and ensure your reproducible steps are aligned with the project. android.mov |
@maheshmnj
Looking at my code, the blank screen indicates that the database never returns a value or somehow returns null, both of which should never happen. Could it be that your testing-environment prohibits that the app create/use its own storage? The reason I'm asking is that at first install of the app, I create two entries in the app's database -> two buttons will be shown later on. |
@Glitchy-Tozier I reinstalled the app and could see a list of habits but I was not able to reproduce the issue verified on on Redmi k20 pro (Android 11) and pixel 4a emulator (api 30). I did verify on mac and Linux systems too, but couldn't reproduce it the asset image always loads. Screen.Recording.2022-02-28.at.11.22.33.AM.movDo you see this issue on any specific set of Android versions/ devices ? Also can you please confirm if this occurs in any specific build mode (debug/profile/release) or all modes? flutter doctor -v (mac)
flutter doctor -v (Linux)
|
The tested devices are the following:
It happened on all three of them, but I can't tell whether there's some common ground between them.
It happens in debug ( |
@Glitchy-Tozier Sorry I missed that part making that change I was able to reproduce the issue. But in order to investigate this issue further, you would need to narrow down the code sample and provide a minimal and complete sample code. You could do this by either creating a new project and adding the part of code that reproduces the issue or remove the unwanted part from your project that doesn't reproduce the issue. Screen.Recording.2022-02-28.at.7.26.50.PM.movlogsLaunching lib/main.dart on Redmi K20 Pro in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:56522/q53OCOGi3Y0=/ws
I/flutter (31166): ~~~~~~~~~~~~~~~~~~~~~~~~~~
I/flutter (31166): There's definitely nothing wrong. Ignore this message please!!
I/flutter (31166): ~~~~~~~~~~~~~~~~~~~~~~~~~~
I/ler.githo.debu(31166): ProcessProfilingInfo new_methods=1131 is saved saved_to_disk=1 resolve_classes_delay=8000
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28895307, downTime=28895307 } moveCount:0
W/MirrorManager(31166): this model don't Support
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28895356, downTime=28895307 } moveCount:4
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28895555, downTime=28895555 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28895630, downTime=28895555 } moveCount:6
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28895829, downTime=28895829 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28895904, downTime=28895829 } moveCount:6
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28896137, downTime=28896137 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28896212, downTime=28896137 } moveCount:6
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28920939, downTime=28920939 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28921021, downTime=28920939 } moveCount:7
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28921348, downTime=28921348 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28921431, downTime=28921348 } moveCount:6
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28922231, downTime=28922231 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28922296, downTime=28922231 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28924112, downTime=28924112 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28924178, downTime=28924112 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28925103, downTime=28925103 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28925152, downTime=28925103 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28928627, downTime=28928627 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28928684, downTime=28928627 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28930540, downTime=28930540 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28930757, downTime=28930540 } moveCount:19
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28932097, downTime=28932097 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28932198, downTime=28932097 } moveCount:8
D/MIUIInput(31166): [KeyEvent] ViewRootImpl KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x48, repeatCount=0, eventTime=28933581, downTime=28933581, deviceId=-1, source=0x101, displayId=0 }
D/MIUIInput(31166): [KeyEvent] ViewRootImpl KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x48, repeatCount=0, eventTime=28933638, downTime=28933581, deviceId=-1, source=0x101, displayId=0 }
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28936645, downTime=28936645 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28936704, downTime=28936645 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=28939728, downTime=28939728 } moveCount:0
D/MIUIInput(31166): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=28940765, downTime=28939728 } moveCount:67
flutter doctor -v (mac)
|
This is the most simplified version I can get: https://github.com/Glitchy-Tozier/Flutter-Debug-AssetImage. Actually, I think it might have an Idea about what's wrong. The child: ListView.builder(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: list.length,
itemBuilder: (BuildContext buildContex, int i) {
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<SingleHabitDisplay>(
builder: (BuildContext context) => SingleHabitDisplay(),
),
);
},
child: Text(list[i].toString()),
);
},
), with this code child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<SingleHabitDisplay>(
builder: (BuildContext context) => SingleHabitDisplay(),
),
);
},
child: const Text('This should work'),
), Instructions for reproducing:
|
Awesome @Glitchy-Tozier, I narrowed down your code sample further and I was able to reproduce the issue on flutter channel master
flutter upgrade The fix should be available on the stable channel in the upcoming stable release.
minimal code sampleimport 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
/// This widget is the root of the application.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Githo - Get Into The Habit Of…',
themeMode: ThemeMode.dark,
home: HabitList(),
debugShowCheckedModeBanner: false,
);
}
}
class HabitList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Background(
child: Center(
// Turn Listview.builder into a regular Button and the bug disappears.
// child: ElevatedButton(
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute<SingleHabitDisplay>(
// builder: (BuildContext context) => SingleHabitDisplay(),
// ),
// );
// },
// child: const Text('This should work'),
// ),
child: ListView.builder(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: 1,
itemBuilder: (BuildContext buildContex, int i) {
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<SingleHabitDisplay>(
builder: (BuildContext context) => SingleHabitDisplay(),
),
);
},
child: Text('tap me'),
);
},
),
),
),
);
}
}
class SingleHabitDisplay extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Background(
child: Center(
child: Text(
'Bugged Screen!\nNotice that background image failed to load'),
),
),
);
}
}
class Background extends StatelessWidget {
/// Returns a background and places the child in the foreground.
const Background({
this.child = const SizedBox(),
Key? key,
}) : super(key: key);
final Widget child;
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/b.png'),
fit: BoxFit.fill,
),
),
),
child,
],
);
}
}
flutter doctor -v (mac)
Closing as this is fixed on the master channel. Incase you disagree fee free to write in the comments and we will reopen it. Thank you. Edit: The fix is also available on beta channel
|
Good job, thank you! :) |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
The strange thing about this bug is that it doesn't happen with the previous version of this app. (v1.2.2 on https://f-droid.org/en/packages/com.florianthaler.githo/)
The issue can't be debug-only because still occurs when using
flutter install
.Steps to Reproduce
Setup:
widgets/background.dart
and replaceExactAssetImage
withAssetImage
.flutter run
to get the app on your android-phoneActual bug:
The bug happens when navigating to a new screen after pausing & returning to the app. It doesn't work everywhere though, which is pretty confusing.
Other parts of
background.dart
still are getting shown (turn on dark mode to see them), so it can't be thatbackground.dart
isn't loaded at all. Also, in all affected screens, I loadBackground
as the top Widget, right afterScaffold
. Thus, this shouldn't be an effect of weird app-internal logic that decides to not show theBackground
-Widget."Fix":
When tapping this bugged screen, nothing changes; however, when I scroll, the background suddenly pops into existence.
Expected results:
The next screen should still be able to load the AssetImage.
Actual results:
No background-image is shown (other parts of the
Background
-Widget are still getting shown)Code sample
I did my best to create a minimal sample, but I can't get the bug to appear in a new project. Still, I can share the code-sample to give an idea of how the
backgrould.dart
-Widget is used.(In this case, you would try to reproduce the bug by starting the app, going into Android's "task-manager-view", coming back, and clicking on the FloatingActionButton to navigate to the next, bugged screen.)
main.dart
Background.dart
Logs: Moved to next comment due to character-cap on Github
The text was updated successfully, but these errors were encountered: