mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 05:27:23 +00:00
quickjs msvc
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* @Author: ekibun
|
||||
* @Date: 2020-07-18 23:28:55
|
||||
* @LastEditors: ekibun
|
||||
* @LastEditTime: 2020-08-19 13:26:52
|
||||
* @LastEditTime: 2020-08-20 12:51:21
|
||||
*/
|
||||
import 'dart:typed_data';
|
||||
|
||||
@@ -44,17 +44,12 @@ class _TestPageState extends State<TestPage> {
|
||||
engine = FlutterJs();
|
||||
engine.setMethodHandler((String method, List arg) async {
|
||||
switch (method) {
|
||||
case "delay":
|
||||
await Future.delayed(Duration(milliseconds: arg[0]));
|
||||
return;
|
||||
case "http":
|
||||
Response response = await Dio()
|
||||
.get(arg[0], options: Options(responseType: ResponseType.bytes));
|
||||
return response.data;
|
||||
case "hello":
|
||||
return await arg[0](["hello: "]);
|
||||
case "test":
|
||||
return [
|
||||
return await arg[0]([
|
||||
true,
|
||||
1,
|
||||
0.5,
|
||||
@@ -64,7 +59,7 @@ class _TestPageState extends State<TestPage> {
|
||||
Int32List(2),
|
||||
Int64List(2),
|
||||
Float64List(2),
|
||||
Float32List(2)];
|
||||
Float32List(2)]);
|
||||
default:
|
||||
return JsMethodHandlerNotImplement();
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(runner LANGUAGES CXX)
|
||||
|
||||
set(BINARY_NAME "flutter_qjs_example")
|
||||
set(APPLICATION_ID "soko.ekibun.flutter_qjs")
|
||||
set(BINARY_NAME "example")
|
||||
set(APPLICATION_ID "soko.ekibun.example")
|
||||
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
|
||||
@@ -19,8 +19,7 @@ endif()
|
||||
# Compilation settings that should be applied to most targets.
|
||||
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
||||
# target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
||||
target_compile_options(${TARGET} PRIVATE -Wall)
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
||||
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
||||
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
|
||||
endfunction()
|
||||
|
@@ -24,6 +24,7 @@ find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
|
||||
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
|
||||
pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
|
||||
|
||||
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
|
||||
|
||||
@@ -65,6 +66,7 @@ target_link_libraries(flutter INTERFACE
|
||||
PkgConfig::GTK
|
||||
PkgConfig::GLIB
|
||||
PkgConfig::GIO
|
||||
PkgConfig::BLKID
|
||||
)
|
||||
add_dependencies(flutter flutter_assemble)
|
||||
|
||||
|
@@ -14,7 +14,7 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
||||
static void my_application_activate(GApplication* application) {
|
||||
GtkWindow* window =
|
||||
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
|
||||
gtk_window_set_title(window, "flutter_qjs_example");
|
||||
gtk_window_set_title(window, "example");
|
||||
gtk_window_set_default_size(window, 1280, 720);
|
||||
gtk_widget_show(GTK_WIDGET(window));
|
||||
|
||||
|
@@ -1,27 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility that Flutter provides. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:flutter_qjs_example/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(MyApp());
|
||||
|
||||
// Verify that platform version is retrieved.
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(Widget widget) => widget is Text &&
|
||||
widget.data.startsWith('Running on:'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user