mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
_This PR is part of the multiview engine project. For a complete roadmap, see [this doc](https://docs.google.com/document/d/10APhzRDR7XqjWdbYWpFfKur7DPiz_HvSKNcLvcyA9vg/edit?resourcekey=0-DfGcg4-XWRMMZF__C1nmcA)._ ------ This PR adds view management to all engine classes that need it. View management here basically means `AddView` and `RemoveView` methods, and most importantly, how to handle the implicit view. The implicit view is a special view that's handled differently than all the other "regular views", since it keeps the behavior of the current single view of Flutter. Detailed introduction can be found in `Settings.implicit_view_enabled`. The following two graphs show the difference between initializing with/without the implicit view and creating regular views. <img width="879" alt="image" src="https://github.com/flutter/engine/assets/1596656/31244685-d9d3-4c9a-9a9e-6e8540a5711e"> <img width="864" alt="image" src="https://github.com/flutter/engine/assets/1596656/e2dd4b8c-57e3-428d-8547-834fb270052b"> <img width="860" alt="image" src="https://github.com/flutter/engine/assets/1596656/58dae687-8c17-434e-ae24-a48c2d8fa5fa"> [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// Copyright 2013 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.
|
|
|
|
#ifndef FLUTTER_RUNTIME_PLATFORM_DATA_H_
|
|
#define FLUTTER_RUNTIME_PLATFORM_DATA_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "flutter/lib/ui/window/viewport_metrics.h"
|
|
#include "flutter/shell/common/display.h"
|
|
|
|
namespace flutter {
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// The struct of platform-specific data used for initializing
|
|
/// ui.PlatformDispatcher.
|
|
///
|
|
/// The framework may request data from ui.PlatformDispatcher before the
|
|
/// platform is properly configured. When creating the Shell, the engine sets
|
|
/// this struct to default values until the platform is ready to send the real
|
|
/// data.
|
|
///
|
|
/// See also:
|
|
///
|
|
/// * flutter::Shell::Create, which takes a platform_data to initialize the
|
|
/// ui.PlatformDispatcher attached to it.
|
|
struct PlatformData {
|
|
PlatformData();
|
|
|
|
~PlatformData();
|
|
|
|
// A map from view IDs of existing views to their viewport metrics.
|
|
std::unordered_map<int64_t, ViewportMetrics> viewport_metrics_for_views;
|
|
|
|
std::string language_code;
|
|
std::string country_code;
|
|
std::string script_code;
|
|
std::string variant_code;
|
|
std::vector<std::string> locale_data;
|
|
std::string user_settings_data = "{}";
|
|
std::string lifecycle_state;
|
|
bool semantics_enabled = false;
|
|
bool assistive_technology_enabled = false;
|
|
int32_t accessibility_feature_flags_ = 0;
|
|
std::vector<DisplayData> displays;
|
|
};
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_RUNTIME_PLATFORM_DATA_H_
|