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
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_boost_1.22.4
Commits
e9fe2517
Commit
e9fe2517
authored
Mar 12, 2020
by
justin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into v1.12.13-hotfixes
parents
c09cb81c
9eac79fa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
51 deletions
+68
-51
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
...rboost/containers/FlutterActivityAndFragmentDelegate.java
+22
-22
ios/Classes/container/FLBFlutterViewContainer.m
ios/Classes/container/FLBFlutterViewContainer.m
+4
-5
lib/container/boost_container.dart
lib/container/boost_container.dart
+2
-2
lib/flutter_boost.dart
lib/flutter_boost.dart
+23
-12
test/lib/unit/boost_container_test.dart
test/lib/unit/boost_container_test.dart
+7
-1
test/lib/unit/boost_page_route_test.dart
test/lib/unit/boost_page_route_test.dart
+9
-4
test/lib/unit/flutter_boost_test.dart
test/lib/unit/flutter_boost_test.dart
+1
-5
No files found.
android/src/main/java/com/idlefish/flutterboost/containers/FlutterActivityAndFragmentDelegate.java
View file @
e9fe2517
...
@@ -57,11 +57,11 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -57,11 +57,11 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
protected
IOperateSyncer
mSyncer
;
protected
IOperateSyncer
mSyncer
;
FlutterActivityAndFragmentDelegate
(
@NonNull
Host
host
)
{
public
FlutterActivityAndFragmentDelegate
(
@NonNull
Host
host
)
{
this
.
host
=
host
;
this
.
host
=
host
;
}
}
void
release
()
{
public
void
release
()
{
this
.
host
=
null
;
this
.
host
=
null
;
this
.
flutterEngine
=
null
;
this
.
flutterEngine
=
null
;
this
.
flutterView
=
null
;
this
.
flutterView
=
null
;
...
@@ -70,15 +70,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -70,15 +70,15 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
@Nullable
@Nullable
FlutterEngine
getFlutterEngine
()
{
public
FlutterEngine
getFlutterEngine
()
{
return
flutterEngine
;
return
flutterEngine
;
}
}
XFlutterView
getFlutterView
()
{
public
XFlutterView
getFlutterView
()
{
return
flutterView
;
return
flutterView
;
}
}
void
onAttach
(
@NonNull
Context
context
)
{
public
void
onAttach
(
@NonNull
Context
context
)
{
ensureAlive
();
ensureAlive
();
if
(
FlutterBoost
.
instance
().
platform
().
whenEngineStart
()
==
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
)
{
if
(
FlutterBoost
.
instance
().
platform
().
whenEngineStart
()
==
FlutterBoost
.
ConfigBuilder
.
FLUTTER_ACTIVITY_CREATED
)
{
FlutterBoost
.
instance
().
doInitialFlutter
();
FlutterBoost
.
instance
().
doInitialFlutter
();
...
@@ -125,7 +125,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -125,7 +125,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
@SuppressLint
(
"ResourceType"
)
@SuppressLint
(
"ResourceType"
)
@NonNull
@NonNull
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
Log
.
v
(
TAG
,
"Creating FlutterView."
);
Log
.
v
(
TAG
,
"Creating FlutterView."
);
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
flutterEngine
.
getActivityControlSurface
().
attachToActivity
(
host
.
getActivity
(),
host
.
getActivity
(),
...
@@ -154,7 +154,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -154,7 +154,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onStart
()
{
public
void
onStart
()
{
Log
.
v
(
TAG
,
"onStart()"
);
Log
.
v
(
TAG
,
"onStart()"
);
ensureAlive
();
ensureAlive
();
...
@@ -167,7 +167,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -167,7 +167,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onResume
()
{
public
void
onResume
()
{
mSyncer
.
onAppear
();
mSyncer
.
onAppear
();
Log
.
v
(
TAG
,
"onResume()"
);
Log
.
v
(
TAG
,
"onResume()"
);
...
@@ -185,7 +185,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -185,7 +185,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onPostResume
()
{
public
void
onPostResume
()
{
Log
.
v
(
TAG
,
"onPostResume()"
);
Log
.
v
(
TAG
,
"onPostResume()"
);
ensureAlive
();
ensureAlive
();
Utils
.
setStatusBarLightMode
(
host
.
getActivity
(),
true
);
Utils
.
setStatusBarLightMode
(
host
.
getActivity
(),
true
);
...
@@ -193,7 +193,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -193,7 +193,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onPause
()
{
public
void
onPause
()
{
Log
.
v
(
TAG
,
"onPause()"
);
Log
.
v
(
TAG
,
"onPause()"
);
ensureAlive
();
ensureAlive
();
...
@@ -202,14 +202,14 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -202,14 +202,14 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onStop
()
{
public
void
onStop
()
{
Log
.
v
(
TAG
,
"onStop()"
);
Log
.
v
(
TAG
,
"onStop()"
);
ensureAlive
();
ensureAlive
();
}
}
void
onDestroyView
()
{
public
void
onDestroyView
()
{
Log
.
v
(
TAG
,
"onDestroyView()"
);
Log
.
v
(
TAG
,
"onDestroyView()"
);
mSyncer
.
onDestroy
();
mSyncer
.
onDestroy
();
...
@@ -219,7 +219,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -219,7 +219,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onDetach
()
{
public
void
onDetach
()
{
Log
.
v
(
TAG
,
"onDetach()"
);
Log
.
v
(
TAG
,
"onDetach()"
);
ensureAlive
();
ensureAlive
();
...
@@ -236,14 +236,14 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -236,14 +236,14 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onBackPressed
()
{
public
void
onBackPressed
()
{
mSyncer
.
onBackPressed
();
mSyncer
.
onBackPressed
();
ensureAlive
();
ensureAlive
();
}
}
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
mSyncer
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
mSyncer
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
ensureAlive
();
ensureAlive
();
...
@@ -259,7 +259,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -259,7 +259,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onNewIntent
(
@NonNull
Intent
intent
)
{
public
void
onNewIntent
(
@NonNull
Intent
intent
)
{
mSyncer
.
onNewIntent
(
intent
);
mSyncer
.
onNewIntent
(
intent
);
ensureAlive
();
ensureAlive
();
...
@@ -272,7 +272,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -272,7 +272,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
mSyncer
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
mSyncer
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
Map
<
String
,
Object
>
result
=
null
;
Map
<
String
,
Object
>
result
=
null
;
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
...
@@ -298,7 +298,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -298,7 +298,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onUserLeaveHint
()
{
public
void
onUserLeaveHint
()
{
ensureAlive
();
ensureAlive
();
if
(
flutterEngine
!=
null
)
{
if
(
flutterEngine
!=
null
)
{
Log
.
v
(
TAG
,
"Forwarding onUserLeaveHint() to FlutterEngine."
);
Log
.
v
(
TAG
,
"Forwarding onUserLeaveHint() to FlutterEngine."
);
...
@@ -309,7 +309,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -309,7 +309,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
void
onTrimMemory
(
int
level
)
{
public
void
onTrimMemory
(
int
level
)
{
mSyncer
.
onTrimMemory
(
level
);
mSyncer
.
onTrimMemory
(
level
);
ensureAlive
();
ensureAlive
();
...
@@ -325,7 +325,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -325,7 +325,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
}
}
}
}
void
onLowMemory
()
{
public
void
onLowMemory
()
{
Log
.
v
(
TAG
,
"Forwarding onLowMemory() to FlutterEngine."
);
Log
.
v
(
TAG
,
"Forwarding onLowMemory() to FlutterEngine."
);
mSyncer
.
onLowMemory
();
mSyncer
.
onLowMemory
();
...
@@ -338,7 +338,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -338,7 +338,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
* <p>
* <p>
* An {@code IllegalStateException} is thrown if this delegate has been {@link #release()}'ed.
* An {@code IllegalStateException} is thrown if this delegate has been {@link #release()}'ed.
*/
*/
private
void
ensureAlive
()
{
private
void
ensureAlive
()
{
if
(
host
==
null
)
{
if
(
host
==
null
)
{
throw
new
IllegalStateException
(
"Cannot execute method on a destroyed FlutterActivityAndFragmentDelegate."
);
throw
new
IllegalStateException
(
"Cannot execute method on a destroyed FlutterActivityAndFragmentDelegate."
);
}
}
...
@@ -401,7 +401,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
...
@@ -401,7 +401,7 @@ public class FlutterActivityAndFragmentDelegate implements IFlutterViewContainer
* The {@link FlutterActivity} or {@link FlutterFragment} that owns this
* The {@link FlutterActivity} or {@link FlutterFragment} that owns this
* {@code FlutterActivityAndFragmentDelegate}.
* {@code FlutterActivityAndFragmentDelegate}.
*/
*/
/* package */
interface
Host
extends
SplashScreenProvider
,
FlutterEngineProvider
,
FlutterEngineConfigurator
{
public
interface
Host
extends
SplashScreenProvider
,
FlutterEngineProvider
,
FlutterEngineConfigurator
{
/**
/**
* Returns the {@link Context} that backs the host {@link Activity} or {@code Fragment}.
* Returns the {@link Context} that backs the host {@link Activity} or {@code Fragment}.
*/
*/
...
...
ios/Classes/container/FLBFlutterViewContainer.m
View file @
e9fe2517
...
@@ -179,11 +179,10 @@ static NSUInteger kInstanceCounter = 0;
...
@@ -179,11 +179,10 @@ static NSUInteger kInstanceCounter = 0;
params:
_params
params:
_params
uniqueId:
self
.
uniqueIDString
];
uniqueId:
self
.
uniqueIDString
];
//Save some first time page info.
//Save some first time page info.
if
(
!
[
FlutterBoostPlugin
sharedInstance
].
fPagename
){
[
FlutterBoostPlugin
sharedInstance
].
fPagename
=
_name
;
[
FlutterBoostPlugin
sharedInstance
].
fPagename
=
_name
;
[
FlutterBoostPlugin
sharedInstance
].
fPageId
=
self
.
uniqueIDString
;
[
FlutterBoostPlugin
sharedInstance
].
fPageId
=
self
.
uniqueIDString
;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
[
FlutterBoostPlugin
sharedInstance
].
fParams
=
_params
;
}
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
[
self
.
view
setNeedsLayout
];
[
self
.
view
setNeedsLayout
];
...
...
lib/container/boost_container.dart
View file @
e9fe2517
...
@@ -199,7 +199,7 @@ class BoostContainerState extends NavigatorState {
...
@@ -199,7 +199,7 @@ class BoostContainerState extends NavigatorState {
}
}
if
(
canPop
())
{
if
(
canPop
())
{
return
super
.
pop
(
result
);
super
.
pop
<
T
>
(
result
);
}
else
{
}
else
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
if
(
T
is
Map
<
String
,
dynamic
>)
{
FlutterBoost
.
singleton
FlutterBoost
.
singleton
...
@@ -208,7 +208,7 @@ class BoostContainerState extends NavigatorState {
...
@@ -208,7 +208,7 @@ class BoostContainerState extends NavigatorState {
FlutterBoost
.
singleton
.
close
(
uniqueId
);
FlutterBoost
.
singleton
.
close
(
uniqueId
);
}
}
}
}
return
fals
e
;
return
tru
e
;
}
}
@override
@override
...
...
lib/flutter_boost.dart
View file @
e9fe2517
...
@@ -55,23 +55,34 @@ class FlutterBoost {
...
@@ -55,23 +55,34 @@ class FlutterBoost {
static
ContainerManagerState
get
containerManager
=>
static
ContainerManagerState
get
containerManager
=>
_instance
.
containerManagerKey
.
currentState
;
_instance
.
containerManagerKey
.
currentState
;
static
void
onPageStart
()
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
singleton
.
channel
.
invokeMethod
<
Map
>(
'pageOnStart'
).
then
((
Map
pageInfo
)
{
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
if
(
pageInfo
.
containsKey
(
"name"
)
&&
pageInfo
.
containsKey
(
"params"
)
&&
pageInfo
.
containsKey
(
"uniqueId"
))
{
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
pageInfo
[
"name"
],
pageInfo
[
"params"
],
pageInfo
[
"uniqueId"
]);
}
});
});
}
static
TransitionBuilder
init
(
static
TransitionBuilder
init
(
{
TransitionBuilder
builder
,
{
TransitionBuilder
builder
,
PrePushRoute
prePush
,
PrePushRoute
prePush
,
PostPushRoute
postPush
})
{
PostPushRoute
postPush
})
{
if
(
Platform
.
isAndroid
)
{
if
(
Platform
.
isAndroid
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
onPageStart
();
singleton
.
channel
.
invokeMethod
<
Map
>(
'pageOnStart'
).
then
((
Map
pageInfo
)
{
}
else
if
(
Platform
.
isIOS
)
{
if
(
pageInfo
==
null
||
pageInfo
.
isEmpty
)
return
;
assert
(()
{
()
async
{
if
(
pageInfo
.
containsKey
(
"name"
)
&&
onPageStart
();
pageInfo
.
containsKey
(
"params"
)
&&
}();
pageInfo
.
containsKey
(
"uniqueId"
))
{
return
true
;
ContainerCoordinator
.
singleton
.
nativeContainerDidShow
(
}());
pageInfo
[
"name"
],
pageInfo
[
"params"
],
pageInfo
[
"uniqueId"
]);
}
});
});
}
}
return
(
BuildContext
context
,
Widget
child
)
{
return
(
BuildContext
context
,
Widget
child
)
{
...
...
test/lib/unit/boost_container_test.dart
View file @
e9fe2517
...
@@ -137,7 +137,7 @@ void main() {
...
@@ -137,7 +137,7 @@ void main() {
expect
(
find
.
text
(
'Y'
,
skipOffstage:
false
),
findsNothing
);
expect
(
find
.
text
(
'Y'
,
skipOffstage:
false
),
findsNothing
);
});
});
//
//
testWidgets
(
'Navigator.of
fails
gracefully when not found in context'
,
testWidgets
(
'Navigator.of gracefully when not found in context'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
const
Key
targetKey
=
Key
(
'foo'
);
const
Key
targetKey
=
Key
(
'foo'
);
dynamic
exception
;
dynamic
exception
;
...
@@ -148,7 +148,13 @@ void main() {
...
@@ -148,7 +148,13 @@ void main() {
},
},
);
);
await
tester
.
pumpWidget
(
widget
);
await
tester
.
pumpWidget
(
widget
);
await
tester
.
pump
(
Duration
(
seconds:
1
));
await
tester
.
tap
(
find
.
byKey
(
targetKey
));
await
tester
.
tap
(
find
.
byKey
(
targetKey
));
await
tester
.
pump
(
Duration
(
seconds:
1
));
expect
(
exception
,
isInstanceOf
<
FlutterError
>());
expect
(
exception
,
isInstanceOf
<
FlutterError
>());
expect
(
'
$exception
'
,
expect
(
'
$exception
'
,
startsWith
(
'Navigator operation requested with a context'
));
startsWith
(
'Navigator operation requested with a context'
));
...
...
test/lib/unit/boost_page_route_test.dart
View file @
e9fe2517
...
@@ -47,7 +47,7 @@ void main() {
...
@@ -47,7 +47,7 @@ void main() {
group
(
'Try to get the BoostPageRoute in the ancestor node'
,
()
{
group
(
'Try to get the BoostPageRoute in the ancestor node'
,
()
{
testWidgets
(
testWidgets
(
'obtain BoostPageRoute through the
`BoostPageRoute.of(context)`
method'
,
'obtain BoostPageRoute through the
BoostPageRoute.of(context)
method'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
dynamic
boostPageRoute
;
dynamic
boostPageRoute
;
dynamic
boostPageRouteFindByOfMethod
;
dynamic
boostPageRouteFindByOfMethod
;
...
@@ -74,13 +74,15 @@ void main() {
...
@@ -74,13 +74,15 @@ void main() {
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
pump
(
Duration
(
seconds:
1
));
// The route obtained from the ancestor node through the `of` method should be the same BoostPageRoute
// The route obtained from the ancestor node through the `of` method should be the same BoostPageRoute
// as the originally created BoostPageRoute
// as the originally created BoostPageRoute
expect
(
boostPageRoute
,
boostPageRouteFindByOfMethod
);
expect
(
boostPageRoute
,
boostPageRouteFindByOfMethod
);
});
});
testWidgets
(
testWidgets
(
'try to find BoostPageRoute through the
`BoostPageRoute.of(context)`
method, '
'try to find BoostPageRoute through the
BoostPageRoute.of(context)
method, '
'but it doesn
\'
t exist, the method should throw an Exception'
,
'but it doesn
\'
t exist, the method should throw an Exception'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
dynamic
contextCache
;
dynamic
contextCache
;
...
@@ -102,12 +104,13 @@ void main() {
...
@@ -102,12 +104,13 @@ void main() {
),
),
);
);
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
pump
(
Duration
(
seconds:
1
));
expect
(()
=>
BoostPageRoute
.
of
<
dynamic
>(
contextCache
),
throwsException
);
expect
(()
=>
BoostPageRoute
.
of
<
dynamic
>(
contextCache
),
throwsException
);
});
});
testWidgets
(
testWidgets
(
'obtain BoostPageRoute through the
`BoostPageRoute.tryOf(context)`
method'
,
'obtain BoostPageRoute through the
BoostPageRoute.tryOf(context)
method'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
dynamic
boostPageRoute
;
dynamic
boostPageRoute
;
dynamic
boostPageRouteFindByOfMethod
;
dynamic
boostPageRouteFindByOfMethod
;
...
@@ -134,6 +137,7 @@ void main() {
...
@@ -134,6 +137,7 @@ void main() {
);
);
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
pump
(
Duration
(
seconds:
1
));
// The route obtained from the ancestor node through the `tryOf` method should be the same BoostPageRoute
// The route obtained from the ancestor node through the `tryOf` method should be the same BoostPageRoute
// as the originally created BoostPageRoute
// as the originally created BoostPageRoute
...
@@ -142,7 +146,7 @@ void main() {
...
@@ -142,7 +146,7 @@ void main() {
});
});
testWidgets
(
testWidgets
(
'try to find BoostPageRoute through the
`BoostPageRoute.tryOf(context)`
method, '
'try to find BoostPageRoute through the
BoostPageRoute.tryOf(context)
method, '
'but it doesn
\'
t exist, the method should return null'
,
'but it doesn
\'
t exist, the method should return null'
,
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
dynamic
boostPageRouteFindByOfMethod
;
dynamic
boostPageRouteFindByOfMethod
;
...
@@ -168,6 +172,7 @@ void main() {
...
@@ -168,6 +172,7 @@ void main() {
);
);
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
tap
(
find
.
byType
(
FloatingActionButton
));
await
tester
.
pump
(
Duration
(
seconds:
1
));
expect
(
boostPageRouteFindByOfMethod
,
null
);
expect
(
boostPageRouteFindByOfMethod
,
null
);
});
});
...
...
test/lib/unit/flutter_boost_test.dart
View file @
e9fe2517
...
@@ -7,10 +7,6 @@ import 'package:flutter_test/flutter_test.dart';
...
@@ -7,10 +7,6 @@ import 'package:flutter_test/flutter_test.dart';
void
main
(
)
{
void
main
(
)
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
TestWidgetsFlutterBinding
.
ensureInitialized
();
testWidgets
(
'test iOS edge swipe then drop back at starting point works'
,
(
WidgetTester
tester
)
async
{
//push app
});
test
(
'test onMethodCall'
,
()
async
{
test
(
'test onMethodCall'
,
()
async
{
FlutterBoost
.
singleton
FlutterBoost
.
singleton
...
@@ -26,7 +22,7 @@ void main() {
...
@@ -26,7 +22,7 @@ void main() {
try
{
try
{
FlutterBoost
.
singleton
.
open
(
"url"
);
FlutterBoost
.
singleton
.
open
(
"url"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
e
,
is
NoSuchMethodError
);
expect
(
e
,
is
Exception
);
}
}
try
{
try
{
FlutterBoost
.
singleton
.
close
(
"url"
);
FlutterBoost
.
singleton
.
close
(
"url"
);
...
...
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