This commit is contained in:
Joshua Burman 2025-01-05 12:15:35 -05:00
parent ecc9aa3abc
commit fec4eaaf92
2 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:sendtrain/services/functional/debouncer.dart';
@ -11,20 +10,22 @@ class Suggestion<T> {
Suggestion(this.type);
}
// controller: manages the selected content
// service: manages the requests for the specific data to search against
// title: the title of the text input
// callback: the fuction called when a selection is made
class FormSearchInput extends StatefulWidget {
const FormSearchInput(
{super.key,
required this.sessionController,
required this.controller,
required this.service,
this.title,
this.callback,
this.optionalPayload});
this.callback});
final String? title;
final TextEditingController sessionController;
final TextEditingController controller;
final dynamic service;
final Function? callback;
final dynamic optionalPayload;
@override
State<FormSearchInput> createState() => _FormSearchInputState();
@ -78,7 +79,7 @@ class _FormSearchInputState extends State<FormSearchInput> {
return SearchAnchor(
builder: (BuildContext context, SearchController controller) {
return FormTextInput(
controller: widget.sessionController,
controller: widget.controller,
title: widget.title ?? "",
icon: Icon(Icons.search_rounded),
maxLines: 2,

View File

@ -183,7 +183,7 @@ class _SessionEditorState extends State<SessionEditor> {
}),
FormSearchInput(
title: 'Location (optional)',
sessionController: sessionCreateController['address']!,
controller: sessionCreateController['address']!,
service: GooglePlacesService(),
callback: (content, service) async {
if (content.imageReferences != null) {