File tree Expand file tree Collapse file tree 7 files changed +28
-12
lines changed Expand file tree Collapse file tree 7 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,13 @@ class NavigatorUtils {
155155 }
156156
157157 ///搜索
158- static Future goSearchPage (BuildContext context) {
158+ static Future goSearchPage (BuildContext context, Offset centerPosition ) {
159159 return showGeneralDialog (
160160 context: context,
161161 pageBuilder: (BuildContext buildContext, Animation <double > animation,
162162 Animation <double > secondaryAnimation) {
163163 return Builder (builder: (BuildContext context) {
164- return pageContainer (SearchPage ());
164+ return pageContainer (SearchPage (centerPosition ));
165165 });
166166 },
167167 barrierDismissible: false ,
Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ class _HomePageState extends State<HomePage> {
9595 GSYLocalizations .of (context).currentLocalized.app_name,
9696 iconData: GSYICons .MAIN_SEARCH ,
9797 needRightLocalIcon: true ,
98- onPressed : () {
99- NavigatorUtils .goSearchPage (context);
98+ onRightIconPressed : (centerPosition ) {
99+ NavigatorUtils .goSearchPage (context, centerPosition );
100100 },
101101 ),
102102 ),
Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ class _IssueDetailPageState extends State<IssueDetailPage>
376376 rightWidget: widgetContent,
377377 needRightLocalIcon: widget.needHomeIcon,
378378 iconData: GSYICons .HOME ,
379- onPressed : () {
379+ onRightIconPressed : (_ ) {
380380 NavigatorUtils .goReposDetail (
381381 context, widget.userName, widget.reposName);
382382 },
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ class _NotifyPageState extends State<NotifyPage>
127127 GSYLocalizations .i18n (context).notify_title,
128128 iconData: GSYICons .NOTIFY_ALL_READ ,
129129 needRightLocalIcon: true ,
130- onPressed : () {
130+ onRightIconPressed : (_ ) {
131131 CommonUtils .showLoadingDialog (context);
132132 UserDao .setAllNotificationAsReadDao ().then ((res) {
133133 Navigator .pop (context);
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ class _PushDetailPageState extends State<PushDetailPage>
132132 rightWidget: widgetContent,
133133 needRightLocalIcon: widget.needHomeIcon,
134134 iconData: GSYICons .HOME ,
135- onPressed : () {
135+ onRightIconPressed : (_ ) {
136136 NavigatorUtils .goReposDetail (
137137 context, widget.userName, widget.reposName);
138138 },
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ import 'package:gsy_github_app_flutter/page/user/widget/user_item.dart';
1919 * on 2018/7/24.
2020 */
2121class SearchPage extends StatefulWidget {
22+ final Offset centerPosition;
23+
24+ SearchPage (this .centerPosition);
25+
2226 @override
2327 _SearchPageState createState () => _SearchPageState ();
2428}
@@ -145,8 +149,7 @@ class _SearchPageState extends State<SearchPage>
145149 child: CRAnimation (
146150 minR: MediaQuery .of (context).size.height - 8 ,
147151 maxR: 0 ,
148- offset: Offset (MediaQuery .of (context).size.width - 50 ,
149- MediaQuery .of (context).padding.top - 10 ),
152+ offset: widget.centerPosition,
150153 animation: animation,
151154 child: new Scaffold (
152155 resizeToAvoidBottomPadding: false ,
Original file line number Diff line number Diff line change @@ -10,15 +10,17 @@ class GSYTitleBar extends StatelessWidget {
1010
1111 final IconData iconData;
1212
13- final VoidCallback onPressed ;
13+ final ValueChanged onRightIconPressed ;
1414
1515 final bool needRightLocalIcon;
1616
1717 final Widget rightWidget;
1818
19+ final GlobalKey rightKey = GlobalKey ();
20+
1921 GSYTitleBar (this .title,
2022 {this .iconData,
21- this .onPressed ,
23+ this .onRightIconPressed ,
2224 this .needRightLocalIcon = false ,
2325 this .rightWidget});
2426
@@ -30,9 +32,20 @@ class GSYTitleBar extends StatelessWidget {
3032 ? new IconButton (
3133 icon: new Icon (
3234 iconData,
35+ key: rightKey,
3336 size: 19.0 ,
3437 ),
35- onPressed: onPressed)
38+ onPressed: () {
39+ RenderBox renderBox2 =
40+ rightKey.currentContext? .findRenderObject ();
41+ var position = renderBox2.localToGlobal (Offset .zero);
42+ var size = renderBox2.size;
43+ var centerPosition = Offset (
44+ position.dx + size.width / 2 ,
45+ position.dy + size.height / 2 ,
46+ );
47+ onRightIconPressed? .call (centerPosition);
48+ })
3649 : new Container ();
3750 }
3851 return Container (
You can’t perform that action at this time.
0 commit comments