Skip to content

New widget icons and alignment added (#3195) #3215

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added packages/devtools_app/icons/custom/bg-gray-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/devtools_app/icons/custom/bg-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/devtools_app/icons/custom/bg-new-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/devtools_app/icons/custom/class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/devtools_app/icons/custom/[email protected]
Binary file not shown.
Binary file modified packages/devtools_app/icons/custom/class_abstract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/devtools_app/icons/custom/[email protected]
Binary file not shown.
Binary file modified packages/devtools_app/icons/custom/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/devtools_app/icons/custom/method.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/devtools_app/icons/custom/method_abstract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/devtools_app/icons/custom/[email protected]
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions packages/devtools_app/lib/src/inspector/inspector_tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ typedef TreeEventCallback = void Function(InspectorTreeNode node);
// TODO(jacobr): merge this scheme with other color schemes in DevTools.
extension InspectorColorScheme on ColorScheme {
Color get selectedRowBackgroundColor => isLight
? const Color.fromARGB(255, 202, 191, 69)
: const Color.fromARGB(255, 99, 101, 103);
? const Color.fromARGB(255, 220, 220, 220)
: const Color.fromARGB(255, 73, 73, 73);
Color get hoverColor =>
isLight ? Colors.yellowAccent : const Color.fromARGB(255, 70, 73, 76);
}

const double iconPadding = 5.0;
const double iconPadding = 4.0;
const double chartLineStrokeWidth = 1.0;
double get columnWidth => isDense() ? 12 : 16.0;
double get verticalPadding => scaleByFontFactor(10.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ class InspectorRowContent extends StatelessWidget {
},
child: Container(
height: rowHeight,
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: DiagnosticsNodeDescription(
node.diagnostic,
isSelected: row.isSelected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import '../ui/layout_explorer_widget.dart';
import '../ui/theme.dart';
import '../ui/utils.dart';
import '../ui/widget_constraints.dart';
import '../ui/widgets_theme.dart';

class BoxLayoutExplorerWidget extends LayoutExplorerWidget {
const BoxLayoutExplorerWidget(
Expand Down Expand Up @@ -215,7 +216,7 @@ class _BoxLayoutExplorerWidgetState extends LayoutExplorerWidgetState<
height: constraints.maxHeight,
decoration: BoxDecoration(
border: Border.all(
color: regularWidgetColor,
color: WidgetTheme.fromName(properties.node.description).color,
),
),
child: Stack(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,29 @@ class _VisualizeFlexChildrenState extends State<VisualizeFlexChildren> {
);

final childrenRenderWidgets = <Widget>[];
Widget selectedWidget;
for (var i = 0; i < widget.children.length; i++) {
final child = widget.children[i];
final isSelected = widget.highlighted == child;

childrenRenderWidgets.add(FlexChildVisualizer(
final visualizer = FlexChildVisualizer(
key: isSelected ? selectedChildKey : null,
state: widget.state,
layoutProperties: child,
isSelected: isSelected,
renderProperties: renderProperties[i],
));
);

if (isSelected) {
selectedWidget = visualizer;
} else {
childrenRenderWidgets.add(visualizer);
}
}

// Selected widget needs to be last to draw its border over other children
if (selectedWidget != null) {
childrenRenderWidgets.add(selectedWidget);
}

final freeSpacesWidgets = [
Expand Down Expand Up @@ -679,7 +691,7 @@ class FlexChildVisualizer extends StatelessWidget {
return Positioned(
top: renderOffset.dy,
left: renderOffset.dx,
child: InkWell(
child: GestureDetector(
onTap: () => state.onTap(properties),
onDoubleTap: () => state.onDoubleTap(properties),
onLongPress: () => state.onDoubleTap(properties),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import '../../diagnostics_node.dart';
import '../../inspector_data_models.dart';
import 'overflow_indicator_painter.dart';
import 'theme.dart';
import 'widgets_theme.dart';

/// A widget for positioning sized widgets that follows layout as follows:
/// | top |
Expand Down Expand Up @@ -142,7 +143,10 @@ class WidgetVisualizer extends StatelessWidget {

final OverflowSide overflowSide;

static const overflowIndicatorSize = 20.0;
static const _overflowIndicatorSize = 20.0;
static const _borderUnselectedWidth = 1.0;
static const _borderSelectedWidth = 3.0;
static const _selectedPadding = 4.0;

bool get drawOverflow => overflowSide != null;

Expand All @@ -151,80 +155,96 @@ class WidgetVisualizer extends StatelessWidget {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final properties = layoutProperties;
Color borderColor = regularWidgetColor;
if (properties is FlexLayoutProperties) {
borderColor =
properties?.direction == Axis.horizontal ? rowColor : columnColor;
}
if (isSelected) {
borderColor = selectedWidgetColor;
}
return Container(
child: Stack(
children: [
if (drawOverflow)
Positioned.fill(
child: CustomPaint(
painter: OverflowIndicatorPainter(
overflowSide,
overflowIndicatorSize,
),
),
),
Container(
margin: EdgeInsets.only(
right: overflowSide == OverflowSide.right
? overflowIndicatorSize
: 0.0,
bottom: overflowSide == OverflowSide.bottom
? overflowIndicatorSize
: 0.0,
),
color: isSelected ? colorScheme.backgroundColorSelected : null,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
final borderColor = WidgetTheme.fromName(properties.node.description).color;
final boxAdjust = isSelected ? _selectedPadding : 0.0;

return LayoutBuilder(
builder: (context, constraints) {
return OverflowBox(
minWidth: constraints.minWidth + boxAdjust,
maxWidth: constraints.maxWidth + boxAdjust,
maxHeight: constraints.maxHeight + boxAdjust,
minHeight: constraints.minHeight + boxAdjust,
child: Container(
child: Stack(
children: [
IntrinsicHeight(
child: Row(
if (drawOverflow)
Positioned.fill(
child: CustomPaint(
painter: OverflowIndicatorPainter(
overflowSide,
_overflowIndicatorSize,
),
),
),
Container(
margin: EdgeInsets.only(
right: overflowSide == OverflowSide.right
? _overflowIndicatorSize
: 0.0,
bottom: overflowSide == OverflowSide.bottom
? _overflowIndicatorSize
: 0.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Container(
constraints: BoxConstraints(
maxWidth: largeTitle
? defaultMaxRenderWidth
: minRenderWidth *
widgetTitleMaxWidthPercentage),
child: Center(
child: Text(
title,
style:
TextStyle(color: colorScheme.widgetNameColor),
overflow: TextOverflow.ellipsis,
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Container(
constraints: BoxConstraints(
maxWidth: largeTitle
? defaultMaxRenderWidth
: minRenderWidth *
widgetTitleMaxWidthPercentage),
child: Center(
child: Text(
title,
style: TextStyle(
color: colorScheme.widgetNameColor),
overflow: TextOverflow.ellipsis,
),
),
decoration: BoxDecoration(color: borderColor),
padding: const EdgeInsets.all(4.0),
),
),
),
decoration: BoxDecoration(color: borderColor),
padding: const EdgeInsets.all(4.0),
if (hint != null) Flexible(child: hint),
],
),
),
if (hint != null) Flexible(child: hint),
if (child != null) Expanded(child: child),
],
),
),
if (child != null) Expanded(child: child),
],
),
decoration: BoxDecoration(
border: Border.all(
color: borderColor,
width:
isSelected ? _borderSelectedWidth : _borderUnselectedWidth,
),
color: isSelected
? theme.canvasColor.brighten()
: theme.canvasColor.darken(),
boxShadow: isSelected
? [
BoxShadow(
color: Colors.black.withOpacity(.5),
blurRadius: 20,
),
]
: null,
),
),
],
),
decoration: BoxDecoration(
border: Border.all(
color: borderColor,
),
color: theme.canvasColor.darken(),
),
);
},
);
}
}
Expand Down
Loading