Repository navigation
PageView item does not dispose when widget with NoSplash.splashFactory is tapped #136441
Copy link
Copy link
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: leak trackingIssues and PRs related to memory leaks detected by leak_trackerIssues and PRs related to memory leaks detected by leak_trackerfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Click on the button in a PageView item
- Swipe the PageView to the next item
Expected results
- The PageView item should dispose when the
FilledButtonis tapped
I'm able to fix this issue by removing ThemeData(splashFactory: NoSplash.splashFactory) (every item will dispose correctly), but my app requires this custom theme.
Actual results
- The PageView item does not dispose, only if the button is tapped and the splash factory is
NoSplash.splashFactory
Code sample
Code sample
import 'package:flutter/material.dart';
void main() => runApp(const PageViewExampleApp());
class PageViewExampleApp extends StatelessWidget {
const PageViewExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(splashFactory: NoSplash.splashFactory),
home: Scaffold(
appBar: AppBar(title: const Text('PageView Sample')),
body: const PageViewExample(),
),
);
}
}
class PageViewExample extends StatelessWidget {
const PageViewExample({super.key});
@override
Widget build(BuildContext context) {
final PageController controller = PageController();
return PageView(
controller: controller,
children: const <Widget>[
Page(pageNumber: 1),
Page(pageNumber: 2),
Page(pageNumber: 3),
],
);
}
}
class Page extends StatefulWidget {
final int pageNumber;
const Page({
super.key,
required this.pageNumber,
});
@override
State<Page> createState() => _PageState();
}
class _PageState extends State<Page> {
@override
void dispose() {
print("Disposed page: ${widget.pageNumber}");
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: FilledButton(
onPressed: () {},
child: Text('Page ${widget.pageNumber}'),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
screen_recording.mp4
If the user does not tap the button, the PageView item widget will dispose. If the user taps the button without a splash factory, the PageView item will not dispose.
Logs
Logs
Restarted application in 709ms.
flutter: Disposed page: 1Flutter Doctor output
Doctor output
[✓] Flutter (Channel master, 3.16.0-10.0.pre.46, on macOS 13.6 22G120
darwin-x64, locale en-US)
• Flutter version 3.16.0-10.0.pre.46 on channel master at
/Users/jcode/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c0d19ca561 (4 hours ago), 2023-10-11 23:33:07
-0400
• Engine revision d00fabf0b9
• Dart version 3.3.0 (build 3.3.0-14.0.dev)
• DevTools version 2.28.1
[!] Android toolchain - develop for Android devices (Android SDK version
33.0.2)
• Android SDK at /Users/jcode/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more
details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See
https://flutter.dev/docs/get-started/install/macos#android-setup
for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.13.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google
Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.83.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.74.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 85347627-43C3-4413-7D7D-04A2C4412FC2 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.6 22G120 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.149
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: leak trackingIssues and PRs related to memory leaks detected by leak_trackerIssues and PRs related to memory leaks detected by leak_trackerfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
dam-ease commentedon Oct 12, 2023
Hi @VibrantTower. Thanks for filing this. I can reproduce this on the latest
masterandstablechannels following the steps highlighted above.Also, this isn't peculiar to buttons, replacing the
FilledButtonwidget withInkWellalso reproduces this issue.Code Sample with InkWell
stable, master flutter doctor -v
[-]PageView item does not dispose if tapping NoSplash.splashFactory button[/-][+]PageView item does not dispose when widget with `splashFactory: NoSplash.splashFactory` is tapped[/+][-]PageView item does not dispose when widget with `splashFactory: NoSplash.splashFactory` is tapped[/-][+]`PageView` item does not dispose when widget with `NoSplash.splashFactory` is tapped[/+]fix: flutter#136441
Fix NoSplash not being disposed (#138542)
github-actions commentedon Dec 4, 2023
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
flutter doctor -vand a minimal reproduction of the issue.Fix NoSplash not being disposed (#138542)