Autocompletion: Show a bit more options

This is still just a Poc
This commit is contained in:
Vishesh Handa
2021-02-02 15:53:30 +01:00
parent df6cba7098
commit 9d230eebdb

View File

@ -68,7 +68,7 @@ class _AutoCompletionWidgetState extends State<AutoCompletionWidget> {
if (prefix == "\n") { if (prefix == "\n") {
// Pressed Enter // Pressed Enter
} else { } else {
_showOverlayTag(context, text.substring(0, range.start)); _showOverlayTag(context, text.substring(0, range.start - 1));
} }
} }
@ -104,6 +104,18 @@ class _AutoCompletionWidgetState extends State<AutoCompletionWidget> {
//print("Painter ${painter.width} $height"); //print("Painter ${painter.width} $height");
var tags = ['Hello', 'Howdy', 'Pooper'];
var list = Column(
children: [
for (var tag in tags)
Padding(
padding: const EdgeInsets.all(4.0),
child: Text('#$tag', style: const TextStyle(fontSize: 20.0)),
),
],
crossAxisAlignment: CrossAxisAlignment.start,
);
_hideOverlay(); _hideOverlay();
overlayEntry = OverlayEntry(builder: (context) { overlayEntry = OverlayEntry(builder: (context) {
return Positioned( return Positioned(
@ -112,15 +124,10 @@ class _AutoCompletionWidgetState extends State<AutoCompletionWidget> {
left: widget.textFieldFocusNode.offset.dx + width, left: widget.textFieldFocusNode.offset.dx + width,
// Tag code. // Tag code.
child: const Material( child: Material(
elevation: 4.0, elevation: 4.0,
color: Colors.lightBlueAccent, color: Colors.grey[200],
child: Text( child: list,
'Show tag here',
style: TextStyle(
fontSize: 20.0,
),
),
), ),
); );
}); });