Skip to content

Commit

Permalink
Upgrade to latest flutter (#8308)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll committed Sep 9, 2024
1 parent 5457f57 commit fbc2f1c
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 31 deletions.
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3e4f1cdf494e09304587f648456f2560d3628fe9
aea84342eb861832bbf8578de432c4da5a074136
4 changes: 4 additions & 0 deletions packages/devtools_app/benchmark/devtools_benchmarks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ void main() {
await _runBenchmarks(useWasm: useWasm);
},
timeout: const Timeout(Duration(minutes: 10)),
// TODO(https://github.com/dart-lang/sdk/issues/56664): unskip the wasm
// benchmarks once this issue is resolved and we can bump DevTools to a
// version of Flutter that includes the fix.
skip: useWasm,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ class _FloatingDebuggerControlsState extends State<FloatingDebuggerControls>

@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
return AnimatedOpacity(
opacity: _isPaused ? 1.0 : 0.0,
duration: longDuration,
Expand All @@ -580,10 +581,7 @@ class _FloatingDebuggerControlsState extends State<FloatingDebuggerControls>
color: colorScheme.warningContainer,
height: controlHeight,
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),
borderColor: theme.focusColor,
children: [
Container(
height: defaultButtonHeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class WidgetVisualizer extends StatelessWidget {
boxShadow: isSelected
? [
BoxShadow(
color: Colors.black.withOpacity(0.5),
color: Colors.black.withAlpha(255 ~/ 2),
blurRadius: 20,
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class WidgetVisualizer extends StatelessWidget {
boxShadow: isSelected
? [
BoxShadow(
color: Colors.black.withOpacity(0.5),
color: Colors.black.withAlpha(255 ~/ 2),
blurRadius: 10,
),
]
Expand Down
20 changes: 10 additions & 10 deletions packages/devtools_app/lib/src/shared/common_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -893,11 +893,11 @@ extension ColorExtension on Color {
percent = 1.0 - percent;

final c = this;
return Color.fromARGB(
c.alpha,
(c.red * percent).round(),
(c.green * percent).round(),
(c.blue * percent).round(),
return Color.from(
alpha: c.a,
red: c.r * percent,
green: c.g * percent,
blue: c.b * percent,
);
}

Expand All @@ -906,11 +906,11 @@ extension ColorExtension on Color {
assert(0.0 <= percent && percent <= 1.0);

final c = this;
return Color.fromARGB(
c.alpha,
c.red + ((255 - c.red) * percent).round(),
c.green + ((255 - c.green) * percent).round(),
c.blue + ((255 - c.blue) * percent).round(),
return Color.from(
alpha: c.a,
red: c.r + ((1.0 - c.r) * percent),
green: c.g + ((1.0 - c.g) * percent),
blue: c.b + ((1.0 - c.b) * percent),
);
}
}
Expand Down
33 changes: 20 additions & 13 deletions packages/devtools_app/test/shared/table_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1639,10 +1639,11 @@ void main() {
final snapFinder = find.byKey(const Key('Snap'));
final crackleFinder = find.byKey(const Key('Crackle'));

// Expected values returned through accessing Color.value property.
const color1Value = 4294111476;
const color2Value = 4294967295;
const rowSelectedColorValue = 4294967295;
// Expected ARGB color values.
const color1Value =
'(a: 1.0, r: 0.9490196078431372, g: 0.9411764705882353, b: 0.9568627450980393)';
const color2Value = '(a: 1.0, r: 1.0, g: 1.0, b: 1.0)';
const rowSelectedColorValue = '(a: 1.0, r: 1.0, g: 1.0, b: 1.0)';

await tester.pumpWidget(wrap(table));
await tester.pumpAndSettle();
Expand All @@ -1661,12 +1662,12 @@ void main() {
final TableRow snapRow = tester.widget(snapFinder);
TableRow crackleRow = tester.widget(crackleFinder);

expect(fooRow.backgroundColor!.value, color1Value);
expect(barRow.backgroundColor!.value, color2Value);
expect(bazRow.backgroundColor!.value, color1Value);
expect(quxRow.backgroundColor!.value, color2Value);
expect(snapRow.backgroundColor!.value, color1Value);
expect(crackleRow.backgroundColor!.value, color2Value);
expect(fooRow.backgroundColor!.toArgbString(), color1Value);
expect(barRow.backgroundColor!.toArgbString(), color2Value);
expect(bazRow.backgroundColor!.toArgbString(), color1Value);
expect(quxRow.backgroundColor!.toArgbString(), color2Value);
expect(snapRow.backgroundColor!.toArgbString(), color1Value);
expect(crackleRow.backgroundColor!.toArgbString(), color2Value);

await tester.tap(barFinder);
await tester.pumpAndSettle();
Expand All @@ -1680,12 +1681,12 @@ void main() {
barRow = tester.widget(barFinder);
crackleRow = tester.widget(crackleFinder);

expect(fooRow.backgroundColor!.value, color1Value);
expect(fooRow.backgroundColor!.toArgbString(), color1Value);
// [barRow] has the rowSelected color after being tapped.
expect(barRow.backgroundColor!.value, rowSelectedColorValue);
expect(barRow.backgroundColor!.toArgbString(), rowSelectedColorValue);
// [crackleRow] has a different background color after collapsing previous
// row (Bar).
expect(crackleRow.backgroundColor!.value, color1Value);
expect(crackleRow.backgroundColor!.toArgbString(), color1Value);
},
);

Expand Down Expand Up @@ -1837,3 +1838,9 @@ class _VeryWideMinWidthColumn extends ColumnData<TestData> {
@override
bool get supportsSorting => false;
}

extension on Color {
String toArgbString() {
return '(a: $a, r: $r, g: $g, b: $b)';
}
}
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.
3 changes: 3 additions & 0 deletions packages/devtools_app_shared/lib/src/ui/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(kenz): remove once min flutter version of devtools_app_shared >= 3.25
// ignore_for_file: deprecated_member_use, analysis performed with newer flutter version than min sdk

import 'package:flutter/material.dart';

import '../ui_utils.dart';
Expand Down
3 changes: 3 additions & 0 deletions packages/devtools_app_shared/lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(kenz): remove once min flutter version of devtools_app_shared >= 3.25
// ignore_for_file: deprecated_member_use, analysis performed with newer flutter version than min sdk

import 'dart:async';
import 'dart:math';

Expand Down

0 comments on commit fbc2f1c

Please sign in to comment.