Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
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
1
Merge Requests
1
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_boost_1.22.4
Commits
1ebb42a9
Commit
1ebb42a9
authored
Jul 18, 2019
by
Yacumima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev
parent
3582a150
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
182 additions
and
7 deletions
+182
-7
android/src/main/java/com/idlefish/flutterboost/BoostFlutterEngine.java
...in/java/com/idlefish/flutterboost/BoostFlutterEngine.java
+1
-1
android/src/main/java/com/idlefish/flutterboost/BoostFlutterView.java
...main/java/com/idlefish/flutterboost/BoostFlutterView.java
+17
-6
example/lib/test_input.dart
example/lib/test_input.dart
+164
-0
No files found.
android/src/main/java/com/idlefish/flutterboost/BoostFlutterEngine.java
View file @
1ebb42a9
...
@@ -316,7 +316,7 @@ public class BoostFlutterEngine extends FlutterEngine {
...
@@ -316,7 +316,7 @@ public class BoostFlutterEngine extends FlutterEngine {
@Override
@Override
public
void
setViewportMetrics
(
@NonNull
ViewportMetrics
viewportMetrics
)
{
public
void
setViewportMetrics
(
@NonNull
ViewportMetrics
viewportMetrics
)
{
if
(
viewportMetrics
.
width
>
0
&&
viewportMetrics
.
height
>
0
&&
!
viewportMetricsEqual
(
last
,
viewportMetrics
)
)
{
if
(
viewportMetrics
.
width
>
0
&&
viewportMetrics
.
height
>
0
/*&& !viewportMetricsEqual(last, viewportMetrics)*/
)
{
last
=
viewportMetrics
;
last
=
viewportMetrics
;
Debuger
.
log
(
"setViewportMetrics w:"
+
viewportMetrics
.
width
+
" h:"
+
viewportMetrics
.
height
);
Debuger
.
log
(
"setViewportMetrics w:"
+
viewportMetrics
.
width
+
" h:"
+
viewportMetrics
.
height
);
super
.
setViewportMetrics
(
viewportMetrics
);
super
.
setViewportMetrics
(
viewportMetrics
);
...
...
android/src/main/java/com/idlefish/flutterboost/BoostFlutterView.java
View file @
1ebb42a9
...
@@ -32,6 +32,7 @@ import android.support.v4.view.ViewCompat;
...
@@ -32,6 +32,7 @@ import android.support.v4.view.ViewCompat;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.ProgressBar
;
import
android.widget.ProgressBar
;
...
@@ -89,6 +90,13 @@ public class BoostFlutterView extends FrameLayout {
...
@@ -89,6 +90,13 @@ public class BoostFlutterView extends FrameLayout {
}
}
};
};
private
final
ViewTreeObserver
.
OnGlobalLayoutListener
mGlobalLayoutListener
=
new
ViewTreeObserver
.
OnGlobalLayoutListener
()
{
@Override
public
void
onGlobalLayout
()
{
ViewCompat
.
requestApplyInsets
(
mFlutterView
);
}
};
public
BoostFlutterView
(
Context
context
,
BoostFlutterEngine
engine
,
Bundle
args
,
RenderingProgressCoverCreator
creator
)
{
public
BoostFlutterView
(
Context
context
,
BoostFlutterEngine
engine
,
Bundle
args
,
RenderingProgressCoverCreator
creator
)
{
super
(
context
);
super
(
context
);
mFlutterEngine
=
engine
;
mFlutterEngine
=
engine
;
...
@@ -205,6 +213,15 @@ public class BoostFlutterView extends FrameLayout {
...
@@ -205,6 +213,15 @@ public class BoostFlutterView extends FrameLayout {
super
.
onAttachedToWindow
();
super
.
onAttachedToWindow
();
mPlatformPlugin
.
onPostResume
();
mPlatformPlugin
.
onPostResume
();
ViewCompat
.
requestApplyInsets
(
this
);
ViewCompat
.
requestApplyInsets
(
this
);
getViewTreeObserver
().
addOnGlobalLayoutListener
(
mGlobalLayoutListener
);
}
@Override
protected
void
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
();
getViewTreeObserver
().
removeOnGlobalLayoutListener
(
mGlobalLayoutListener
);
onDetach
();
}
}
public
BoostFlutterEngine
getEngine
(){
public
BoostFlutterEngine
getEngine
(){
...
@@ -280,12 +297,6 @@ public class BoostFlutterView extends FrameLayout {
...
@@ -280,12 +297,6 @@ public class BoostFlutterView extends FrameLayout {
mFlutterView
.
removeOnFirstFrameRenderedListener
(
mOnFirstFrameRenderedListener
);
mFlutterView
.
removeOnFirstFrameRenderedListener
(
mOnFirstFrameRenderedListener
);
}
}
@Override
protected
void
onDetachedFromWindow
()
{
super
.
onDetachedFromWindow
();
onDetach
();
}
//混合栈的返回和原来Flutter的返回逻辑不同
//混合栈的返回和原来Flutter的返回逻辑不同
public
void
onBackPressed
()
{
public
void
onBackPressed
()
{
// Debuger.log("onBackPressed()");
// Debuger.log("onBackPressed()");
...
...
example/lib/test_input.dart
0 → 100644
View file @
1ebb42a9
import
'package:flutter/material.dart'
;
class
TestPage
extends
StatefulWidget
{
TestPage
({
Key
key
,
this
.
title
=
"Input Test"
})
:
super
(
key:
key
);
final
String
title
;
@override
_TestPageState
createState
()
=>
_TestPageState
();
}
class
_TestPageState
extends
State
<
TestPage
>
{
int
_counter
=
0
;
void
_incrementCounter
()
{
setState
(()
{
_counter
++;
});
}
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
widget
.
title
),
),
body:
SafeArea
(
bottom:
false
,
child:
ListView
(
children:
<
Widget
>[
Container
(
child:
Text
(
'You have pushed the button this many times:'
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
),
Container
(
child:
Text
(
'
$_counter
'
,
style:
Theme
.
of
(
context
).
textTheme
.
display1
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
Container
(
child:
Container
(
color:
Colors
.
red
,
width:
double
.
infinity
,
height:
128.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
orange
,
width:
double
.
infinity
,
height:
128.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
green
,
width:
double
.
infinity
,
height:
128.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
blue
,
width:
double
.
infinity
,
height:
128.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
yellow
,
width:
double
.
infinity
,
height:
128.0
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
],
)),
floatingActionButton:
FloatingActionButton
(
onPressed:
_incrementCounter
,
tooltip:
'Increment'
,
child:
Icon
(
Icons
.
add
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class
TestTextField
extends
StatefulWidget
{
@override
_TestTextFieldState
createState
()
=>
_TestTextFieldState
();
}
class
_TestTextFieldState
extends
State
<
TestTextField
>
{
FocusNode
_node
;
PersistentBottomSheetController
_controller
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_node
=
FocusNode
();
_node
.
addListener
(()
{
if
(
_node
.
hasFocus
)
{
print
(
'showBottomSheet'
);
_controller
=
Scaffold
.
of
(
context
)
.
showBottomSheet
((
BuildContext
ctx
)
=>
Container
(
width:
double
.
infinity
,
height:
36.0
,
color:
Colors
.
deepPurple
,
));
}
else
{
if
(
_controller
!=
null
)
{
//Navigator.of(context).pop();
print
(
'closeBottomSheet'
);
_controller
.
close
();
}
_controller
=
null
;
}
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
focusNode:
_node
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
);
}
}
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