Skip to content

Commit

Permalink
Incorporated PR suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrylucas committed Feb 18, 2021
1 parent ce7da49 commit e6a8d3e
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 63 deletions.
1 change: 0 additions & 1 deletion packages/devtools_app/lib/src/common_widgets.dart
Expand Up @@ -13,7 +13,6 @@ import 'package:flutter/scheduler.dart';
import 'scaffold.dart';
import 'theme.dart';
import 'ui/label.dart';
import 'ui/theme.dart';

const tooltipWait = Duration(milliseconds: 500);
const tooltipWaitLong = Duration(milliseconds: 1000);
Expand Down
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/material.dart';

import '../ui/theme.dart';
import '../theme.dart';

TextStyle unimportant(ColorScheme colorScheme) => TextStyle(
color: colorScheme.isLight ? Colors.grey.shade500 : Colors.grey.shade600);
Expand Down
Expand Up @@ -16,7 +16,7 @@ import 'package:flutter/material.dart';
import 'package:meta/meta.dart';

import '../config_specific/logger/logger.dart';
import '../ui/theme.dart';
import '../theme.dart';
import 'diagnostics_node.dart';
import 'inspector_service.dart';

Expand Down
Expand Up @@ -16,7 +16,6 @@ import '../common_widgets.dart';
import '../error_badge_manager.dart';
import '../theme.dart';
import '../ui/colors.dart';
import '../ui/theme.dart';
import 'diagnostics.dart';
import 'diagnostics_node.dart';
import 'inspector_tree.dart';
Expand Down
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/material.dart';

import '../../../ui/theme.dart';
import '../../../theme.dart';

const margin = 8.0;

Expand Down
Expand Up @@ -7,7 +7,7 @@ import 'dart:ui';
import 'package:flutter/material.dart';

import '../../../common_widgets.dart';
import '../../../ui/theme.dart';
import '../../../theme.dart';
import '../../../utils.dart';
import '../../diagnostics_node.dart';
import '../../inspector_data_models.dart';
Expand Down
15 changes: 9 additions & 6 deletions packages/devtools_app/lib/src/memory/memory_screen.dart
Expand Up @@ -919,13 +919,13 @@ class MemoryBodyState extends State<MemoryBody>

final colorScheme = Theme.of(context).colorScheme;
final hoverTextStyle = colorScheme.hoverTextStyle;
final unselectedColor = colorScheme.unselectedColor;
final contrastForeground = colorScheme.contrastForeground;
final collapsedColor = colorScheme.defaultBackgroundColor;

return Material(
color: Colors.transparent,
child: Theme(
data: ThemeData(unselectedWidgetColor: unselectedColor),
data: ThemeData(unselectedWidgetColor: contrastForeground),
child: ExpansionTile(
tilePadding: EdgeInsets.zero,
childrenPadding: EdgeInsets.zero,
Expand All @@ -947,9 +947,9 @@ class MemoryBodyState extends State<MemoryBody>
}

Widget cardWidget(String value) {
final coloreScheme = Theme.of(context).colorScheme;
final hoverValueEntry = coloreScheme.hoverSmallValueTextStyle;
final expandedGradient = coloreScheme.verticalGradient;
final colorScheme = Theme.of(context).colorScheme;
final hoverValueEntry = colorScheme.hoverSmallValueTextStyle;
final expandedGradient = colorScheme.verticalGradient;

return Padding(
padding: const EdgeInsets.only(bottom: 8),
Expand Down Expand Up @@ -1083,6 +1083,7 @@ class MemoryBodyState extends State<MemoryBody>
ChartsValues chartsValues,
Offset position,
) {
final focusColor = Theme.of(context).focusColor;
final colorScheme = Theme.of(context).colorScheme;

final RenderBox box = hoverKey.currentContext.findRenderObject();
Expand Down Expand Up @@ -1125,7 +1126,9 @@ class MemoryBodyState extends State<MemoryBody>
decoration: BoxDecoration(
color: colorScheme.defaultBackgroundColor,
border: Border.all(
color: Colors.grey[400], width: hover_card_border_width),
color: focusColor,
width: hover_card_border_width,
),
borderRadius: BorderRadius.circular(10.0),
),
width: hoverWidth,
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/src/navigation.dart
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/material.dart';

import 'ui/theme.dart';
import 'theme.dart';

/// Returns [routeName] with [queryParameters] appended as [Uri] query
/// parameters.
Expand Down
Expand Up @@ -18,7 +18,6 @@ import '../geometry.dart';
import '../theme.dart';
import '../ui/colors.dart';
import '../ui/search.dart';
import '../ui/theme.dart';
import '../utils.dart';
import 'performance_controller.dart';
import 'performance_model.dart';
Expand Down
46 changes: 38 additions & 8 deletions packages/devtools_app/lib/src/theme.dart
Expand Up @@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:devtools_app/src/ui/colors.dart';
import 'package:flutter/material.dart';

import 'common_widgets.dart';
import 'config_specific/ide_theme/ide_theme.dart';
import 'ui/theme.dart';

const _contrastForegroundWhite = Color.fromARGB(255, 240, 240, 240);

const contrastForegroundWhite = _contrastForegroundWhite;

/// Constructs the light or dark theme for the app taking into account
/// IDE-supplied theming.
Expand Down Expand Up @@ -181,6 +185,35 @@ const devtoolsError = Color(0xFFAF4054);
const devtoolsWarning = Color(0xFFFDFAD5);

extension DevToolsColorScheme on ColorScheme {
bool get isLight => brightness == Brightness.light;
bool get isDark => brightness == Brightness.dark;

// Commonly used themed colors.
Color get defaultBackground => isLight ? Colors.white : Colors.black;

Color get defaultForeground =>
isLight ? Colors.black : const Color.fromARGB(255, 187, 187, 187);

/// Text color [defaultForeground] is too gray, making it hard to read the text
/// in dark theme. We should use a more white color for dark theme, but not
/// jarring white #FFFFFF.
Color get contrastForegroundWhite => _contrastForegroundWhite;

Color get contrastForeground =>
isLight ? Colors.black : _contrastForegroundWhite;

Color get grey => isLight
? const Color.fromARGB(255, 128, 128, 128)
: const Color.fromARGB(255, 128, 128, 128);

/// Background colors for charts.
Color get chartBackground => isLight ? Colors.white : const Color(0xFF2D2E31);

Color get defaultButtonIconColor =>
isLight ? const Color(0xFF24292E) : const Color(0xFF89B5F8);

Color get defaultPrimaryButtonIconColor => defaultBackground;

Color get devtoolsLink =>
isLight ? const Color(0xFF1976D2) : Colors.lightBlueAccent;
// TODO(jacobr): replace this with Theme.of(context).scaffoldBackgroundColor, but we use
Expand Down Expand Up @@ -224,39 +257,36 @@ extension DevToolsColorScheme on ColorScheme {

// Title of the hover card.
TextStyle get hoverTitleTextStyle => TextStyle(
color: isLight ? Colors.black87 : Colors.white54,
color: defaultForeground,
fontWeight: FontWeight.normal,
fontSize: 15,
decoration: TextDecoration.none,
);

// Items in the hover card.
TextStyle get hoverTextStyle => TextStyle(
color: isLight ? Colors.black87 : Colors.white54,
color: defaultForeground,
fontWeight: FontWeight.normal,
fontSize: 11.5,
decoration: TextDecoration.none,
);

// Value of items in hover e.g., capacity, etc.
TextStyle get hoverValueTextStyle => TextStyle(
color: isLight ? Colors.black87 : Colors.white30,
color: contrastForeground,
fontWeight: FontWeight.normal,
fontSize: 11.5,
decoration: TextDecoration.none,
);

// Used for custom extension event values.
TextStyle get hoverSmallValueTextStyle => TextStyle(
color: isLight ? Colors.black87 : Colors.white30,
color: defaultForeground,
fontWeight: FontWeight.normal,
fontSize: 10,
decoration: TextDecoration.none,
);

// Used for ExpansionTile collapsed trailing icon color.
Color get unselectedColor => isLight ? Colors.black : Colors.white;

Color get expandedColor => isLight ? Colors.grey[200] : Colors.grey[800];

Color get expandedTopContentColor =>
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/src/ui/colors.dart
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/material.dart';

import 'theme.dart';
import '../theme.dart';

/// This file holds color constants that are used throughout DevTools.
// TODO(kenz): move colors from other pages to this file for consistency.
Expand Down
1 change: 0 additions & 1 deletion packages/devtools_app/lib/src/ui/icons.dart
Expand Up @@ -17,7 +17,6 @@ import 'package:flutter/material.dart';
import 'package:meta/meta.dart';

import '../theme.dart';
import 'theme.dart';

class CustomIcon extends StatelessWidget {
const CustomIcon({
Expand Down
Expand Up @@ -17,7 +17,6 @@ import '../service_registrations.dart';
import '../theme.dart';
import '../utils.dart';
import 'label.dart';
import 'theme.dart';

/// Group of buttons where each button toggles the state of a VMService
/// extension.
Expand Down
38 changes: 0 additions & 38 deletions packages/devtools_app/lib/src/ui/theme.dart

This file was deleted.

0 comments on commit e6a8d3e

Please sign in to comment.