Skip to content
Open
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
42 changes: 18 additions & 24 deletions engine/src/flutter/lib/ui/fixtures/ui_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,9 @@ external void validateConfiguration();
Future<void> encodeImageProducesExternalUint8List() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand Down Expand Up @@ -406,10 +405,9 @@ external void _validateNotNull(Object? object);
Future<void> toByteDataWithoutGPU() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand All @@ -432,10 +430,9 @@ Future<void> toByteDataWithoutGPU() async {
Future<void> toByteDataRetries() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand All @@ -456,10 +453,9 @@ Future<void> toByteDataRetries() async {
Future<void> toByteDataRetryOverflows() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand Down Expand Up @@ -496,10 +492,9 @@ Future<void> toByteDataRetryOverflows() async {
Future<void> toImageRetries() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand All @@ -519,10 +514,9 @@ Future<void> toImageRetries() async {
Future<void> toImageRetryOverflows() async {
final PictureRecorder pictureRecorder = PictureRecorder();
final Canvas canvas = Canvas(pictureRecorder);
final Paint paint =
Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Paint paint = Paint()
..color = Color.fromRGBO(255, 255, 255, 1.0)
..style = PaintingStyle.fill;
final Offset c = Offset(50.0, 50.0);
canvas.drawCircle(c, 25.0, paint);
final Picture picture = pictureRecorder.endRecording();
Expand Down
7 changes: 3 additions & 4 deletions engine/src/flutter/lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ List<DisplayFeature> _decodeDisplayFeatures({
bounds[rectOffset + 3] / devicePixelRatio,
),
type: DisplayFeatureType.values[type[i]],
state:
state[i] < DisplayFeatureState.values.length
? DisplayFeatureState.values[state[i]]
: DisplayFeatureState.unknown,
state: state[i] < DisplayFeatureState.values.length
? DisplayFeatureState.values[state[i]]
: DisplayFeatureState.unknown,
),
);
}
Expand Down
39 changes: 18 additions & 21 deletions engine/src/flutter/lib/ui/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -531,21 +531,19 @@ class PlatformDispatcher {
return PointerDataPacket(data: data);
}

static ChannelCallback _keyDataListener(KeyDataCallback onKeyData, Zone zone) => (
ByteData? packet,
PlatformMessageResponseCallback callback,
) {
_invoke1<KeyData>(
(KeyData keyData) {
final bool handled = onKeyData(keyData);
final Uint8List response = Uint8List(1);
response[0] = handled ? 1 : 0;
callback(response.buffer.asByteData());
},
zone,
_unpackKeyData(packet!),
);
};
static ChannelCallback _keyDataListener(KeyDataCallback onKeyData, Zone zone) =>
(ByteData? packet, PlatformMessageResponseCallback callback) {
_invoke1<KeyData>(
(KeyData keyData) {
final bool handled = onKeyData(keyData);
final Uint8List response = Uint8List(1);
response[0] = handled ? 1 : 0;
callback(response.buffer.asByteData());
},
zone,
_unpackKeyData(packet!),
);
};

/// A callback that is invoked when key data is available.
///
Expand Down Expand Up @@ -577,12 +575,11 @@ class PlatformDispatcher {

int offset = 0;
final int charDataSize = packet.getUint64(kStride * offset++, _kFakeHostEndian);
final String? character =
charDataSize == 0
? null
: utf8.decoder.convert(
packet.buffer.asUint8List(kStride * (offset + _kKeyDataFieldCount), charDataSize),
);
final String? character = charDataSize == 0
? null
: utf8.decoder.convert(
packet.buffer.asUint8List(kStride * (offset + _kKeyDataFieldCount), charDataSize),
);

final KeyData keyData = KeyData(
timeStamp: Duration(microseconds: packet.getUint64(kStride * offset++, _kFakeHostEndian)),
Expand Down
45 changes: 45 additions & 0 deletions examples/api_windowing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
/coverage/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions examples/api_windowing/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "9846826cc39313b1935d557a9787892fe0e51d37"
channel: "[user-branch]"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: android
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: ios
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: linux
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: macos
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: web
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37
- platform: windows
create_revision: 9846826cc39313b1935d557a9787892fe0e51d37
base_revision: 9846826cc39313b1935d557a9787892fe0e51d37

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions examples/api_windowing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# api_windowing

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
28 changes: 28 additions & 0 deletions examples/api_windowing/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
45 changes: 45 additions & 0 deletions examples/api_windowing/lib/material/tooltip/tooltip.0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

/// Flutter code sample for [Tooltip].
void main() {
final RegularWindowController controller = RegularWindowController(
contentSize: WindowSizing(preferredSize: Size(640, 480)),
);
runWidget(
RegularWindow(controller: controller, child: const TooltipExampleApp()),
);
}

class TooltipExampleApp extends StatelessWidget {
const TooltipExampleApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
tooltipTheme: const TooltipThemeData(preferBelow: false),
),
home: Scaffold(
appBar: AppBar(title: const Text('Tooltip Sample')),
body: const Center(child: TooltipSample()),
),
);
}
}

class TooltipSample extends StatelessWidget {
const TooltipSample({super.key});

@override
Widget build(BuildContext context) {
return const Tooltip(
message: 'I am a Tooltip',
child: Text('Hover over the text to show a tooltip.'),
);
}
}
7 changes: 7 additions & 0 deletions examples/api_windowing/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"
Loading
Loading