Skip to content

Commit

Permalink
Webview 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
sukso96100 committed Jun 16, 2024
1 parent fce271b commit 1e6f04f
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 31 deletions.
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'checkInByEmailScreen.dart';
Expand Down
76 changes: 76 additions & 0 deletions lib/webviewScreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
import "package:webview_universal/webview_universal.dart";

class webviewScreen extends StatefulWidget {
const webviewScreen({Key? key}) : super(key: key);
@override
_webviewScreenState createState() => _webviewScreenState();
}

class _webviewScreenState extends State<webviewScreen> {
WebViewController webViewController = WebViewController();
@override
void initState() {
super.initState();
webViewController.init(
context: context,
setState: setState,
uri: Uri.parse("https://ubuntu-kr.org"),
);
print('initState is called');
}

@override
void didChangeDependencies() {
super.didChangeDependencies();
print('didChangeDependencies is called');
}

@override
void setState(fn) {
super.setState(fn);
print('setState');
}

@override
void deactivate() {
super.deactivate();
print('deactivate');
}

// dispose 메서드는 위젯이 위젯 트리에서 완전히 제거될 때 호출된다
@override
void dispose() {
super.dispose();
print('dispose is called');
}

@override
void reassemble() {
super.reassemble();
print('reassemble');
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Wi-Fi Setup'), actions: <Widget>[
IconButton(
icon: const Icon(Icons.refresh),
tooltip: 'Wi-Fi 다시 스캔',
onPressed: () async {
// await scanWifi();
},
),
]),
body: WebView(
controller: webViewController,
));
}
}
15 changes: 15 additions & 0 deletions lib/wifiScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
import 'package:dbus/dbus.dart';
import 'package:nm/nm.dart';
import 'webviewScreen.dart';

class WifiScreen extends StatefulWidget {
const WifiScreen({Key? key}) : super(key: key);
Expand Down Expand Up @@ -250,6 +251,10 @@ class _WifiScreenState extends State<WifiScreen> {
return accessPointSettings;
}

// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => const WifiScreen()),
// );
@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -261,6 +266,16 @@ class _WifiScreenState extends State<WifiScreen> {
await scanWifi();
},
),
IconButton(
icon: const Icon(Icons.web),
tooltip: '웹 브라우저',
onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const webviewScreen()),
);
},
),
]),
body: Column(
// mainAxisAlignment: MainAxisAlignment.center,
Expand Down
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
#include "generated_plugin_registrant.h"

#include <gtk/gtk_plugin.h>
#include <webview_universal/webview_universal_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) webview_universal_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WebviewUniversalPlugin");
webview_universal_plugin_register_with_registrar(webview_universal_registrar);
}
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
gtk
webview_universal
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
129 changes: 109 additions & 20 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.1"
version: "1.18.0"
convert:
dependency: "direct main"
description:
Expand Down Expand Up @@ -224,6 +224,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.7"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
Expand All @@ -236,26 +260,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.15"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.12.0"
nested:
dependency: transitive
description:
Expand All @@ -276,10 +300,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -449,10 +473,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
sqlite3:
dependency: "direct main"
description:
Expand All @@ -465,18 +489,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -497,10 +521,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.7.0"
typed_data:
dependency: transitive
description:
Expand All @@ -509,6 +533,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: transitive
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
vector_math:
dependency: transitive
description:
Expand All @@ -517,6 +549,63 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
webview_flutter:
dependency: transitive
description:
name: webview_flutter
sha256: d81b68e88cc353e546afb93fb38958e3717282c5ac6e5d3be4a4aef9fc3c1413
url: "https://pub.dev"
source: hosted
version: "4.5.0"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: "3e5f4e9d818086b0d01a66fb1ff9cc72ab0cc58c71980e3d3661c5685ea0efb0"
url: "https://pub.dev"
source: hosted
version: "3.15.0"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: dbe745ee459a16b6fec296f7565a8ef430d0d681001d8ae521898b9361854943
url: "https://pub.dev"
source: hosted
version: "2.9.0"
webview_flutter_web:
dependency: transitive
description:
name: webview_flutter_web
sha256: "7f7cb8cfe5a5dee3b55d660a367c00838be56540ccb4097e84601bb6cb354af3"
url: "https://pub.dev"
source: hosted
version: "0.2.2+4"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: "9bf168bccdf179ce90450b5f37e36fe263f591c9338828d6bf09b6f8d0f57f86"
url: "https://pub.dev"
source: hosted
version: "3.12.0"
webview_universal:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "68bd93621f73b44cc49e6220a0164fc015cd83b7"
url: "https://github.com/ubuntu-kr/webview_universal.git"
source: git
version: "0.0.5"
win32:
dependency: transitive
description:
Expand Down Expand Up @@ -550,5 +639,5 @@ packages:
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.0.5 <4.0.0"
flutter: ">=3.10.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
7 changes: 3 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ dependencies:
http: ^1.1.0
google_fonts: ^5.1.0
nm: ^0.5.0
# quick_usb:
# git:
# url: https://github.com/ubuntu-kr/quick.flutter.git
# path: packages/quick_usb
webview_universal:
git:
url: https://github.com/ubuntu-kr/webview_universal.git

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export PYTHONPATH=$SNAP/lib/python3.5/site-packages/

exec "$SNAP/bin/gunicorn" -b 0.0.0.0:5000 --chdir "$SNAP/bin/usbserver" server:app "$@"
exec "$SNAP/bin/gunicorn" -b 0.0.0.0:5000 --chdir "$SNAP/bin/printserver" server:app "$@"
Loading

0 comments on commit 1e6f04f

Please sign in to comment.