Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flutter Inappwebview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
Flutter Inappwebview
Commits
a5a784dd
Commit
a5a784dd
authored
Nov 13, 2018
by
pichillilorenzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init iOS inline webview implementation
parent
f02791f4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
589 additions
and
527 deletions
+589
-527
.idea/workspace.xml
.idea/workspace.xml
+50
-82
example/lib/main.dart
example/lib/main.dart
+443
-443
flutter_inappbrowser.iml
flutter_inappbrowser.iml
+0
-1
ios/Classes/FlutterWebViewController.swift
ios/Classes/FlutterWebViewController.swift
+51
-0
ios/Classes/FlutterWebViewFactory.swift
ios/Classes/FlutterWebViewFactory.swift
+28
-0
ios/Classes/SwiftFlutterPlugin.swift
ios/Classes/SwiftFlutterPlugin.swift
+3
-1
lib/flutter_inappbrowser.dart
lib/flutter_inappbrowser.dart
+14
-0
No files found.
.idea/workspace.xml
View file @
a5a784dd
This diff is collapsed.
Click to expand it.
example/lib/main.dart
View file @
a5a784dd
This diff is collapsed.
Click to expand it.
flutter_inappbrowser.iml
View file @
a5a784dd
...
...
@@ -20,7 +20,6 @@
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/.dart_tool"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/.pub"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/build"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/flutter_inappbrowser/example/ios/Flutter/flutter_assets/packages"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/Flutter/flutter_assets/packages"
/>
</content>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
...
...
ios/Classes/FlutterWebViewController.swift
0 → 100644
View file @
a5a784dd
//
// FlutterWebViewController.swift
// flutter_inappbrowser
//
// Created by Lorenzo on 13/11/18.
//
import
Foundation
public
class
FlutterWebViewController
:
NSObject
,
FlutterPlatformView
{
private
weak
var
registrar
:
FlutterPluginRegistrar
?
private
var
webView
:
InAppWebView
?
private
var
viewId
:
Int64
=
0
private
var
channel
:
FlutterMethodChannel
?
init
(
registrar
:
FlutterPluginRegistrar
,
withFrame
frame
:
CGRect
,
viewIdentifier
viewId
:
Int64
,
arguments
args
:
NSDictionary
)
{
super
.
init
()
self
.
registrar
=
registrar
self
.
viewId
=
viewId
webView
=
InAppWebView
(
frame
:
frame
)
let
channelName
=
String
(
format
:
"com.pichillilorenzo/flutter_inappwebview_%lld"
,
viewId
)
self
.
channel
=
FlutterMethodChannel
(
name
:
channelName
,
binaryMessenger
:
registrar
.
messenger
())
self
.
channel
?
.
setMethodCallHandler
(
self
.
handle
)
var
initialUrl
=
(
args
[
"initialUrl"
]
as?
String
)
!
let
initialFile
=
args
[
"initialFile"
]
as?
String
let
initialData
=
args
[
"initialData"
]
as?
[
String
:
String
]
let
initialHeaders
=
(
args
[
"initialHeaders"
]
as?
[
String
:
String
])
!
let
initialOptions
=
(
args
[
"initialOptions"
]
as?
[
String
:
Any
])
!
webView
!.
load
(
URLRequest
(
url
:
URL
(
string
:
initialUrl
)
!
))
}
public
func
view
()
->
UIView
{
return
webView
!
}
public
func
handle
(
_
call
:
FlutterMethodCall
,
result
:
@escaping
FlutterResult
)
{
let
arguments
=
call
.
arguments
as?
NSDictionary
switch
call
.
method
{
//case "open":
//self.open(uuid: uuid, arguments: arguments!, result: result)
//break
default
:
result
(
FlutterMethodNotImplemented
)
break
}
}
}
ios/Classes/FlutterWebViewFactory.swift
0 → 100644
View file @
a5a784dd
//
// FlutterWebViewFactory.swift
// flutter_inappbrowser
//
// Created by Lorenzo on 13/11/18.
//
import
Flutter
import
Foundation
public
class
FlutterWebViewFactory
:
NSObject
,
FlutterPlatformViewFactory
{
private
weak
var
registrar
:
FlutterPluginRegistrar
?
init
(
registrar
:
FlutterPluginRegistrar
?)
{
super
.
init
()
self
.
registrar
=
registrar
}
public
func
createArgsCodec
()
->
FlutterMessageCodec
&
NSObjectProtocol
{
return
FlutterStandardMessageCodec
.
sharedInstance
()
}
public
func
create
(
withFrame
frame
:
CGRect
,
viewIdentifier
viewId
:
Int64
,
arguments
args
:
Any
?)
->
FlutterPlatformView
{
let
arguments
=
args
as?
NSDictionary
let
webviewController
=
FlutterWebViewController
(
registrar
:
registrar
!
,
withFrame
:
frame
,
viewIdentifier
:
viewId
,
arguments
:
arguments
!
)
return
webviewController
}
}
ios/Classes/SwiftFlutterPlugin.swift
View file @
a5a784dd
...
...
@@ -36,12 +36,12 @@ extension Dictionary where Key: ExpressibleByStringLiteral {
public
class
SwiftFlutterPlugin
:
NSObject
,
FlutterPlugin
{
static
var
registrar
:
FlutterPluginRegistrar
?
var
channel
:
FlutterMethodChannel
var
webViewControllers
:
[
String
:
InAppBrowserWebViewController
?]
=
[:]
var
safariViewControllers
:
[
String
:
Any
?]
=
[:]
var
tmpWindow
:
UIWindow
?
var
channel
:
FlutterMethodChannel
private
var
previousStatusBarStyle
=
-
1
public
init
(
with
registrar
:
FlutterPluginRegistrar
)
{
...
...
@@ -56,6 +56,8 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
let
instance
=
SwiftFlutterPlugin
(
with
:
registrar
)
registrar
.
addMethodCallDelegate
(
instance
,
channel
:
channel
)
registrar
.
register
(
FlutterWebViewFactory
(
registrar
:
registrar
)
as
FlutterPlatformViewFactory
,
withId
:
"com.pichillilorenzo/flutter_inappwebview"
)
if
#available(iOS 11.0, *)
{
MyCookieManager
(
registrar
:
registrar
)
}
else
{
...
...
lib/flutter_inappbrowser.dart
View file @
a5a784dd
...
...
@@ -694,6 +694,20 @@ class _InAppWebViewState extends State<InAppWebView> {
creationParamsCodec:
const
StandardMessageCodec
(),
),
);
}
else
if
(
defaultTargetPlatform
==
TargetPlatform
.
iOS
)
{
return
UiKitView
(
viewType:
'com.pichillilorenzo/flutter_inappwebview'
,
onPlatformViewCreated:
_onPlatformViewCreated
,
gestureRecognizers:
widget
.
gestureRecognizers
,
creationParams:
<
String
,
dynamic
>{
'initialUrl'
:
widget
.
initialUrl
,
'initialFile'
:
widget
.
initialFile
,
'initialData'
:
widget
.
initialData
?.
toMap
(),
'initialHeaders'
:
widget
.
initialHeaders
,
'initialOptions'
:
widget
.
initialOptions
},
creationParamsCodec:
const
StandardMessageCodec
(),
);
}
return
Text
(
'
$defaultTargetPlatform
is not yet supported by the flutter_inappbrowser plugin'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment