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
50022e7f
Commit
50022e7f
authored
Apr 13, 2020
by
AlexVincent525
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
Improve code in example.
parent
4871b571
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
408 additions
and
411 deletions
+408
-411
example/lib/main.dart
example/lib/main.dart
+9
-11
example/lib/platform_view.dart
example/lib/platform_view.dart
+4
-4
example/lib/simple_page_widgets.dart
example/lib/simple_page_widgets.dart
+318
-308
example/lib/test_input.dart
example/lib/test_input.dart
+75
-85
example/test/widget_test.dart
example/test/widget_test.dart
+2
-3
No files found.
example/lib/main.dart
View file @
50022e7f
...
...
@@ -17,7 +17,7 @@ class _MyAppState extends State<MyApp> {
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
'embeded'
:
(
pageName
,
params
,
_
)
=>
Embe
dedFirstRouteWidget
(),
'embeded'
:
(
pageName
,
params
,
_
)
=>
Embed
dedFirstRouteWidget
(),
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'firstFirst'
:
(
pageName
,
params
,
_
)
=>
FirstFirstRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
...
...
@@ -25,14 +25,16 @@ class _MyAppState extends State<MyApp> {
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'platformView'
:
(
pageName
,
params
,
_
)
=>
PlatformRouteWidget
(),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
///可以在native层通过 getContainerParams 来传递参数
'flutterPage'
:
(
pageName
,
params
,
_
)
{
print
(
"flutterPage params:
$params
"
);
return
FlutterRouteWidget
(
params:
params
);
return
FlutterRouteWidget
(
params:
params
);
},
});
FlutterBoost
.
singleton
.
addBoostNavigatorObserver
(
TestBoostNavigatorObserver
());
FlutterBoost
.
singleton
.
addBoostNavigatorObserver
(
TestBoostNavigatorObserver
());
}
@override
...
...
@@ -40,18 +42,15 @@ class _MyAppState extends State<MyApp> {
return
MaterialApp
(
title:
'Flutter Boost example'
,
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
home:
Container
(
color:
Colors
.
white
));
home:
Container
(
color:
Colors
.
white
));
}
void
_onRoutePushed
(
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{
}
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{}
}
class
TestBoostNavigatorObserver
extends
NavigatorObserver
{
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
class
TestBoostNavigatorObserver
extends
NavigatorObserver
{
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>
previousRoute
)
{
print
(
"flutterboost#didPush"
);
}
...
...
@@ -67,4 +66,3 @@ class TestBoostNavigatorObserver extends NavigatorObserver{
print
(
"flutterboost#didReplace"
);
}
}
example/lib/platform_view.dart
View file @
50022e7f
...
...
@@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
typedef
void
TextViewCreatedCallback
(
TextViewController
controller
);
typedef
TextViewCreatedCallback
=
void
Function
(
TextViewController
controller
);
class
TextView
extends
StatefulWidget
{
const
TextView
({
...
...
@@ -34,13 +34,13 @@ class _TextViewState extends State<TextView> {
if
(
widget
.
onTextViewCreated
==
null
)
{
return
;
}
widget
.
onTextViewCreated
(
new
TextViewController
.
_
(
id
));
widget
.
onTextViewCreated
(
TextViewController
.
_
(
id
));
}
}
class
TextViewController
{
TextViewController
.
_
(
int
id
)
:
_channel
=
new
MethodChannel
(
'plugins.felix.angelov/textview_
$id
'
);
:
_channel
=
MethodChannel
(
'plugins.felix.angelov/textview_
$id
'
);
final
MethodChannel
_channel
;
...
...
example/lib/simple_page_widgets.dart
View file @
50022e7f
This diff is collapsed.
Click to expand it.
example/lib/test_input.dart
View file @
50022e7f
import
'package:flutter/material.dart'
;
class
TestPage
extends
StatefulWidget
{
TestPage
({
Key
key
,
this
.
title
=
"Input Test"
})
:
super
(
key:
key
);
const
TestPage
({
Key
key
,
this
.
title
=
'Input Test'
,
})
:
super
(
key:
key
);
final
String
title
;
...
...
@@ -18,24 +21,16 @@ class _TestPageState extends State<TestPage> {
});
}
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
widget
.
title
),
),
appBar:
AppBar
(
title:
Text
(
widget
.
title
)),
body:
SafeArea
(
bottom:
false
,
child:
ListView
(
children:
<
Widget
>[
Container
(
child:
Text
(
child:
const
Text
(
'You have pushed the button this many times:'
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
...
...
@@ -50,10 +45,7 @@ class _TestPageState extends State<TestPage> {
alignment:
Alignment
.
center
,
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
...
...
@@ -98,15 +90,13 @@ class _TestPageState extends State<TestPage> {
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
],
)),
),
),
floatingActionButton:
FloatingActionButton
(
onPressed:
_incrementCounter
,
tooltip:
'Increment'
,
...
...
@@ -123,22 +113,22 @@ class TestTextField extends StatefulWidget {
class
_TestTextFieldState
extends
State
<
TestTextField
>
{
FocusNode
_node
;
PersistentBottomSheetController
_controller
;
PersistentBottomSheetController
<
dynamic
>
_controller
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
_node
=
FocusNode
();
_node
.
addListener
(()
{
if
(
_node
.
hasFocus
)
{
print
(
'showBottomSheet'
);
_controller
=
Scaffold
.
of
(
context
)
.
showBottomSheet
<
dynamic
>(
(
BuildContext
ctx
)
=>
Container
(
_controller
=
Scaffold
.
of
(
context
)
.
showBottomSheet
<
dynamic
>(
(
BuildContext
ctx
)
=>
Container
(
width:
double
.
infinity
,
height:
36.0
,
color:
Colors
.
deepPurple
,
));
),
);
}
else
{
if
(
_controller
!=
null
)
{
//Navigator.of(context).pop();
...
...
example/test/widget_test.dart
View file @
50022e7f
...
...
@@ -6,13 +6,12 @@
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../lib/main.dart'
;
import
'package:flutter_boost_example/main.dart'
;
void
main
(
)
{
testWidgets
(
'Verify Platform version'
,
(
WidgetTester
tester
)
async
{
// Build our app and trigger a frame.
await
tester
.
pumpWidget
(
new
MyApp
());
await
tester
.
pumpWidget
(
MyApp
());
// Verify that platform version is retrieved.
expect
(
...
...
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