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
4871b571
Commit
4871b571
authored
Apr 13, 2020
by
AlexVincent525
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
Improve code in swift example.
parent
9fea4af0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
181 deletions
+186
-181
example_swift/lib/main.dart
example_swift/lib/main.dart
+23
-13
example_swift/lib/simple_page_widgets.dart
example_swift/lib/simple_page_widgets.dart
+87
-81
example_swift/lib/test_input.dart
example_swift/lib/test_input.dart
+76
-87
No files found.
example_swift/lib/main.dart
View file @
4871b571
...
...
@@ -16,17 +16,22 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
FlutterBoost
.
singleton
.
registerPageBuilders
(<
String
,
PageBuilder
>{
'first'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FirstRouteWidget
(),
'second'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
SecondRouteWidget
(),
'tab'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
TabRouteWidget
(),
'flutterFragment'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FragmentRouteWidget
(
params
),
///可以在native层通过 getContainerParams 来传递参数
'flutterPage'
:
(
pageName
,
params
,
_
)
{
print
(
"flutterPage params:
$params
"
);
'flutterPage'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
{
print
(
'flutterPage params:
$params
'
);
return
FlutterRouteWidget
();
return
const
FlutterRouteWidget
();
},
});
}
...
...
@@ -34,12 +39,17 @@ class _MyAppState extends State<MyApp> {
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'Flutter Boost example'
,
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
home:
Container
());
title:
'Flutter Boost example'
,
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
home:
Container
(),
);
}
void
_onRoutePushed
(
String
pageName
,
String
uniqueId
,
Map
params
,
Route
route
,
Future
_
)
{
}
String
pageName
,
String
uniqueId
,
Map
<
String
,
dynamic
>
params
,
Route
<
dynamic
>
route
,
Future
<
dynamic
>
_
,
)
{}
}
example_swift/lib/simple_page_widgets.dart
View file @
4871b571
This diff is collapsed.
Click to expand it.
example_swift/lib/test_input.dart
View file @
4871b571
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,100 +21,87 @@ 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
(
'You have pushed the button this many times:'
,
bottom:
false
,
child:
ListView
(
children:
<
Widget
>[
Container
(
child:
const
Text
(
'You have pushed the button this many times:'
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
)
,
Container
(
child:
Text
(
'
$_counter
'
,
style:
Theme
.
of
(
context
).
textTheme
.
display1
,
Container
(
child:
Text
(
'
$_counter
'
,
style:
Theme
.
of
(
context
).
textTheme
.
display1
,
),
margin:
const
EdgeInsets
.
all
(
8.0
)
,
alignment:
Alignment
.
center
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
Container
(
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
Container
(
child:
Container
(
color:
Colors
.
red
,
width:
double
.
infinity
,
height:
128.0
,
TestTextField
(
),
Container
(
child:
Container
(
color:
Colors
.
red
,
width:
double
.
infinity
,
height:
128.0
,
)
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
orange
,
width:
double
.
infinity
,
height:
128.0
,
Container
(
child:
Container
(
color:
Colors
.
orange
,
width:
double
.
infinity
,
height:
128.0
,
)
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
green
,
width:
double
.
infinity
,
height:
128.0
,
Container
(
child:
Container
(
color:
Colors
.
green
,
width:
double
.
infinity
,
height:
128.0
,
)
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
blue
,
width:
double
.
infinity
,
height:
128.0
,
Container
(
child:
Container
(
color:
Colors
.
blue
,
width:
double
.
infinity
,
height:
128.0
,
)
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
Container
(
color:
Colors
.
yellow
,
width:
double
.
infinity
,
height:
128.0
,
Container
(
child:
Container
(
color:
Colors
.
yellow
,
width:
double
.
infinity
,
height:
128.0
,
)
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
Container
(
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
),
TestTextField
(),
],
)),
TestTextField
(),
],
),
),
floatingActionButton:
FloatingActionButton
(
onPressed:
_incrementCounter
,
tooltip:
'Increment'
,
child:
Icon
(
Icons
.
add
),
),
// This trailing comma makes auto-formatting nicer for build methods.
),
);
}
}
...
...
@@ -123,25 +113,24 @@ 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
(
width:
double
.
infinity
,
height:
36.0
,
color:
Colors
.
deepPurple
,
));
_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();
print
(
'closeBottomSheet'
);
_controller
.
close
();
}
...
...
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