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:async';
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sendtrain/services/functional/debouncer.dart'; import 'package:sendtrain/services/functional/debouncer.dart';
@ -11,20 +10,22 @@ class Suggestion<T> {
Suggestion(this.type); 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 { class FormSearchInput extends StatefulWidget {
const FormSearchInput( const FormSearchInput(
{super.key, {super.key,
required this.sessionController, required this.controller,
required this.service, required this.service,
this.title, this.title,
this.callback, this.callback});
this.optionalPayload});
final String? title; final String? title;
final TextEditingController sessionController; final TextEditingController controller;
final dynamic service; final dynamic service;
final Function? callback; final Function? callback;
final dynamic optionalPayload;
@override @override
State<FormSearchInput> createState() => _FormSearchInputState(); State<FormSearchInput> createState() => _FormSearchInputState();
@ -78,7 +79,7 @@ class _FormSearchInputState extends State<FormSearchInput> {
return SearchAnchor( return SearchAnchor(
builder: (BuildContext context, SearchController controller) { builder: (BuildContext context, SearchController controller) {
return FormTextInput( return FormTextInput(
controller: widget.sessionController, controller: widget.controller,
title: widget.title ?? "", title: widget.title ?? "",
icon: Icon(Icons.search_rounded), icon: Icon(Icons.search_rounded),
maxLines: 2, maxLines: 2,

View File

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