@@ -579,11 +579,10 @@ class _SearchViewRoute extends PopupRoute<_SearchViewRoute> {
579
579
viewHeaderTextStyle: viewHeaderTextStyle,
580
580
viewHeaderHintStyle: viewHeaderHintStyle,
581
581
dividerColor: dividerColor,
582
- viewConstraints: viewConstraints,
583
582
showFullScreenView: showFullScreenView,
584
583
animation: curvedAnimation,
585
- getRect: getRect,
586
584
topPadding: topPadding,
585
+ viewMaxWidth: _rectTween.end! .width,
587
586
viewRect: viewRect,
588
587
viewDefaults: viewDefaults,
589
588
viewTheme: viewTheme,
@@ -616,11 +615,10 @@ class _ViewContent extends StatefulWidget {
616
615
this .viewHeaderTextStyle,
617
616
this .viewHeaderHintStyle,
618
617
this .dividerColor,
619
- this .viewConstraints,
620
618
required this .showFullScreenView,
621
- required this .getRect,
622
619
required this .topPadding,
623
620
required this .animation,
621
+ required this .viewMaxWidth,
624
622
required this .viewRect,
625
623
required this .viewDefaults,
626
624
required this .viewTheme,
@@ -641,11 +639,10 @@ class _ViewContent extends StatefulWidget {
641
639
final TextStyle ? viewHeaderTextStyle;
642
640
final TextStyle ? viewHeaderHintStyle;
643
641
final Color ? dividerColor;
644
- final BoxConstraints ? viewConstraints;
645
642
final bool showFullScreenView;
646
- final ValueGetter <Rect ?> getRect;
647
643
final double topPadding;
648
644
final Animation <double > animation;
645
+ final double viewMaxWidth;
649
646
final Rect viewRect;
650
647
final SearchViewThemeData viewDefaults;
651
648
final SearchViewThemeData viewTheme;
@@ -690,9 +687,11 @@ class _ViewContentState extends State<_ViewContent> {
690
687
result = widget.suggestionsBuilder (context, _controller);
691
688
final Size updatedScreenSize = MediaQuery .of (context).size;
692
689
693
- if (_screenSize != updatedScreenSize && widget.showFullScreenView ) {
690
+ if (_screenSize != updatedScreenSize) {
694
691
_screenSize = updatedScreenSize;
695
- _viewRect = Offset .zero & _screenSize! ;
692
+ if (widget.showFullScreenView) {
693
+ _viewRect = Offset .zero & _screenSize! ;
694
+ }
696
695
}
697
696
}
698
697
@@ -782,56 +781,64 @@ class _ViewContentState extends State<_ViewContent> {
782
781
color: effectiveBackgroundColor,
783
782
surfaceTintColor: effectiveSurfaceTint,
784
783
elevation: effectiveElevation,
785
- child: FadeTransition (
786
- opacity: CurvedAnimation (
787
- parent: widget.animation,
788
- curve: _kViewIconsFadeOnInterval,
789
- reverseCurve: _kViewIconsFadeOnInterval.flipped,
790
- ),
791
- child: Column (
792
- crossAxisAlignment: CrossAxisAlignment .stretch,
793
- children: < Widget > [
794
- Padding (
795
- padding: EdgeInsets .only (top: widget.topPadding),
796
- child: SafeArea (
797
- top: false ,
798
- bottom: false ,
799
- child: SearchBar (
800
- constraints: widget.showFullScreenView ? BoxConstraints (minHeight: _SearchViewDefaultsM3 .fullScreenBarHeight) : null ,
801
- focusNode: _focusNode,
802
- leading: widget.viewLeading ?? defaultLeading,
803
- trailing: widget.viewTrailing ?? defaultTrailing,
804
- hintText: widget.viewHintText,
805
- backgroundColor: const MaterialStatePropertyAll <Color >(Colors .transparent),
806
- overlayColor: const MaterialStatePropertyAll <Color >(Colors .transparent),
807
- elevation: const MaterialStatePropertyAll <double >(0.0 ),
808
- textStyle: MaterialStatePropertyAll <TextStyle ?>(effectiveTextStyle),
809
- hintStyle: MaterialStatePropertyAll <TextStyle ?>(effectiveHintStyle),
810
- controller: _controller,
811
- onChanged: (_) {
812
- updateSuggestions ();
813
- },
814
- ),
815
- ),
784
+ child: ClipRect (
785
+ clipBehavior: Clip .antiAlias,
786
+ child: OverflowBox (
787
+ alignment: Alignment .topLeft,
788
+ maxWidth: math.min (widget.viewMaxWidth, _screenSize! .width),
789
+ minWidth: 0 ,
790
+ child: FadeTransition (
791
+ opacity: CurvedAnimation (
792
+ parent: widget.animation,
793
+ curve: _kViewIconsFadeOnInterval,
794
+ reverseCurve: _kViewIconsFadeOnInterval.flipped,
816
795
),
817
- FadeTransition (
818
- opacity: CurvedAnimation (
819
- parent: widget.animation,
820
- curve: _kViewDividerFadeOnInterval,
821
- reverseCurve: _kViewFadeOnInterval.flipped,
822
- ),
823
- child: viewDivider),
824
- Expanded (
825
- child: FadeTransition (
826
- opacity: CurvedAnimation (
827
- parent: widget.animation,
828
- curve: _kViewListFadeOnInterval,
829
- reverseCurve: _kViewListFadeOnInterval.flipped,
796
+ child: Column (
797
+ crossAxisAlignment: CrossAxisAlignment .stretch,
798
+ children: < Widget > [
799
+ Padding (
800
+ padding: EdgeInsets .only (top: widget.topPadding),
801
+ child: SafeArea (
802
+ top: false ,
803
+ bottom: false ,
804
+ child: SearchBar (
805
+ constraints: widget.showFullScreenView ? BoxConstraints (minHeight: _SearchViewDefaultsM3 .fullScreenBarHeight) : null ,
806
+ focusNode: _focusNode,
807
+ leading: widget.viewLeading ?? defaultLeading,
808
+ trailing: widget.viewTrailing ?? defaultTrailing,
809
+ hintText: widget.viewHintText,
810
+ backgroundColor: const MaterialStatePropertyAll <Color >(Colors .transparent),
811
+ overlayColor: const MaterialStatePropertyAll <Color >(Colors .transparent),
812
+ elevation: const MaterialStatePropertyAll <double >(0.0 ),
813
+ textStyle: MaterialStatePropertyAll <TextStyle ?>(effectiveTextStyle),
814
+ hintStyle: MaterialStatePropertyAll <TextStyle ?>(effectiveHintStyle),
815
+ controller: _controller,
816
+ onChanged: (_) {
817
+ updateSuggestions ();
818
+ },
819
+ ),
820
+ ),
830
821
),
831
- child: viewBuilder (result),
832
- ),
822
+ FadeTransition (
823
+ opacity: CurvedAnimation (
824
+ parent: widget.animation,
825
+ curve: _kViewDividerFadeOnInterval,
826
+ reverseCurve: _kViewFadeOnInterval.flipped,
827
+ ),
828
+ child: viewDivider),
829
+ Expanded (
830
+ child: FadeTransition (
831
+ opacity: CurvedAnimation (
832
+ parent: widget.animation,
833
+ curve: _kViewListFadeOnInterval,
834
+ reverseCurve: _kViewListFadeOnInterval.flipped,
835
+ ),
836
+ child: viewBuilder (result),
837
+ ),
838
+ ),
839
+ ],
833
840
),
834
- ] ,
841
+ ) ,
835
842
),
836
843
),
837
844
),
0 commit comments