-
Notifications
You must be signed in to change notification settings - Fork 338
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
Add floating debugger controls when app is paused #2676
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,7 +256,7 @@ class DebuggerScreenBodyState extends State<DebuggerScreenBody> | |
builder: (context, breakpoints, _) { | ||
return Row(children: [ | ||
BreakpointsCountBadge(breakpoints: breakpoints), | ||
ActionButton( | ||
DevToolsTooltip( | ||
child: ToolbarAction( | ||
icon: Icons.delete, | ||
onPressed: | ||
|
@@ -370,3 +370,73 @@ class _DebuggerStatusState extends State<DebuggerStatus> with AutoDisposeMixin { | |
return 'paused$reason$fileName $pos'; | ||
} | ||
} | ||
|
||
class FloatingDebuggerControls extends StatelessWidget { | ||
@visibleForTesting | ||
static const debuggerControlsKey = Key('debugger controls'); | ||
kenzieschmoll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@visibleForTesting | ||
static const debuggerControlsResumeKey = Key('debugger controls - resume'); | ||
|
||
@visibleForTesting | ||
static const debuggerControlsStepKey = Key('debugger controls - step'); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final controller = Provider.of<DebuggerController>(context); | ||
return ValueListenableBuilder<bool>( | ||
valueListenable: controller.isPaused, | ||
builder: (context, paused, _) { | ||
if (!paused) return const SizedBox(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: rather than having this become a sized box when not paused consider making the ui unclickable when not paused and providing an animated transition showing and hiding the ui. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea. done - see pr description for gif |
||
return Container( | ||
key: debuggerControlsKey, | ||
color: devtoolsWarning, | ||
height: defaultButtonHeight, | ||
child: OutlinedRowGroup( | ||
// Default focus color for the light theme - since the background | ||
// color of the controls [devtoolsWarning] is the same for both | ||
// themes, we will use the same border color. | ||
borderColor: Colors.black.withOpacity(0.12), | ||
children: [ | ||
Container( | ||
height: defaultButtonHeight, | ||
alignment: Alignment.centerLeft, | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: defaultSpacing, | ||
), | ||
child: const Text( | ||
'Main isolate is paused in the debugger', | ||
style: TextStyle(color: Colors.black), | ||
), | ||
), | ||
DevToolsTooltip( | ||
tooltip: 'Resume', | ||
child: TextButton( | ||
key: debuggerControlsResumeKey, | ||
onPressed: controller.resume, | ||
child: const Icon( | ||
Icons.play_arrow, | ||
color: Colors.green, | ||
size: defaultIconSize, | ||
), | ||
), | ||
), | ||
DevToolsTooltip( | ||
tooltip: 'Step over', | ||
child: TextButton( | ||
key: debuggerControlsStepKey, | ||
onPressed: controller.stepOver, | ||
child: const Icon( | ||
Icons.keyboard_arrow_right, | ||
color: Colors.black, | ||
size: defaultIconSize, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is only the left side special cased and not the right side.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do this to make sure there are not any double borders. The right side of the previous element will serve as the left border for the next element (for all except the first since the first does not have a previous element)