浏览代码

fix navigator.push

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
a373d119
共有 4 个文件被更改,包括 18 次插入18 次删除
  1. 2
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  2. 2
      com.unity.uiwidgets/Runtime/material/popup_menu.cs
  3. 28
      com.unity.uiwidgets/Runtime/material/search.cs
  4. 4
      com.unity.uiwidgets/Runtime/widgets/navigator.cs

2
com.unity.uiwidgets/Runtime/material/dropdown.cs


barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel
);
Navigator.push(context, _dropdownRoute).then(newValue => {
Navigator.push<T>(context, _dropdownRoute).then(newValue => {
_DropdownRouteResult<T> value = newValue as _DropdownRouteResult<T>;
_dropdownRoute = null;
if (!mounted || newValue == null) {

2
com.unity.uiwidgets/Runtime/material/popup_menu.cs


}
public static partial class PopupMenuUtils {
public static Future<object> showMenu<T>(
public static Future<T> showMenu<T>(
BuildContext context,
RelativeRect position,
List<PopupMenuEntry<T>> items,

28
com.unity.uiwidgets/Runtime/material/search.cs


namespace Unity.UIWidgets.material {
public class SearchUtils {
public static Future<object> showSearch(
public static Future<T> showSearch<T>(
SearchDelegate del,
SearchDelegate<T> del,
string query = ""
) {
D.assert(del != null);

del._currentBody = _SearchBody.suggestions;
return Navigator.of(context).push(new _SearchPageRoute(
return Navigator.of(context).push<T>(new _SearchPageRoute<T>(
public abstract class SearchDelegate {
public abstract class SearchDelegate<T> {
public abstract Widget buildSuggestions(BuildContext context);
public abstract Widget buildResults(BuildContext context);
public abstract Widget buildLeading(BuildContext context);

set { _currentBodyNotifier.value = value; }
}
internal _SearchPageRoute _route;
internal _SearchPageRoute<T> _route;
}
enum _SearchBody {

class _SearchPageRoute : PageRoute {
public _SearchPageRoute(SearchDelegate del) {
class _SearchPageRoute<T> : PageRoute {
public _SearchPageRoute(SearchDelegate<T> del) {
D.assert(del != null);
D.assert(del._route == null,
() => $"The {this.del.GetType()} instance is currently used by another active " +

this.del._route = this;
}
public readonly SearchDelegate del;
public readonly SearchDelegate<T> del;
public override Color barrierColor {
get { return null; }

Animation<float> animation,
Animation<float> secondaryAnimation
) {
return new _SearchPage(
return new _SearchPage<T>(
del: del,
animation: animation
);

}
}
class _SearchPage : StatefulWidget {
class _SearchPage<T> : StatefulWidget {
SearchDelegate del,
SearchDelegate<T> del,
Animation<float> animation
) {
this.del = del;

public readonly SearchDelegate del;
public readonly SearchDelegate<T> del;
return new _SearchPageState();
return new _SearchPageState<T>();
class _SearchPageState : State<_SearchPage> {
class _SearchPageState<T> : State<_SearchPage<T>> {
public override void initState() {
base.initState();
queryTextController.addListener(_onQueryChanged);

4
com.unity.uiwidgets/Runtime/widgets/navigator.cs


return of(context).pushNamedAndRemoveUntil<T>(newRouteName, predicate, arguments: arguments);
}
public static Future<T> push<T>(BuildContext context, Route<T> route) {
public static Future<T> push<T>(BuildContext context, Route route) {
return of(context).push<T>(route);
}

return route.popped;
}
public Future<T> push<T>(Route<T> route) {
public Future<T> push<T>(Route route) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

正在加载...
取消
保存