_ChildEntry _newEntry( Widget child, AnimatedSwitcherTransitionBuilder builder, AnimationController controller, Animation <float> animation ) { _ChildEntry entry = new _ChildEntry( widgetChild: child, transition: KeyedSubtree.wrap(builder(child, animation), this._childNumber), animation: animation, controller: controller ); animation.addStatusListener((AnimationStatus status) => { if (status == AnimationStatus.dismissed) { this.setState(() => { D.assert(this.mounted); D.assert(this._outgoingEntries.Contains(entry)); this._outgoingEntries.Remove(entry); this._markChildWidgetCacheAsDirty(); }); controller.dispose(); } }); return(entry); }
public override Widget build(BuildContext context) { material_.debugCheckHasMaterialLocalizations(context); ThemeData theme = widget.del.appBarTheme(context); string searchFieldLabel = widget.del.searchFieldLabel ?? MaterialLocalizations.of(context).searchFieldLabel; Widget body = null; switch (widget.del._currentBody) { case _SearchBody.suggestions: body = new KeyedSubtree( key: new ValueKey <_SearchBody>(_SearchBody.suggestions), child: widget.del.buildSuggestions(context) ); break; case _SearchBody.results: body = new KeyedSubtree( key: new ValueKey <_SearchBody>(_SearchBody.results), child: widget.del.buildResults(context) ); break; } string routeName; switch (Theme.of(this.context).platform) { case RuntimePlatform.IPhonePlayer: case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: routeName = ""; break; case RuntimePlatform.Android: routeName = searchFieldLabel; break; } return(new Scaffold( appBar: new AppBar( backgroundColor: theme.primaryColor, iconTheme: theme.primaryIconTheme, textTheme: theme.primaryTextTheme, brightness: theme.primaryColorBrightness, leading: widget.del.buildLeading(context), title: new TextField( controller: widget.del._queryTextController, focusNode: focusNode, style: theme.textTheme.headline6, textInputAction: widget.del.textInputAction, keyboardType: widget.del.keyboardType, onSubmitted: (string _) => { widget.del.showResults(context); }, decoration: new InputDecoration( border: InputBorder.none, hintText: searchFieldLabel, hintStyle: theme.inputDecorationTheme.hintStyle ) ), actions: widget.del.buildActions(context) ), body: new AnimatedSwitcher( duration: new TimeSpan(0, 0, 0, 0, 300), child: body ) )); }