[shared_preferences] update for flutter 3.3.0 release (#53)
* Update for flutter 3.3.0 release Signed-off-by: Hidenori Matsubayashi <[email protected]>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021 Sony Corporation. All rights reserved.
|
||||
// Copyright 2022 Sony Corporation. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
@@ -14,18 +14,24 @@
|
||||
class FlutterEmbedderOptions {
|
||||
public:
|
||||
FlutterEmbedderOptions() {
|
||||
options_.AddString("bundle", "b", "Path to Flutter app bundle", "./",
|
||||
false);
|
||||
options_.AddString("bundle", "b", "Path to Flutter project bundle",
|
||||
"./bundle", true);
|
||||
options_.AddWithoutValue("no-cursor", "n", "No mouse cursor/pointer",
|
||||
false);
|
||||
options_.AddInt("rotation", "r",
|
||||
"Window rotation(degree) [0(default)|90|180|270]", 0,
|
||||
false);
|
||||
options_.AddDouble("force-scale-factor", "s",
|
||||
"Force a scale factor instead using default value", 1.0,
|
||||
false);
|
||||
#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
|
||||
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
|
||||
// no more options.
|
||||
#elif defined(FLUTTER_TARGET_BACKEND_X11)
|
||||
options_.AddWithoutValue("fullscreen", "f", "Always full-screen display",
|
||||
false);
|
||||
options_.AddInt("width", "w", "Flutter app window width", 1280, false);
|
||||
options_.AddInt("height", "h", "Flutter app window height", 720, false);
|
||||
options_.AddInt("width", "w", "Window width", 1280, false);
|
||||
options_.AddInt("height", "h", "Window height", 720, false);
|
||||
#else // FLUTTER_TARGET_BACKEND_WAYLAND
|
||||
options_.AddWithoutValue("onscreen-keyboard", "k",
|
||||
"Enable on-screen keyboard", false);
|
||||
@@ -33,8 +39,8 @@ class FlutterEmbedderOptions {
|
||||
"Enable window decorations", false);
|
||||
options_.AddWithoutValue("fullscreen", "f", "Always full-screen display",
|
||||
false);
|
||||
options_.AddInt("width", "w", "Flutter app window width", 1280, false);
|
||||
options_.AddInt("height", "h", "Flutter app window height", 720, false);
|
||||
options_.AddInt("width", "w", "Window width", 1280, false);
|
||||
options_.AddInt("height", "h", "Window height", 720, false);
|
||||
#endif
|
||||
}
|
||||
~FlutterEmbedderOptions() = default;
|
||||
@@ -48,6 +54,34 @@ class FlutterEmbedderOptions {
|
||||
|
||||
bundle_path_ = options_.GetValue<std::string>("bundle");
|
||||
use_mouse_cursor_ = !options_.Exist("no-cursor");
|
||||
if (options_.Exist("rotation")) {
|
||||
switch (options_.GetValue<int>("rotation")) {
|
||||
case 90:
|
||||
window_view_rotation_ =
|
||||
flutter::FlutterViewController::ViewRotation::kRotation_90;
|
||||
break;
|
||||
case 180:
|
||||
window_view_rotation_ =
|
||||
flutter::FlutterViewController::ViewRotation::kRotation_180;
|
||||
break;
|
||||
case 270:
|
||||
window_view_rotation_ =
|
||||
flutter::FlutterViewController::ViewRotation::kRotation_270;
|
||||
break;
|
||||
default:
|
||||
window_view_rotation_ =
|
||||
flutter::FlutterViewController::ViewRotation::kRotation_0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (options_.Exist("force-scale-factor")) {
|
||||
is_force_scale_factor_ = true;
|
||||
scale_factor_ = options_.GetValue<double>("force-scale-factor");
|
||||
} else {
|
||||
is_force_scale_factor_ = false;
|
||||
scale_factor_ = 1.0;
|
||||
}
|
||||
|
||||
#if defined(FLUTTER_TARGET_BACKEND_GBM) || \
|
||||
defined(FLUTTER_TARGET_BACKEND_EGLSTREAM)
|
||||
@@ -86,6 +120,11 @@ class FlutterEmbedderOptions {
|
||||
}
|
||||
int WindowWidth() const { return window_width_; }
|
||||
int WindowHeight() const { return window_height_; }
|
||||
flutter::FlutterViewController::ViewRotation WindowRotation() const {
|
||||
return window_view_rotation_;
|
||||
}
|
||||
bool IsForceScaleFactor() const { return is_force_scale_factor_; }
|
||||
double ScaleFactor() const { return scale_factor_; }
|
||||
|
||||
private:
|
||||
commandline::CommandOptions options_;
|
||||
@@ -98,6 +137,10 @@ class FlutterEmbedderOptions {
|
||||
flutter::FlutterViewController::ViewMode::kNormal;
|
||||
int window_width_ = 1280;
|
||||
int window_height_ = 720;
|
||||
flutter::FlutterViewController::ViewRotation window_view_rotation_ =
|
||||
flutter::FlutterViewController::ViewRotation::kRotation_0;
|
||||
bool is_force_scale_factor_;
|
||||
double scale_factor_;
|
||||
};
|
||||
|
||||
#endif // FLUTTER_EMBEDDER_OPTIONS_
|
||||
|
||||
Reference in New Issue
Block a user