Data processing method and device, equipment and storage medium
By creating the placeholder base building blocks on the Flutter cross-platform side and creating platform views at the native layer, the interface splitting and resource consumption problems caused by native view integration in cross-platform applications are solved, and the display effect and performance are improved.
Patent Information
- Application Number
- CN202411188606.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
AI Technical Summary
When the existing technology integrates native views in cross-platform applications, it is easy to cause a sense of split content in the application interface window, affecting the display effect of user pages, and the resource consumption is large, the performance is poor, and the business needs cannot be met.
Create a placeholder basic building block on the Flutter cross-platform side through the Flutter framework, create a platform view at the native layer of the application according to the configuration data, and render it through the native engine, directly add the platform view to the main window of the application, reduce resource consumption and achieve Embed functionality of native components.
It improves the display effect of client pages and the quality of integrated native views, reduces resource consumption, avoids data replication between the native rendering engine and the graphics engine, and improves performance.
Smart Images

Figure CN119088386A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular, relates to a data processing method, device, equipment and storage medium. Background Art
[0002] Native View refers to the user interface (UI) control provided by the host operating system in cross-platform applications, such as the web view control (WKWebView) of the macos operating system and the map view control (MapView) of the Android operating system. Native views can usually be integrated through a cross-platform mobile application development framework (Flutter) to add new features or views to native applications.
[0003] In related technologies, native views can be integrated based on Flutter through independent windows and external textures. However, displaying multiple window contents in the aforementioned manner can easily cause a sense of fragmentation in the window contents displayed on the application interface, affecting the display effect of the user page. Summary of the invention
[0004] The embodiments of the present application provide a data processing method, apparatus, device and storage medium, which can solve the problem of poor user page display effect in the related art.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, which may include:
[0006] Obtaining a first instruction, where the first instruction is used to instruct to display a client page related to the application;
[0007] Based on the first instruction, a placeholder basic building block corresponding to the Flutter view is created on the Flutter cross-platform side through the Flutter framework, where the placeholder basic building block is used to describe configuration data of the user interface control of the client page;
[0008] Create a platform view in the native layer of the application according to the configuration data;
[0009] Embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain a second main window;
[0010] The second main window is rendered by the native engine of the application, and the client page is displayed in the user interface.
[0011] In a second aspect, an embodiment of the present application provides a data processing device, which may include:
[0012] An acquisition module, used for acquiring a first instruction, where the first instruction is used for instructing to display a client page related to the application;
[0013] A creation module is used to create a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework based on the first instruction, where the placeholder basic building block is used to describe configuration data of the user interface control of the client page;
[0014] The creation module is also used to create a platform view in the native layer of the application according to the configuration data;
[0015] An embedding module, used for embedding a platform view instance of the platform view in a window layout of a first main window of an application to obtain a second main window;
[0016] The rendering module is used to render the second main window through the native engine of the application and display the client page in the user interface.
[0017] In a third aspect, an embodiment of the present application provides a computer device, the computer device comprising: a processor and a memory storing computer program instructions;
[0018] When the processor executes the computer program instructions, the data processing method shown in the first aspect is implemented.
[0019] In a fourth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the data processing method shown in the first aspect is implemented.
[0020] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the data processing method shown in the first aspect.
[0021] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the data processing method shown in the first aspect.
[0022] The data processing method, device, equipment and storage medium of the embodiment of the present application can create a placeholder basic building block corresponding to the Flutter view and used to describe the configuration data of the user interface control of the client page on the Flutter cross-platform side through the Flutter framework according to the first instruction for indicating the display of the client page related to the application; and create a platform view in the native layer of the application according to the configuration data; embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain the second main window; then, render the second main window through the native engine of the application to display the client page in the user interface. In this way, after the platform view is created, it can be directly added to the first main window of the application, which can not only realize the embedding of the content of the Flutter view into the main window of the application, but also realize the embedding function of the native component with extremely low resource consumption, reduce the resource consumption of the integrated native view, and, by rendering the second main window including the content of the Flutter view through the native engine of the application, it can realize the rendering of the native component content embedded between the Flutter basic building blocks, improve the display effect of the client page, and thus improve the quality of the integrated native view. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0024] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0025] Figure 2 A schematic diagram of a flow chart of displaying a client page of a data processing method provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of a data interaction flow of a data processing method provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of a flow chart of rendering a second main window of a data processing method provided in an embodiment of the present application;
[0028] Figure 5 A flowchart of identity authentication processing of a data processing method provided in an embodiment of the present application;
[0029] Figure 6 A schematic flow chart of general operations of an editing component of a data processing method provided in an embodiment of the present application;
[0030] Figure 7 is a structural schematic diagram of a data processing device provided by an embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0032] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0033] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0034] The acquisition, storage, use, and processing of data (including but not limited to the features and information in the text) in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0035] In the related technology, Flutter is an open source cross-platform UI development framework that is developed using the Dart language, supports desktop and client operating systems, uses the Skia graphics engine for rendering, and provides a platform channel (PlatformChannel) for data communication between Flutter and the native layer of the application.
[0036] The mobile framework layer (Flutter Framework) provides a rich library of UI components, but does not directly provide very mature and complex components on the native layer, such as WebView and MapView. Although Flutter's rendering mechanism can ensure the consistency of drawing effects of cross-platform applications on different operating systems, it also leads to the natural isolation of Flutter from native views, which is not conducive to deep integration with local controls.
[0037] Applications usually integrate a large number of third-party services, which are implemented using Internet technologies such as hypertext markup language (html5, H5) and lightweight interpreted programming languages (JavaScript, JS). Some applications such as workbench, mailbox, and schedule need to be displayed inside the main window after clicking a tab. In the process of developing the desktop application, it was found that the Flutter UI library did not provide a WebView component, so it could only be implemented using native views. However, the existing solutions for integrating native views cannot meet business needs, as shown below.
[0038] In the related art, native views can be integrated based on Flutter through independent window mode and external texture mode. Among them, the independent window mode is to use native code to implement an independent window in the native layer of the application, establish a native view UI layout in the window, handle gestures, mouse, keyboard and other events, and transfer data between Flutter and the native side through the platform channel. The third-party plug-ins mentioned above, such as desktop_webview_window, adopt the independent window solution. The external texture mode is to establish a native view instance in the native layer of the application, create a UI layout of the native view and establish an external texture for the instance, and continuously copy the data on the graphics processor (Graphic Processing Unit, GPU) where the platform view is located to the skia engine at a rate of at least 30 frames. The texture data flow of the entire process is GPU-central processing unit (central processing unit, CPU)-GPU; at the same time, an event recognition mechanism needs to be established on the Flutter side to recognize gestures, keyboards, mice and other events, and pass relevant information such as event names and coordinates to the native layer of the application, and call the application programming interface (Application Programming Interface, API) of the native view to achieve the corresponding event effect.
[0039] However, the independent window method cannot embed the platform view into the main window of the Flutter application, which makes the entire application feel fragmented and the quality of the integrated native view is low; realizing a complete independent window UI on multiple terminals requires high native development capabilities, and requires understanding the menu bar, title bar, UI layout, etc. of each operating system, which has a high learning cost. The texture data involved in the external texture method is constantly copied from the native rendering engine to Skia, which consumes a lot of CPU / GPU performance, and machines with poor performance will have a distorted screen; all event detection and recognition need to be developed and implemented on the Flutter side, which requires a lot of development work, and the recognition accuracy cannot be compared with the direct use of native views; the API capabilities provided by native components are not perfect, and some events cannot be implemented by calling native view methods. For example, WebView loads an H5 page with an internal scroll bar, and the scroll method can only scroll the scroll bar of the native control, but not the scroll bar of the H5 page.
[0040] In this way, the aforementioned method of integrating native views will not only increase resource consumption, but also reduce the quality of integrated native views and affect the performance of the application.
[0041] In order to solve the above technical problems, the embodiments of the present application provide a data processing system, method, apparatus, computer device and storage medium.
[0042] Based on this, the following will combine the attached Figures 1 to 8 , describes in detail the data processing system, method, apparatus, computer equipment and storage medium of the embodiments of the present application. It should be noted that these embodiments are not intended to limit the scope of the disclosure of the present application.
[0043] Based on this, in order to better illustrate the contents of the embodiments of the present application, the following are respectively combined with Figures 1 to 8 A data processing method provided in an embodiment of the present application is described as follows.
[0044] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application.
[0045] like Figure 1 As shown, the data processing method can be applied to electronic devices. The data processing method can utilize the main window created by the native layer of the application to realize the embedded function of the native component with extremely low resource consumption. By only transferring data and not exchanging UI, the platform view is directly added to the main window of the application after it is created. The native engine is directly used to render the platform view. The GPU data do not affect each other, and embedding is realized without copying data in different rendering engines. Efficient rendering can be achieved with low resource consumption, thereby improving the display effect of the client page.
[0046] Based on this, the data processing method may specifically include the following steps:
[0047] Step 110, obtain a first instruction, the first instruction is used to instruct to display a client page related to the application; step 120, based on the first instruction, create a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework, the placeholder basic building block is used to describe the configuration data of the user interface control of the client page; step 130, according to the configuration data, create a platform view in the native layer of the application; step 140, embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain a second main window; step 150, render the second main window through the native engine of the application, and display the client page in the user interface.
[0048] In this way, after creating the platform view, it can be directly added to the first main window of the application, which can embed the content of the Flutter view into the main window of the application without copying data from the native rendering engine to the graphics engine. The embedding function of the native component is realized with extremely low resource consumption, reducing the resource consumption of the integrated native view. In addition, the second main window including the content of the Flutter view is rendered by the native engine of the application, which can realize the rendering of the native component content embedded between the basic building blocks of Flutter, improve the user interface display effect, and thus improve the quality of the integrated native view.
[0049] The above steps are described in detail below, as shown below.
[0050] First, regarding step 110 , in some embodiments of the present application, before step 110 , the data processing method may further include steps 1601 and 1602 .
[0051] Step 1601: Display a first interface of the application, where the first interface includes a Flutter view component on the Flutter cross-platform side, and an instance of the Flutter view component is in a first main window of the application.
[0052] Step 1602, receiving a first input to the Flutter view component.
[0053] Based on this, step 110 may specifically include:
[0054] In response to a first input, a first instruction is generated.
[0055] In some other embodiments of the present application, before step 110 , the data processing method may further include step 1701 and step 1702 .
[0056] Step 1701, when the application is started, create an initial window in the native layer of the application through the Flutter framework.
[0057] Step 1702: When the layout mode of the initial window is a box layout mode, the layout mode of the initial window is changed from the box layout mode to the stack layout mode to obtain a first main window.
[0058] For example, after the application is started, the main window and FlutterView are automatically created, and the view is added to the main window layout. When the Flutter event loop triggers the loading of the native view, the process of this proposal starts. Here, we take the creation of the WebView component as an example. Figure 2 As shown in the figure, after the application is started, the main window and FlutterView are automatically created, and FlutterView is added to the layout of the main window. In the native layer code of the default application generated by Flutter, the initial window, that is, the Linux window, uses a box layout. The subcomponents of this layout can only be arranged from left to right, which does not meet the requirements. Therefore, the Linux box layout needs to be modified to a stack layout.
[0059] In some other embodiments of the present application, before step 110 , the data processing method may further include step 1801 and step 1802 .
[0060] Step 1801, when the application is started, create a Flutter view component on the Flutter cross-platform side through the Flutter framework.
[0061] Step 1802, embed an instance of the Flutter view component in the window layout of the first main window.
[0062] Secondly, regarding step 120, in some embodiments of the present application, the configuration data includes display coordinate data of the client page in the user interface, access location data of the content displayed in the client page, and data volume of the displayed content. Based on this, step 120 may specifically include step 1201 and step 1202.
[0063] Step 1201: Based on the first instruction, an initial placeholder basic building block corresponding to the Flutter view is created on the Flutter cross-platform side through the Flutter framework.
[0064] Step 1202: Initialize the initial placeholder basic building block based on the configuration data to obtain a placeholder basic building block.
[0065] For example, Figure 2As shown, when it is necessary to display a client page such as an h5 front-end page, the process of triggering the creation and display of a native component instance can specifically include the initState algorithm, which is an algorithm that is executed only once when each Flutter basic building block (Widget) is created. This algorithm is rewritten to obtain the coordinate data of the placeholder Widget, the amount of data of the displayed content, and the access location data of the displayed content in the client page, such as the loaded uniform resource locator (uniform resource location, url), userAgent and other information; use channel to send this information to the platform side, and each platform uses its own native code to create a webview instance of the corresponding coordinates and size, set parameters such as userAgent, and load the corresponding url; after the instance is created, the WebView instance is added to the main window.
[0066] Next, step 130 is involved. In some embodiments of the present application, the configuration data includes display coordinate data of the client page in the user interface, access location data of the content displayed in the client page, and the data volume of the displayed content. Based on this, before step 130, the data processing method may also include step 190, transmitting the target data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application, and the target data includes the configuration data.
[0067] Based on this, step 130 may specifically include:
[0068] Create a platform view in the native layer of the application through the native code of the application according to the configuration data.
[0069] In some other embodiments of the present application, before step 190, the data processing method may further include step 210, obtaining the data volume of the configuration data.
[0070] Based on this, the above step 190 may specifically include:
[0071] When the amount of configuration data is less than the preset amount of data, the configuration data is transmitted to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application.
[0072] In addition, in some other embodiments of the present application, the target data includes storage location identification data. Based on this, after step 210, the data processing method may further include steps 2201 to 2203.
[0073] Step 2201: When the amount of configuration data is greater than or equal to the preset amount of data, the configuration data is stored in a shared space between the Flutter cross-platform side and the native layer of the application, and storage location identification data is generated.
[0074] Step 2202: Transmit the storage location identification data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application.
[0075] Step 2203: extract configuration data from the shared space according to the storage location identification data through the application layer of the application.
[0076] For example, Figure 3 As shown in the figure, when the content to be transmitted is small and simple, the platform channel is used directly; when the content to be transmitted is large and complex, the transmitted data is stored in the shared space, and the location information is transmitted to the other side through the platform channel. After the other side receives the location information, it goes to the shared space to retrieve the data. By using the shared space, the memory usage and transmission delay when the platform channel transmits large data can be effectively reduced, and data exchange can be realized quickly, avoiding jamming and improving application performance.
[0077] It should be noted that Figure 3 The process shown in only depicts the case of transmitting data from the Flutter side to the platform side. Transmission from the platform side to the Flutter side is also applicable.
[0078] Therefore, by designing a shared space mechanism, the data transmission delay and memory usage are reduced. The embodiment of the present application optimizes the mechanism for transmitting data on the Flutter side and the platform side. When the transmitted data is large and complex, the shared space is used to store the data. When the transmitted data is large and complex, it is directly stored in the shared space, and the address of the data in the shared space is transmitted to the other side. After the other side receives it, it uses the address to retrieve the data from the shared space. In this way, the memory usage and transmission delay are effectively reduced.
[0079] In some embodiments of the present application, after step 130 , the data processing method may further include steps 2301 to 2303 .
[0080] Step 2301: Based on the platform view, generate a platform view identifier corresponding to the platform view.
[0081] Step 2302: Transmit the platform view identifier to the placeholder basic building block through the platform channel between the Flutter cross-platform side and the native layer of the application.
[0082] Step 2303, associate the placeholder basic building block with the platform view identifier to obtain association information, where the association information is used to delete the placeholder basic building block indicated in the second instruction and the platform view identifier associated with the placeholder basic building block according to the association information when the second instruction is obtained. The second instruction is used to instruct the deletion of the placeholder basic building block on the Flutter cross-platform side.
[0083] For example, we can still refer to Figure 2 After the instance is created, the WebView instance is added to the main window; a unique ID is created, and the ID and WebView are recorded in the platform memory using a dictionary, and the ID is returned to the Flutter side; after receiving the ID, the Flutter side also uses a dictionary to record the ID and the placeholder widget. Later, the ID can be used as a bridge to make the placeholder widget on the Flutter side correspond to the WebView on the platform side.
[0084] Then, step 150 is involved. In some embodiments of the present application, the Flutter cross-platform side includes a Flutter cross-platform page; step 150 may specifically include steps 1501 to 1504.
[0085] Step 1501: When the configuration data described by the placeholder basic building block indicates that the Flutter cross-platform page obscures the native view of the application in the user interface, a screenshot of the native component in the user interface is obtained through the native layer of the application.
[0086] Step 1502: Hide the native component corresponding to the native layer in the user interface.
[0087] Step 1503, overlay the layer of the platform view on the layer where the screenshot is located to obtain the Flutter cross-platform page.
[0088] Step 1504, display the client page in the user interface.
[0089] For example, the native component content is embedded and rendered between two Flutter widgets, such as Figure 4 As shown, the native view and FlutterView are at the same level. Normally, they can only be displayed above all Flutter widget layers. If there is content in the widget within the display range of the native view, it will be covered and cannot be displayed. The method of this proposal can visually display the content of the native view between two widgets. When the placeholder widget detects occlusion, it triggers the getImageData method. This function calls the method of the native layer of the application to obtain the screenshot data of the component, and displays the obtained screenshot data in the ImageWidget. After 200 milliseconds, the native layer of the application is notified to hide the native component. The reason for delaying the hiding is to ensure that the screenshot view has been displayed on the user interface to prevent the flickering effect caused by the visual disappearance and subsequent reappearance of the content of the native view; after the occlusion disappears, the platform view is redisplayed and the data of the Image Widget is cleared.
[0090] In this way, the screenshot data of the native component and the display and hiding methods of the native view can be fully utilized to realize the function of rendering the content of the native component between two Flutter Widgets. The native component and FlutterView are at the same level in the native layer UI layout of the application, so the various widgets rendered in FlutterView can only appear as a whole on the user interface, and the native components are located above FlutterView when displayed. The widget content displayed within the range of the native component will be obscured. In this way, the embodiment of the present application provides a solution. When it is detected that a FlutterWidget needs to be displayed above the native view, the message is notified to the platform side through the Channel. The platform side will transmit the currently displayed UI screenshot back to the Flutter side. The Flutter side uses the Image Widget to display the screenshot data, and then notifies the platform side to hide the component; after the obstruction disappears, the platform side is notified to display the platform view.
[0091] In addition, after step 150 , the data processing method may further include steps 2401 to 2405 .
[0092] Step 2401, receiving a second input from the user to the client page, where the second input is used for identity authentication of the client page.
[0093] Step 2402, in response to the second input, transmit the business data corresponding to the identity authentication of the client page to the Flutter cross-platform side through the platform channel between the Flutter cross-platform side and the native layer of the application.
[0094] Step 2403: Based on the business data, business logic processing is performed through the placeholder basic building blocks on the Flutter cross-platform side to obtain an identity authentication processing result.
[0095] Step 2404, transmit the identity authentication processing result to the application layer of the application through the platform channel.
[0096] Step 2405: Display the content corresponding to the identity authentication processing result through the application layer of the application.
[0097] For example, Figure 5 As shown in the figure, the main logic of cross-platform applications is on the Flutter side, and the logic on the native side should be as simple as possible. When the events of the native view require application-related data for logical processing, such as the h5 page requires identity authentication, the following is triggered Figure 5The process shown in the figure. That is, the WebView component implements nativeCallJs on the platform side and registers the jsCallNative method for the h5 page to call. When the h5 page calls the registered method, the jsCallNative method sends the relevant parameters to the flutter side through the channel for logical processing. The processed results are returned to the platform side by calling the nativeCallJs method through the channel. The WebView component instance finally returns the results to the front-end page by executing the js method.
[0098] In addition, the data processing method provided in the embodiment of the present application may also include common operations of all components such as displaying, hiding, removing native components, and changing the size. Figure 6 As shown in the figure, the dispose and didChangeMetrics methods are methods of the Flutter Widget base class, representing the destruction of components and the changes in coordinates and size. These two methods can be directly rewritten, and the corresponding methods of WebView, removeNativeView and changeFrame, can be called in the implementation; Flutter does not provide a callback method for displaying or hiding components. For content that needs to reside in memory but is not displayed, it is necessary to develop and implement this callback method, such as calling the corresponding methods of Webview, showNativeView and HiddenNativeView, in the implementation of appear and disappear by clicking on the tab, push and pop of the navigation bar, etc. In addition to the methods that all native Views need to implement, such as display, hide, remove, and size change, it is also necessary to implement the forward, backward, reload, clear cache, clear cookies, and execute js functions of WebView. Implement the corresponding event method in the placeholder widget class, and use the channel to call the corresponding API of the platform-side webview instance.
[0099] The present application also provides a data processing device, specifically in combination with Figure 7 Provide detailed explanation.
[0100] Figure 7 It is a structural diagram of a data processing device provided by an embodiment of the present application.
[0101] In some embodiments of the present application, Figure 7 The data processing device shown can be set in the computing device provided in the embodiment of the present application.
[0102] like Figure 7 As shown, the data processing device 70 may specifically include:
[0103] An acquisition module 701 is used to acquire a first instruction, where the first instruction is used to instruct to display a client page related to the application;
[0104] A creation module 702 is used to create a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework based on the first instruction, where the placeholder basic building block is used to describe configuration data of the user interface control of the client page;
[0105] The creation module 702 is also used to create a platform view in the native layer of the application according to the configuration data;
[0106] An embedding module 703, configured to embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain a second main window;
[0107] The rendering module 704 is used to render the second main window through the native engine of the application and display the client page in the user interface.
[0108] The data processing device 70 in the embodiment of the present application is described in detail below.
[0109] In some embodiments of the present application, the data processing device 70 may further include a processing module; wherein:
[0110] A creation module 702 is used to create an initial placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework based on the first instruction when the configuration data includes display coordinate data of the client page in the user interface, access location data of the displayed content in the client page, and data volume of the displayed content;
[0111] The processing module is used to perform initialization processing on the initial placeholder basic building block based on the configuration data to obtain the placeholder basic building block.
[0112] In some embodiments of the present application, the data processing device 70 may further include a transmission module; wherein,
[0113] A transmission module, for transmitting target data to the native layer of the application through a platform channel between the Flutter cross-platform side and the native layer of the application, when the configuration data includes display coordinate data of the client page in the user interface, access location data of the content displayed in the client page, and data volume of the displayed content, the target data including the configuration data;
[0114] The creation module 702 is used to create a platform view in the native layer of the application according to the configuration data through the native code of the application.
[0115] In some embodiments of the present application, the data processing device 70 may further include a transmission module; wherein,
[0116] The acquisition module 701 may also be used to acquire the data volume of the configuration data;
[0117] The transmission module is used to transmit the configuration data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application when the data volume of the configuration data is less than the preset data volume.
[0118] In some embodiments of the present application, the data processing device 70 may further include a processing module, a transmission module and an extraction module; wherein:
[0119] A processing module, configured to store the configuration data in a shared space between the Flutter cross-platform side and the native layer of the application, and generate storage location identification data when the target data includes storage location identification data and the data volume of the configuration data is greater than or equal to the preset data volume;
[0120] The transmission module is used to transmit the storage location identification data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application;
[0121] The extraction module is used to extract the configuration data from the shared space according to the storage location identification data through the application layer of the application.
[0122] In some embodiments of the present application, the Flutter cross-platform side includes a Flutter cross-platform page; the data processing device 70 may also include a processing module, an overlay module, and a display module; wherein,
[0123] The acquisition module 701 may also be used to acquire a screenshot of a native component in the user interface through the native layer of the application when the configuration data described by the placeholder basic building block indicates that the Flutter cross-platform page obscures the native view of the application in the user interface;
[0124] A processing module, used for hiding the native components corresponding to the native layer in the user interface;
[0125] The overlay module is used to overlay the layer of the platform view on the layer where the screenshot is located to obtain the Flutter cross-platform page;
[0126] Display module, used to display Flutter cross-platform pages in the user interface.
[0127] In some embodiments of the present application, the data processing device 70 may further include a display module, a receiving module and a generating module; wherein,
[0128] A display module is used to display a first interface of the application, where the first interface includes a Flutter view component on the Flutter cross-platform side, and an instance of the Flutter view component is in a first main window of the application;
[0129] A receiving module, configured to receive a first input to a Flutter view component;
[0130] The generating module is used to generate a first instruction in response to a first input.
[0131] In some embodiments of the present application, the data processing device 70 may further include a modification module; wherein,
[0132] A creation module 702 is used to create an initial window in the native layer of the application through the Flutter framework when the application is started;
[0133] The modification module is used to modify the layout mode of the initial window from the box layout mode to the stack layout mode when the layout mode of the initial window is the box layout mode, so as to obtain the first main window.
[0134] In some embodiments of the present application, the data processing device 70 may further include an embedded module; wherein,
[0135] A creation module 702 is used to create a Flutter view component on the Flutter cross-platform side through the Flutter framework when the application is started;
[0136] The embedding module is used to embed an instance of the Flutter view component in the window layout of the first main window.
[0137] In some embodiments of the present application, the data processing device 70 may further include a generation module, a transmission module and an association module; wherein,
[0138] A generating module, used for generating a platform view identifier corresponding to the platform view based on the platform view;
[0139] The transmission module is used to transmit the platform view identifier to the placeholder basic building block through the platform channel between the Flutter cross-platform side and the native layer of the application;
[0140] An association module is used to associate a placeholder basic building block with a platform view identifier to obtain association information, where the association information is used to delete the placeholder basic building block indicated in the second instruction and the platform view identifier associated with the placeholder basic building block according to the association information when a second instruction is obtained, and the second instruction is used to instruct the deletion of the placeholder basic building block on the Flutter cross-platform side.
[0141] In some embodiments of the present application, the data processing device 70 may further include a receiving module, a transmission module, a processing module and a display module; wherein,
[0142] A receiving module, used for receiving a second input of a user to a client page, the second input being used for identity authentication of the client page;
[0143] A transmission module, configured to transmit, in response to the second input, business data corresponding to the identity authentication of the client page to the Flutter cross-platform side through a platform channel between the Flutter cross-platform side and the native layer of the application;
[0144] The processing module is used to perform business logic processing based on business data through the placeholder basic building blocks on the Flutter cross-platform side to obtain the identity authentication processing result;
[0145] The transmission module can also be used to transmit the identity authentication processing results to the application layer of the application through the platform channel;
[0146] The display module is used to display the content corresponding to the identity authentication processing result through the application layer of the application.
[0147] Therefore, the data processing device of the embodiment of the present application can create a placeholder basic building block corresponding to the Flutter view and used to describe the configuration data of the user interface control of the client page on the Flutter cross-platform side through the Flutter framework according to the first instruction for indicating the display of the client page related to the application; and create a platform view in the native layer of the application according to the configuration data; embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain the second main window; then, render the second main window through the native engine of the application to display the client page in the user interface. In this way, after the platform view is created, it can be directly added to the first main window of the application, which can not only realize the embedding of the content of the Flutter view into the main window of the application, but also realize the embedding function of the native component with extremely low resource consumption, reduce the resource consumption of the integrated native view, and, by rendering the second main window including the content of the Flutter view through the native engine of the application, it can realize the rendering of the native component content embedded between the Flutter basic building blocks, improve the user interface display effect, and thus improve the quality of the integrated native view.
[0148] Based on the same inventive concept, the present application also provides a computer device. Figure 8 Provide detailed explanation.
[0149] Figure 8 It is a schematic diagram of the structure of a computer device provided by an embodiment of the present application.
[0150] like Figure 8 As shown, the computer device may include at least one of the following involved in the embodiments of the present application: an electronic device, a server. The computer device may include a processor 801 and a memory 802 storing computer program instructions.
[0151] Specifically, the processor 801 may include a central processing unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit (ASTC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0152] The memory 802 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 802 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 802 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 802 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 802 is a non-volatile solid-state memory. In a specific embodiment, the memory 802 includes a solid-state storage (ROM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0153] The processor 801 implements any one of the data processing methods in the above embodiments by reading and executing computer program instructions stored in the memory 802 .
[0154] In one example, the computer device may further include a communication interface 803 and a bus 810. Figure 8 As shown, the processor 801, the memory 802, and the communication interface 803 are connected via a bus 810 and communicate with each other.
[0155] The communication interface 803 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0156] Bus 810 includes hardware, software or both, and the parts of flow control device are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard system (ETSA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard system (TSA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel system (MCA) bus, peripheral component interconnection (PCT) bus, PCT-Express (PCT-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 810 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0157] The data processing device can execute the data processing method in the embodiment of the present application, thereby realizing the combination Figures 1 to 8 The data processing method and device described.
[0158] In addition, in combination with the data processing method in the above embodiments, the present application embodiment can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the data processing methods in the above embodiments is implemented.
[0159] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0160] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0161] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0162] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A data processing method, comprising: Obtaining a first instruction, where the first instruction is used to instruct to display a client page related to the application; Based on the first instruction, create a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework, where the placeholder basic building block is used to describe configuration data of the user interface control of the client page; Creating a platform view in the native layer of the application according to the configuration data; Embedding the platform view instance of the platform view in the window layout of the first main window of the application to obtain a second main window; The second main window is rendered by a native engine of the application, and the client page is displayed in a user interface.
2. The method according to claim 1, wherein: The configuration data includes display coordinate data of the client page in the user interface, access location data of the content displayed in the client page, and data volume of the displayed content; The step of creating a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework based on the first instruction includes: Based on the first instruction, an initial placeholder basic building block corresponding to the Flutter view is created on the Flutter cross-platform side through the Flutter framework; Based on the configuration data, the initial placeholder basic building block is initialized to obtain the placeholder basic building block.
3. The method according to claim 1, wherein: The configuration data includes display coordinate data of the client page in the user interface, access location data of the content displayed in the client page, and data volume of the displayed content; According to the configuration data, before creating a platform view in the native layer of the application, the method further includes: Transmitting target data to the native layer of the application through a platform channel between the Flutter cross-platform side and the native layer of the application, the target data including the configuration data; The creating a platform view in the native layer of the application according to the configuration data includes: A platform view is created in the native layer of the application according to the configuration data through the native code of the application.
4. The method according to claim 3, wherein: Before transmitting the target data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application, the method further includes: Acquire the data volume of the configuration data; The transmitting the target data to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application includes: When the data amount of the configuration data is less than the preset data amount, the configuration data is transmitted to the native layer of the application through the platform channel between the Flutter cross-platform side and the native layer of the application.
5. The method according to claim 4, wherein: The target data includes storage location identification data; the method further includes: When the data amount of the configuration data is greater than or equal to the preset data amount, the configuration data is stored in a shared space between the Flutter cross-platform side and the native layer of the application, and storage location identification data is generated; Transmitting the storage location identification data to the native layer of the application through a platform channel between the Flutter cross-platform side and the native layer of the application; The configuration data is extracted from the shared space according to the storage location identification data through the application layer of the application.
6. The method according to claim 1, wherein: The Flutter cross-platform side includes a Flutter cross-platform page; the rendering of the second main window by the native engine of the application and displaying the client page in the user interface includes: When the configuration data described in the placeholder basic building block indicates that the Flutter cross-platform page blocks the native view of the application in the user interface, obtaining a screenshot of the native component in the user interface through the native layer of the application; Hiding the native component corresponding to the native layer in the user interface; Overlaying the layer of the platform view on the layer where the screenshot is located to obtain the Flutter cross-platform page; The Flutter cross-platform page is displayed in the user interface.
7. The method according to claim 1, wherein: Before obtaining the first instruction, the method further includes: Displaying a first interface of the application, wherein the first interface includes a Flutter view component on the Flutter cross-platform side, and an instance of the Flutter view component is in a first main window of the application; Receiving a first input to the Flutter view component; The obtaining of the first instruction comprises: In response to the first input, the first instruction is generated.
8. The method according to claim 7, wherein: Before obtaining the first instruction, the method further includes: When the application is started, creating an initial window in the native layer of the application through the Flutter framework; In the case that the layout mode of the initial window is a box layout mode, the layout mode of the initial window is modified from the box layout mode to a stack layout mode to obtain the first main window.
9. The method according to claim 7 or 8, wherein: The method further comprises: When the application is started, creating the Flutter view component on the Flutter cross-platform side through the Flutter framework; An instance of the Flutter view component is embedded in the window layout of the first main window.
10. The method according to claim 1, wherein: After creating a platform view in the native layer of the application according to the configuration data, the method further includes: Based on the platform view, generating a platform view identifier corresponding to the platform view; Transmitting the platform view identifier to the placeholder basic building block through a platform channel between the Flutter cross-platform side and the native layer of the application; The placeholder basic building block is associated with the platform view identifier to obtain association information, where the association information is used to delete the placeholder basic building block indicated in the second instruction and the platform view identifier associated with the placeholder basic building block according to the association information when the second instruction is obtained, and the second instruction is used to instruct deletion of the placeholder basic building block on the Flutter cross-platform side.
11. The method according to claim 1, wherein: The method further comprises: receiving a second input from a user on the client page, where the second input is used for identity authentication of the client page; In response to the second input, transmitting business data corresponding to the identity authentication of the client page to the Flutter cross-platform side through a platform channel between the Flutter cross-platform side and the native layer of the application; Based on the business data, business logic processing is performed through the placeholder basic building blocks on the Flutter cross-platform side to obtain an identity authentication processing result; Transmitting the identity authentication processing result to the application layer of the application through the platform channel; The content corresponding to the identity authentication processing result is displayed through the application layer of the application.
12. A data processing device, comprising: An acquisition module, used for acquiring a first instruction, where the first instruction is used for instructing to display a client page related to the application; A creation module, configured to create, based on the first instruction, a placeholder basic building block corresponding to the Flutter view on the Flutter cross-platform side through the Flutter framework, wherein the placeholder basic building block is used to describe configuration data of the user interface control of the client page; The creation module is further used to create a platform view in the native layer of the application according to the configuration data; an embedding module, configured to embed the platform view instance of the platform view in the window layout of the first main window of the application to obtain a second main window; A rendering module is used to render the second main window through a native engine of the application and display the client page in a user interface.
13. A computer device, the device comprising: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the data processing method according to any one of claims 1 to 11 is implemented.
14. A storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the data processing method according to any one of claims 1 to 11.
Citation Information
Cited By
Data processing method and apparatus, and device and storage medium
WO2026045049A1
