-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.15Found to occur in 3.15Found to occur in 3.15frameworkflutter/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 onteam-frameworkOwned by Framework teamOwned by Framework 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
Create a SegmentedButton with a ButtonSegment with a label or an icon which is wrapped in an Opacity (see code sample)
Expected results
No error
Actual results
======== Exception caught by rendering library =====================================================
The following StateError was thrown during paint():
Bad state: A Dart object attempted to access a native peer, but the native peer has been collected (nullptr). This is usually the result of calling methods on a native-backed object when the native resources have already been disposed.The relevant error-causing widget was:
SegmentedButton SegmentedButton:file:///D:/GithubRepos/segmented_button_opacity/lib/main.dart:17:18
When the exception was thrown, this was the stack:
Full stack
#0 StateError._throwNew (dart:core-patch/errors_patch.dart:135:5) #1 _NativeCanvas.restore (dart:ui/painting.dart) #2 _RenderSegmentedButton.paint (package:flutter/src/material/segmented_button.dart:640:14) #3 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #4 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #5 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #6 _RenderInkFeatures.paint (package:flutter/src/material/material.dart:664:11) #7 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #8 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #9 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #10 RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:618:11) #11 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #12 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #13 RenderClipPath.paint (package:flutter/src/rendering/proxy_box.dart:1811:17) #14 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #15 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #16 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:74:15) #17 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #18 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #19 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2875:15) #20 RenderCustomMultiChildLayoutBox.paint (package:flutter/src/rendering/custom_layout.dart:410:5) #21 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #22 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #23 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #24 _RenderInkFeatures.paint (package:flutter/src/material/material.dart:664:11) #25 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #26 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #27 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #28 RenderPhysicalModel.paint. (package:flutter/src/rendering/proxy_box.dart:2049:15) #29 PaintingContext.pushClipRRect (package:flutter/src/rendering/object.dart:561:14) #30 RenderPhysicalModel.paint (package:flutter/src/rendering/proxy_box.dart:2036:21) #31 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #32 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #33 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #34 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #35 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #36 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #37 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #38 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:168:11) #39 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:111:5) #40 PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:263:7) #41 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:244:7) #42 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #43 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #44 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #45 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #46 _ZoomExitTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1001:23) #47 _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:335:15) #48 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #49 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #50 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #51 _ZoomEnterTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:929:23) #52 _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:335:15) #53 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #54 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #55 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #56 _ZoomExitTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1001:23) #57 _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:335:15) #58 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #59 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #60 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #61 _ZoomEnterTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:929:23) #62 _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:335:15) #63 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #64 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #65 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #66 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #67 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:168:11) #68 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:111:5) #69 PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:263:7) #70 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:244:7) #71 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #72 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #73 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #74 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #75 RenderOffstage.paint (package:flutter/src/rendering/proxy_box.dart:3752:11) #76 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #77 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #78 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #79 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #80 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #81 _RenderTheaterMixin.paint (package:flutter/src/widgets/overlay.dart:866:15) #82 _RenderTheater.paint (package:flutter/src/widgets/overlay.dart:1126:13) #83 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #84 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #85 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #86 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #87 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #88 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #89 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #90 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #91 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #92 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #93 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #94 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #95 RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:618:11) #96 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #97 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #98 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #99 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #100 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #101 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #102 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #103 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #104 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #105 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #106 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #107 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #108 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #109 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #110 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #111 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #112 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #113 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:129:13) #114 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #115 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:252:13) #116 RenderView.paint (package:flutter/src/rendering/view.dart:206:15) #117 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3155:7) #118 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:168:11) #119 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:111:5) #120 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1144:31) #121 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:496:19) #122 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:918:13) #123 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5) #124 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15) #125 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9) #126 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:952:7) #130 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12) (elided 3 frames from class _Timer and dart:async-patch) The following RenderObject was being processed when the exception was fired: _RenderSegmentedButton#e3147 relayoutBoundary=up5 ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(0.0<=w<=320.0, 0.0<=h<=621.3) ... size: Size(64.0, 48.0) RenderObject: _RenderSegmentedButton#e3147 relayoutBoundary=up5 needs compositing parentData: (can use size) constraints: BoxConstraints(0.0<=w<=320.0, 0.0<=h<=621.3) size: Size(64.0, 48.0) ... child 1: RenderMergeSemantics#c8fd2 ... needs compositing ... parentData: offset=Offset(0.0, 0.0) (can use size) ... constraints: BoxConstraints(w=64.0, h=48.0) ... semantic boundary ... size: Size(64.0, 48.0) ... child: RenderSemanticsAnnotations#fe76a ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=64.0, h=48.0) ... size: Size(64.0, 48.0) ... child: RenderSemanticsAnnotations#0dce6 ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=64.0, h=48.0) ... semantic boundary ... size: Size(64.0, 48.0) ... child: _RenderInputPadding#1ccd3 ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=64.0, h=48.0) ... size: Size(64.0, 48.0)Code sample
Code sample
import 'package:flutter/material.dart';
enum Test { option }
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: SegmentedButton<Test>(
segments: const <ButtonSegment<Test>>[
ButtonSegment<Test>(
value: Test.option,
// Error reproducible using only label, only icon or both:
label: Opacity(
opacity: 0.5,
child: Text("option"),
),
icon: Opacity(
opacity: 0.5,
child: Icon(Icons.add),
),
),
],
selected: {Test.option},
),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[!] Flutter (Channel stable, 3.13.5, on Microsoft Windows [Version 10.0.22621.2283], locale en-GB)
• Flutter version 3.13.5 on channel stable at C:\Users\james\fvm\default
! Warning: `flutter` on your path resolves to C:\Users\james\fvm\versions\3.13.5\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\james\fvm\default. Consider adding C:\Users\james\fvm\default\bin to the front of your path.
! Warning: `dart` on your path resolves to C:\Users\james\fvm\versions\3.13.5\bin\dart, which is not inside your current Flutter SDK checkout at C:\Users\james\fvm\default. Consider adding C:\Users\james\fvm\default\bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12fccda598 (10 days ago), 2023-09-19 13:56:11 -0700
• Engine revision bd986c5ed2
• Dart version 3.1.2
• DevTools version 2.25.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at D:\tools\AndroidStudioSDK
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• 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-b2043.56-9586694)
[√] VS Code, 64-bit edition (version 1.81.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (4 available)
• SM S901B (mobile) • R5CT816A6EE • android-arm64 • Android 13 (API 33)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2283]
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.188
• Edge (web) • edge • web-javascript • Microsoft Edge 117.0.2045.43
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 3 categories.
Metadata
Metadata
Assignees
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.15Found to occur in 3.15Found to occur in 3.15frameworkflutter/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 onteam-frameworkOwned by Framework teamOwned by Framework team