12 constexpr
char kChannelName[] =
"flutter/platform_views";
13 constexpr
char kCreateMethod[] =
"create";
14 constexpr
char kFocusMethod[] =
"focus";
15 constexpr
char kViewTypeParameter[] =
"viewType";
16 constexpr
char kIdParameter[] =
"id";
17 constexpr
char kDirectionParameter[] =
"direction";
18 constexpr
char kFocusParameter[] =
"focus";
26 channel_->SetMethodCallHandler(
29 const auto& args = std::get<EncodableMap>(*call.
arguments());
31 const auto& type_itr = args.find(
EncodableValue(kViewTypeParameter));
33 if (type_itr == args.end()) {
34 result->Error(
"AddPlatformView",
"Parameter viewType is required");
37 if (id_itr == args.end()) {
38 result->Error(
"AddPlatformView",
"Parameter id is required");
41 const auto&
type = std::get<std::string>(type_itr->second);
42 const auto&
id = std::get<std::int32_t>(id_itr->second);
46 result->Error(
"AddPlatformView",
"Failed to add platform view");
51 const auto& direction_itr =
53 const auto& focus_itr = args.find(
EncodableValue(kFocusParameter));
54 if (id_itr == args.end()) {
55 result->Error(
"FocusPlatformView",
"Parameter id is required");
58 if (direction_itr == args.end()) {
59 result->Error(
"FocusPlatformView",
60 "Parameter direction is required");
63 if (focus_itr == args.end()) {
64 result->Error(
"FocusPlatformView",
"Parameter focus is required");
67 const auto&
id = std::get<std::int32_t>(id_itr->second);
68 const auto& direction = std::get<std::int32_t>(direction_itr->second);
69 const auto& focus = std::get<bool>(focus_itr->second);
74 result->Error(
"FocusPlatformView",
"Failed to focus platform view");
78 result->NotImplemented();