Skip to content

Commit

Permalink
Merge branch 'flutter:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoamador authored Nov 6, 2023
2 parents b1ea800 + c3f3819 commit bda6333
Show file tree
Hide file tree
Showing 43 changed files with 381 additions and 230 deletions.
2 changes: 1 addition & 1 deletion app_dart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


# Dart Docker official images can be found here: https://hub.docker.com/_/dart
FROM dart:beta@sha256:b81805d66a633f8ee5bb20db229d7a680dd6ef16d1ef67fd74ca8a056f29a42f
FROM dart:beta@sha256:88ced76ff4a63e565872df26fe2442f060e3ecf828a272090ad10c79e9d044af

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion app_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dev_dependencies:
analyzer: 5.13.0
build_runner: 2.4.6
fake_async: 1.3.1
flutter_lints: 3.0.0
flutter_lints: 3.0.1
json_serializable: 6.7.1
mockito: 5.4.2
platform: 3.1.3
Expand Down
2 changes: 1 addition & 1 deletion auto_submit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


# Dart Docker official images can be found here: https://hub.docker.com/_/dart
FROM dart:beta@sha256:b81805d66a633f8ee5bb20db229d7a680dd6ef16d1ef67fd74ca8a056f29a42f
FROM dart:beta@sha256:88ced76ff4a63e565872df26fe2442f060e3ecf828a272090ad10c79e9d044af

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion auto_submit/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
dev_dependencies:
build_runner: 2.4.6
json_serializable: 6.7.1
flutter_lints: 3.0.0
flutter_lints: 3.0.1
mockito: 5.4.2
test: 1.24.9

Expand Down
2 changes: 1 addition & 1 deletion cipd_packages/codesign/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
crypto: 3.0.3
fake_async: 1.3.1
file: 7.0.0
flutter_lints: 3.0.0
flutter_lints: 3.0.1
logging: 1.2.0
meta: 1.11.0
platform: 3.1.3
Expand Down
2 changes: 1 addition & 1 deletion dashboard/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (flutterVersionName == null) {
}

android {
namespace "com.example.dashboard"
namespace "com.appspot.flutter_dashboard.dashboard"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand Down
9 changes: 7 additions & 2 deletions dashboard/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="dashboard"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:banner="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:name="com.appspot.flutter_dashboard.dashboard.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.appspot.flutter_dashboard.dashboard

import android.os.Bundle
import android.view.WindowManager

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}

This file was deleted.

