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
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> {
...
@@ -16,17 +16,22 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
FlutterBoost
.
singleton
.
registerPageBuilders
(<
String
,
PageBuilder
>{
'first'
:
(
pageName
,
params
,
_
)
=>
FirstRouteWidget
(),
'first'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
'second'
:
(
pageName
,
params
,
_
)
=>
SecondRouteWidget
(),
FirstRouteWidget
(),
'tab'
:
(
pageName
,
params
,
_
)
=>
TabRouteWidget
(),
'second'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
'flutterFragment'
:
(
pageName
,
params
,
_
)
=>
FragmentRouteWidget
(
params
),
SecondRouteWidget
(),
'tab'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
TabRouteWidget
(),
'flutterFragment'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
=>
FragmentRouteWidget
(
params
),
///可以在native层通过 getContainerParams 来传递参数
///可以在native层通过 getContainerParams 来传递参数
'flutterPage'
:
(
pageName
,
params
,
_
)
{
'flutterPage'
:
(
String
pageName
,
Map
<
String
,
dynamic
>
params
,
String
_
)
{
print
(
"flutterPage params:
$params
"
);
print
(
'flutterPage params:
$params
'
);
return
FlutterRouteWidget
();
return
const
FlutterRouteWidget
();
},
},
});
});
}
}
...
@@ -34,12 +39,17 @@ class _MyAppState extends State<MyApp> {
...
@@ -34,12 +39,17 @@ class _MyAppState extends State<MyApp> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
return
MaterialApp
(
title:
'Flutter Boost example'
,
title:
'Flutter Boost example'
,
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
builder:
FlutterBoost
.
init
(
postPush:
_onRoutePushed
),
home:
Container
());
home:
Container
(),
);
}
}
void
_onRoutePushed
(
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
...
@@ -6,15 +6,18 @@ class FirstRouteWidget extends StatelessWidget {
...
@@ -6,15 +6,18 @@ class FirstRouteWidget extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
'First Route'
),
title:
const
Text
(
'First Route'
),
),
),
body:
Center
(
body:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
child:
Text
(
'Open second route'
),
child:
const
Text
(
'Open second route'
),
onPressed:
()
{
onPressed:
()
{
print
(
"open second page!"
);
print
(
'open second page!'
);
FlutterBoost
.
singleton
.
open
(
"second"
).
then
((
Map
value
)
{
FlutterBoost
.
singleton
print
(
"call me when page is finished. did recieve second route result
$value
"
);
.
open
(
'second'
)
.
then
((
Map
<
String
,
dynamic
>
value
)
{
print
(
'call me when page is finished. did recieve second route result
$value
'
);
});
});
},
},
),
),
...
@@ -28,19 +31,21 @@ class SecondRouteWidget extends StatelessWidget {
...
@@ -28,19 +31,21 @@ class SecondRouteWidget extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
"Second Route"
),
title:
const
Text
(
'Second Route'
),
),
),
body:
Center
(
body:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
onPressed:
()
{
onPressed:
()
{
// Navigate back to first route when tapped.
// Navigate back to first route when tapped.
BoostContainerSettings
settings
=
final
BoostContainerSettings
settings
=
BoostContainer
.
of
(
context
).
settings
;
BoostContainer
.
of
(
context
).
settings
;
FlutterBoost
.
singleton
.
close
(
settings
.
uniqueId
,
FlutterBoost
.
singleton
.
close
(
result:
<
dynamic
,
dynamic
>{
"result"
:
"data from second"
});
settings
.
uniqueId
,
result:
<
String
,
dynamic
>{
'result'
:
'data from second'
},
);
},
},
child:
Text
(
'Go back with result!'
),
child:
const
Text
(
'Go back with result!'
),
),
),
),
),
);
);
...
@@ -51,15 +56,13 @@ class TabRouteWidget extends StatelessWidget {
...
@@ -51,15 +56,13 @@ class TabRouteWidget extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'Tab Route'
)),
title:
Text
(
"Tab Route"
),
),
body:
Center
(
body:
Center
(
child:
RaisedButton
(
child:
RaisedButton
(
onPressed:
()
{
onPressed:
()
{
FlutterBoost
.
singleton
.
open
(
"second"
);
FlutterBoost
.
singleton
.
open
(
'second'
);
},
},
child:
Text
(
'Open second route'
),
child:
const
Text
(
'Open second route'
),
),
),
),
),
);
);
...
@@ -67,15 +70,15 @@ class TabRouteWidget extends StatelessWidget {
...
@@ -67,15 +70,15 @@ class TabRouteWidget extends StatelessWidget {
}
}
class
FlutterRouteWidget
extends
StatelessWidget
{
class
FlutterRouteWidget
extends
StatelessWidget
{
final
String
message
;
const
FlutterRouteWidget
({
this
.
message
})
;
FlutterRouteWidget
({
this
.
message
})
;
final
String
message
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
'flutter_boost_example'
),
title:
const
Text
(
'flutter_boost_example'
),
),
),
body:
Column
(
body:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
@@ -83,7 +86,7 @@ class FlutterRouteWidget extends StatelessWidget {
...
@@ -83,7 +86,7 @@ class FlutterRouteWidget extends StatelessWidget {
Container
(
Container
(
margin:
const
EdgeInsets
.
only
(
top:
80.0
),
margin:
const
EdgeInsets
.
only
(
top:
80.0
),
child:
Text
(
child:
Text
(
message
??
"This is a flutter activity"
,
message
??
'This is a flutter activity'
,
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
blue
),
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
blue
),
),
),
alignment:
AlignmentDirectional
.
center
,
alignment:
AlignmentDirectional
.
center
,
...
@@ -101,10 +104,12 @@ class FlutterRouteWidget extends StatelessWidget {
...
@@ -101,10 +104,12 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
///例如:sample://nativePage?aaa=bbb
onTap:
()
=>
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
FlutterBoost
.
singleton
.
open
(
"sample://nativePage"
,
urlParams:
<
dynamic
,
dynamic
>{
'sample://nativePage'
,
"query"
:
{
"aaa"
:
"bbb"
}
urlParams:
<
String
,
dynamic
>{
}),
'query'
:
<
String
,
dynamic
>{
'aaa'
:
'bbb'
}
},
),
),
),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
...
@@ -118,36 +123,42 @@ class FlutterRouteWidget extends StatelessWidget {
...
@@ -118,36 +123,42 @@ class FlutterRouteWidget extends StatelessWidget {
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///后面的参数会在native的IPlatform.startActivity方法回调中拼接到url的query部分。
///例如:sample://nativePage?aaa=bbb
///例如:sample://nativePage?aaa=bbb
onTap:
()
=>
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
FlutterBoost
.
singleton
.
open
(
"sample://flutterPage"
,
urlParams:
<
dynamic
,
dynamic
>{
'sample://flutterPage'
,
"query"
:
{
"aaa"
:
"bbb"
}
urlParams:
<
String
,
dynamic
>{
}),
'query'
:
<
String
,
dynamic
>{
'aaa'
:
'bbb'
},
},
),
),
),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
color:
Colors
.
yellow
,
color:
Colors
.
yellow
,
child:
Text
(
child:
Text
(
'push flutter widget'
,
'push flutter widget'
,
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
)),
),
),
onTap:
()
{
onTap:
()
{
Navigator
.
push
<
dynamic
>(
Navigator
.
push
<
dynamic
>(
context
,
MaterialPageRoute
<
dynamic
>(
builder:
(
_
)
=>
PushWidget
()));
context
,
MaterialPageRoute
<
dynamic
>(
builder:
(
_
)
=>
PushWidget
()),
);
},
},
),
),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
color:
Colors
.
yellow
,
color:
Colors
.
yellow
,
child:
Text
(
child:
Text
(
'open flutter fragment page'
,
'open flutter fragment page'
,
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
)),
),
),
onTap:
()
=>
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
"sample://flutterFragmentPage"
),
FlutterBoost
.
singleton
.
open
(
'sample://flutterFragmentPage'
),
),
),
],
],
),
),
...
@@ -156,15 +167,15 @@ class FlutterRouteWidget extends StatelessWidget {
...
@@ -156,15 +167,15 @@ class FlutterRouteWidget extends StatelessWidget {
}
}
class
FragmentRouteWidget
extends
StatelessWidget
{
class
FragmentRouteWidget
extends
StatelessWidget
{
final
Map
params
;
const
FragmentRouteWidget
(
this
.
params
)
;
FragmentRouteWidget
(
this
.
params
)
;
final
Map
<
String
,
dynamic
>
params
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
'flutter_boost_example'
),
title:
const
Text
(
'flutter_boost_example'
),
),
),
body:
Column
(
body:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
@@ -172,7 +183,7 @@ class FragmentRouteWidget extends StatelessWidget {
...
@@ -172,7 +183,7 @@ class FragmentRouteWidget extends StatelessWidget {
Container
(
Container
(
margin:
const
EdgeInsets
.
only
(
top:
80.0
),
margin:
const
EdgeInsets
.
only
(
top:
80.0
),
child:
Text
(
child:
Text
(
"This is a flutter fragment"
,
'This is a flutter fragment'
,
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
blue
),
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
blue
),
),
),
alignment:
AlignmentDirectional
.
center
,
alignment:
AlignmentDirectional
.
center
,
...
@@ -180,7 +191,7 @@ class FragmentRouteWidget extends StatelessWidget {
...
@@ -180,7 +191,7 @@ class FragmentRouteWidget extends StatelessWidget {
Container
(
Container
(
margin:
const
EdgeInsets
.
only
(
top:
32.0
),
margin:
const
EdgeInsets
.
only
(
top:
32.0
),
child:
Text
(
child:
Text
(
params
[
'tag'
]
??
''
,
'
${params['tag']}
'
??
''
,
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
red
),
style:
TextStyle
(
fontSize:
28.0
,
color:
Colors
.
red
),
),
),
alignment:
AlignmentDirectional
.
center
,
alignment:
AlignmentDirectional
.
center
,
...
@@ -188,37 +199,40 @@ class FragmentRouteWidget extends StatelessWidget {
...
@@ -188,37 +199,40 @@ class FragmentRouteWidget extends StatelessWidget {
Expanded
(
child:
Container
()),
Expanded
(
child:
Container
()),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
color:
Colors
.
yellow
,
color:
Colors
.
yellow
,
child:
Text
(
child:
Text
(
'open native page'
,
'open native page'
,
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
)),
),
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
"sample://nativePage"
),
),
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
'sample://nativePage'
),
),
),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
all
(
8.0
),
color:
Colors
.
yellow
,
color:
Colors
.
yellow
,
child:
Text
(
child:
Text
(
'open flutter page'
,
'open flutter page'
,
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
)),
),
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
"sample://flutterPage"
),
),
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
'sample://flutterPage'
),
),
),
InkWell
(
InkWell
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
margin:
const
EdgeInsets
.
fromLTRB
(
8.0
,
8.0
,
8.0
,
80.0
),
margin:
const
EdgeInsets
.
fromLTRB
(
8.0
,
8.0
,
8.0
,
80.0
),
color:
Colors
.
yellow
,
color:
Colors
.
yellow
,
child:
Text
(
child:
Text
(
'open flutter fragment page'
,
'open flutter fragment page'
,
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
style:
TextStyle
(
fontSize:
22.0
,
color:
Colors
.
black
),
)),
),
),
onTap:
()
=>
onTap:
()
=>
FlutterBoost
.
singleton
.
open
(
"sample://flutterFragmentPage"
),
FlutterBoost
.
singleton
.
open
(
'sample://flutterFragmentPage'
),
)
)
],
],
),
),
...
@@ -234,15 +248,8 @@ class PushWidget extends StatefulWidget {
...
@@ -234,15 +248,8 @@ class PushWidget extends StatefulWidget {
class
_PushWidgetState
extends
State
<
PushWidget
>
{
class
_PushWidgetState
extends
State
<
PushWidget
>
{
VoidCallback
_backPressedListenerUnsub
;
VoidCallback
_backPressedListenerUnsub
;
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
}
@override
@override
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
// TODO: implement didChangeDependencies
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
// if (_backPressedListenerUnsub == null) {
// if (_backPressedListenerUnsub == null) {
...
@@ -258,13 +265,12 @@ class _PushWidgetState extends State<PushWidget> {
...
@@ -258,13 +265,12 @@ class _PushWidgetState extends State<PushWidget> {
@override
@override
void
dispose
()
{
void
dispose
()
{
// TODO: implement dispose
super
.
dispose
();
super
.
dispose
();
_backPressedListenerUnsub
?.
call
();
_backPressedListenerUnsub
?.
call
();
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
FlutterRouteWidget
(
message:
"Pushed Widget"
);
return
const
FlutterRouteWidget
(
message:
'Pushed Widget'
);
}
}
}
}
example_swift/lib/test_input.dart
View file @
4871b571
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
class
TestPage
extends
StatefulWidget
{
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
;
final
String
title
;
...
@@ -18,100 +21,87 @@ class _TestPageState extends State<TestPage> {
...
@@ -18,100 +21,87 @@ class _TestPageState extends State<TestPage> {
});
});
}
}
@override
void
initState
()
{
// TODO: implement initState
super
.
initState
();
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
widget
.
title
)),
title:
Text
(
widget
.
title
),
),
body:
SafeArea
(
body:
SafeArea
(
bottom:
false
,
bottom:
false
,
child:
ListView
(
child:
ListView
(
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Container
(
child:
Text
(
child:
const
Text
(
'You have pushed the button this many times:'
,
'You have pushed the button this many times:'
,
),
margin:
const
EdgeInsets
.
all
(
8.0
),
alignment:
Alignment
.
center
,
),
),
margin:
const
EdgeInsets
.
all
(
8.0
),
Container
(
alignment:
Alignment
.
center
,
child:
Text
(
)
,
'
$_counter
'
,
Container
(
style:
Theme
.
of
(
context
).
textTheme
.
display1
,
child:
Text
(
),
'
$_counter
'
,
margin:
const
EdgeInsets
.
all
(
8.0
)
,
style:
Theme
.
of
(
context
).
textTheme
.
display1
,
alignment:
Alignment
.
center
,
),
),
margin:
const
EdgeInsets
.
all
(
8.0
),
Container
(
alignment:
Alignment
.
center
,
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
TestTextField
(
),
),
Container
(
TestTextField
(),
child:
Container
(
Container
(
color:
Colors
.
red
,
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
red
,
height:
128.0
,
width:
double
.
infinity
,
)
,
height:
128.0
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
),
child:
Container
(
Container
(
color:
Colors
.
orange
,
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
orange
,
height:
128.0
,
width:
double
.
infinity
,
)
,
height:
128.0
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
),
child:
Container
(
Container
(
color:
Colors
.
green
,
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
green
,
height:
128.0
,
width:
double
.
infinity
,
)
,
height:
128.0
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
),
child:
Container
(
Container
(
color:
Colors
.
blue
,
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
blue
,
height:
128.0
,
width:
double
.
infinity
,
)
,
height:
128.0
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
),
child:
Container
(
Container
(
color:
Colors
.
yellow
,
child:
Container
(
width:
double
.
infinity
,
color:
Colors
.
yellow
,
height:
128.0
,
width:
double
.
infinity
,
)
,
height:
128.0
,
padding:
const
EdgeInsets
.
all
(
8.0
)
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
Container
(
),
child:
const
TextField
(
minLines:
2
,
maxLines:
10
),
Container
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
TextField
(
minLines:
2
,
maxLines:
10
,
),
),
padding:
const
EdgeInsets
.
all
(
8.0
),
TestTextField
(),
),
],
TestTextField
(),
),
],
),
)),
floatingActionButton:
FloatingActionButton
(
floatingActionButton:
FloatingActionButton
(
onPressed:
_incrementCounter
,
onPressed:
_incrementCounter
,
tooltip:
'Increment'
,
tooltip:
'Increment'
,
child:
Icon
(
Icons
.
add
),
child:
Icon
(
Icons
.
add
),
),
// This trailing comma makes auto-formatting nicer for build methods.
),
);
);
}
}
}
}
...
@@ -123,25 +113,24 @@ class TestTextField extends StatefulWidget {
...
@@ -123,25 +113,24 @@ class TestTextField extends StatefulWidget {
class
_TestTextFieldState
extends
State
<
TestTextField
>
{
class
_TestTextFieldState
extends
State
<
TestTextField
>
{
FocusNode
_node
;
FocusNode
_node
;
PersistentBottomSheetController
_controller
;
PersistentBottomSheetController
<
dynamic
>
_controller
;
@override
@override
void
initState
()
{
void
initState
()
{
// TODO: implement initState
super
.
initState
();
super
.
initState
();
_node
=
FocusNode
();
_node
=
FocusNode
();
_node
.
addListener
(()
{
_node
.
addListener
(()
{
if
(
_node
.
hasFocus
)
{
if
(
_node
.
hasFocus
)
{
print
(
'showBottomSheet'
);
print
(
'showBottomSheet'
);
_controller
=
Scaffold
.
of
(
context
)
_controller
=
Scaffold
.
of
(
context
).
showBottomSheet
<
dynamic
>(
.
showBottomSheet
<
dynamic
>((
BuildContext
ctx
)
=>
Container
(
(
BuildContext
ctx
)
=>
Container
(
width:
double
.
infinity
,
width:
double
.
infinity
,
height:
36.0
,
height:
36.0
,
color:
Colors
.
deepPurple
,
color:
Colors
.
deepPurple
,
));
),
);
}
else
{
}
else
{
if
(
_controller
!=
null
)
{
if
(
_controller
!=
null
)
{
//Navigator.of(context).pop();
print
(
'closeBottomSheet'
);
print
(
'closeBottomSheet'
);
_controller
.
close
();
_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