fix(ui): move tap region to wrap autocomplete optionsViewBuilder
This commit is contained in:
@@ -507,11 +507,13 @@ class _StreamAutocompleteState extends State<StreamAutocomplete> {
|
|||||||
final anchor = widget.optionsAlignment._toAnchor();
|
final anchor = widget.optionsAlignment._toAnchor();
|
||||||
final shouldShowOptions = _shouldShowOptions;
|
final shouldShowOptions = _shouldShowOptions;
|
||||||
final optionViewBuilder = shouldShowOptions
|
final optionViewBuilder = shouldShowOptions
|
||||||
? _currentTrigger!.optionsViewBuilder(
|
? TextFieldTapRegion(
|
||||||
context,
|
child: _currentTrigger!.optionsViewBuilder(
|
||||||
_currentQuery!,
|
context,
|
||||||
_messageEditingController,
|
_currentQuery!,
|
||||||
)
|
_messageEditingController,
|
||||||
|
),
|
||||||
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return PortalTarget(
|
return PortalTarget(
|
||||||
@@ -610,34 +612,32 @@ class StreamAutocompleteOptions<T extends Object> extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final height = MediaQuery.of(context).size.height;
|
final height = MediaQuery.of(context).size.height;
|
||||||
final colorTheme = StreamChatTheme.of(context).colorTheme;
|
final colorTheme = StreamChatTheme.of(context).colorTheme;
|
||||||
return TextFieldTapRegion(
|
return Card(
|
||||||
child: Card(
|
margin: margin,
|
||||||
margin: margin,
|
elevation: elevation,
|
||||||
elevation: elevation,
|
color: color ?? colorTheme.barsBg,
|
||||||
color: color ?? colorTheme.barsBg,
|
shape: shape,
|
||||||
shape: shape,
|
clipBehavior: clipBehavior,
|
||||||
clipBehavior: clipBehavior,
|
child: Column(
|
||||||
child: Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
children: [
|
if (headerBuilder != null) ...[
|
||||||
if (headerBuilder != null) ...[
|
headerBuilder!(context),
|
||||||
headerBuilder!(context),
|
const Divider(height: 0),
|
||||||
const Divider(height: 0),
|
|
||||||
],
|
|
||||||
LimitedBox(
|
|
||||||
maxHeight: maxHeight ?? height * 0.5,
|
|
||||||
child: ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
itemCount: options.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final option = options.elementAt(index);
|
|
||||||
return optionBuilder(context, option);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
LimitedBox(
|
||||||
|
maxHeight: maxHeight ?? height * 0.5,
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
itemCount: options.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final option = options.elementAt(index);
|
||||||
|
return optionBuilder(context, option);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user