126 changes: 72 additions & 54 deletions dashboard/lib/build_dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dashboard/model/branch.pb.dart';
import 'package:provider/provider.dart';
import 'package:truncate/truncate.dart';
Expand Down Expand Up @@ -85,7 +86,7 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
/// Convert the fields from this class into a URL.
///
/// This enables bookmarking state specific values, like [repo].
void _updateNavigation(BuildContext context, BuildState buildState) {
void _updateNavigation(BuildContext context) {
final Map<String, String> queryParameters = <String, String>{};
if (widget.queryParameters != null) {
queryParameters.addAll(widget.queryParameters!);
Expand Down Expand Up @@ -158,7 +159,7 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
child: const Text('Defaults'),
),
TextButton(
onPressed: _filter == _settingsBasis ? null : () => _updateNavigation(context, buildState),
onPressed: _filter == _settingsBasis ? null : () => _updateNavigation(context),
child: const Text('Apply'),
),
TextButton(
Expand Down Expand Up @@ -210,7 +211,7 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
),
onChanged: (String? selectedRepo) {
repo = selectedRepo;
_updateNavigation(context, buildState);
_updateNavigation(context);
},
items: buildState.repos.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
Expand Down Expand Up @@ -252,7 +253,7 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
),
onChanged: (String? selectedBranch) {
branch = selectedBranch;
_updateNavigation(context, buildState);
_updateNavigation(context);
},
items: [
DropdownMenuItem<String>(
Expand Down Expand Up @@ -297,7 +298,7 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
crossAxisAlignment: WrapCrossAlignment.center,
children: <Widget>[
const SizedBox(width: 10.0),
SizedBox.fromSize(size: const Size.square(TaskBox.cellSize), child: box),
SizedBox.fromSize(size: Size.square(TaskBox.of(context)), child: box),
const SizedBox(width: 10.0),
Text(description),
],
Expand All @@ -322,8 +323,8 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
_getTaskKeyEntry(
box: Center(
child: Container(
width: TaskBox.cellSize * 0.8,
height: TaskBox.cellSize * 0.8,
width: TaskBox.of(context) * 0.8,
height: TaskBox.of(context) * 0.8,
decoration: BoxDecoration(
border: Border.all(
width: 2.0,
Expand Down Expand Up @@ -373,6 +374,12 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
}
}

void _updatePage(BuildContext context, String newRepo, String newBranch) {
repo = newRepo;
branch = newBranch;
_updateNavigation(context);
}

@override
Widget build(BuildContext context) {
final bool isDark = Theme.of(context).brightness == Brightness.dark;
Expand All @@ -392,57 +399,68 @@ class BuildDashboardPageState extends State<BuildDashboardPage> {
);
final BuildState buildState = Provider.of<BuildState>(context);
buildState.updateCurrentRepoBranch(repo!, branch!);
return AnimatedBuilder(
animation: buildState,
builder: (BuildContext context, Widget? child) => Scaffold(
appBar: CocoonAppBar(
title: Tooltip(
message: _getStatusTitle(buildState),
child: Text(
_getStatusTitle(buildState),
),
),
backgroundColor: colorTable[buildState.isTreeBuilding],
actions: <Widget>[
if (!_smallScreen) ..._buildRepositorySelectionWidgets(context, buildState),
IconButton(
tooltip: 'Report Issue',
icon: const Icon(Icons.bug_report),
onPressed: () async {
if (await canLaunchUrl(flutterIssueUrl)) {
await launchUrl(flutterIssueUrl);
} else {
throw 'Could not launch $flutterIssueUrl';
}
},
),
PopupMenuButton<String>(
tooltip: 'Task Status Key',
child: const Icon(Icons.info_outline),
itemBuilder: (BuildContext context) => _getTaskKey(isDark),
),
IconButton(
tooltip: 'Settings',
icon: const Icon(Icons.settings),
onPressed: _settingsBasis == null ? () => _showSettingsDialog() : null,
),
],
),
body: ErrorBrookWatcher(
errors: buildState.errors,
child: Stack(
children: <Widget>[
SizedBox.expand(
child: TaskGridContainer(
filter: _filter,
useAnimatedLoading: true,
return CallbackShortcuts(
bindings: <ShortcutActivator, VoidCallback>{
const SingleActivator(LogicalKeyboardKey.arrowUp): () => _updatePage(context, 'flutter', 'master'),
const SingleActivator(LogicalKeyboardKey.arrowDown): () => _updatePage(context, 'engine', 'main'),
const SingleActivator(LogicalKeyboardKey.arrowLeft): () => _updatePage(context, 'cocoon', 'main'),
const SingleActivator(LogicalKeyboardKey.arrowRight): () => _updatePage(context, 'packages', 'main'),
},
child: Focus(
autofocus: true,
child: AnimatedBuilder(
animation: buildState,
builder: (BuildContext context, Widget? child) => Scaffold(
appBar: CocoonAppBar(
title: Tooltip(
message: _getStatusTitle(buildState),
child: Text(
_getStatusTitle(buildState),
),
),
if (_settingsBasis != null) _settingsDialog(context, buildState),
],
backgroundColor: colorTable[buildState.isTreeBuilding],
actions: <Widget>[
if (!_smallScreen) ..._buildRepositorySelectionWidgets(context, buildState),
IconButton(
tooltip: 'Report Issue',
icon: const Icon(Icons.bug_report),
onPressed: () async {
if (await canLaunchUrl(flutterIssueUrl)) {
await launchUrl(flutterIssueUrl);
} else {
throw 'Could not launch $flutterIssueUrl';
}
},
),
PopupMenuButton<String>(
tooltip: 'Task Status Key',
child: const Icon(Icons.info_outline),
itemBuilder: (BuildContext context) => _getTaskKey(isDark),
),
IconButton(
tooltip: 'Settings',
icon: const Icon(Icons.settings),
onPressed: _settingsBasis == null ? () => _showSettingsDialog() : null,
),
],
),
body: ErrorBrookWatcher(
errors: buildState.errors,
child: Stack(
children: <Widget>[
SizedBox.expand(
child: TaskGridContainer(
filter: _filter,
useAnimatedLoading: true,
),
),
if (_settingsBasis != null) _settingsDialog(context, buildState),
],
),
),
drawer: const DashboardNavigationDrawer(),
),
),
drawer: const DashboardNavigationDrawer(),
),
);
}
Expand Down
5 changes: 5 additions & 0 deletions dashboard/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:io' if (kIsWeb) '';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';

import 'build_dashboard_page.dart';
import 'service/cocoon.dart';
Expand Down Expand Up @@ -63,6 +64,10 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Build Dashboard — Cocoon',
shortcuts: <ShortcutActivator, Intent>{
...WidgetsApp.defaultShortcuts,
const SingleActivator(LogicalKeyboardKey.select): const ActivateIntent(),
},
theme: ThemeData(
useMaterial3: false,
primaryTextTheme: const TextTheme(
Expand Down
4 changes: 2 additions & 2 deletions dashboard/lib/service/appengine_cocoon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'dart:convert';
import 'dart:io';

import 'package:fixnum/fixnum.dart';
import 'package:flutter/foundation.dart' show compute, kIsWeb, visibleForTesting;
import 'package:flutter/foundation.dart' show kIsWeb, visibleForTesting;
import 'package:flutter_dashboard/model/branch.pb.dart';
import 'package:http/http.dart' as http;

Expand Down Expand Up @@ -60,7 +60,7 @@ class AppEngineCocoonService implements CocoonService {
try {
final Map<String, dynamic> jsonResponse = jsonDecode(response.body);
return CocoonResponse<List<CommitStatus>>.data(
await compute<List<dynamic>, List<CommitStatus>>(_commitStatusesFromJson, jsonResponse['Statuses']),
_commitStatusesFromJson(jsonResponse['Statuses']),
);
} catch (error) {
return CocoonResponse<List<CommitStatus>>.error(error.toString());
Expand Down
7 changes: 3 additions & 4 deletions dashboard/lib/widgets/lattice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

import 'task_box.dart';

typedef Painter = void Function(Canvas canvas, Rect rect);

typedef LatticeTapCallback = void Function(Offset? offset);
Expand Down Expand Up @@ -46,7 +48,6 @@ class LatticeScrollView extends StatelessWidget {
this.verticalController,
this.dragStartBehavior = DragStartBehavior.start,
required this.cells,
required this.cellSize,
});

final ScrollPhysics? horizontalPhysics;
Expand All @@ -63,8 +64,6 @@ class LatticeScrollView extends StatelessWidget {

final List<List<LatticeCell>> cells;

final Size cellSize;

@override
Widget build(BuildContext context) {
final TextDirection textDirection = this.textDirection ?? Directionality.of(context);
Expand Down Expand Up @@ -96,7 +95,7 @@ class LatticeScrollView extends StatelessWidget {
horizontalOffset: horizontalOffset,
verticalOffset: verticalOffset,
cells: cells,
cellSize: cellSize,
cellSize: Size.square(TaskBox.of(context)),
),
),
),
Expand Down
Loading

0 comments on commit bda6333

Please sign in to comment.