Skip to content

Commit

Permalink
autocomplete [nfc]: Cut "candidate" type param from AutocompleteField
Browse files Browse the repository at this point in the history
Now that AutocompleteView doesn't have such a type parameter,
AutocompleteField doesn't need it.
  • Loading branch information
gnprice authored and chrisbobbe committed Aug 23, 2024
1 parent 6dec95d commit e91694f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/widgets/autocomplete.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import 'package:flutter/material.dart';

import '../api/model/model.dart';
import 'content.dart';
import 'store.dart';
import '../model/autocomplete.dart';
import '../model/compose.dart';
import '../model/narrow.dart';
import 'compose_box.dart';

abstract class AutocompleteField<QueryT extends AutocompleteQuery, ResultT extends AutocompleteResult, CandidateT> extends StatefulWidget {
abstract class AutocompleteField<QueryT extends AutocompleteQuery, ResultT extends AutocompleteResult> extends StatefulWidget {
const AutocompleteField({
super.key,
required this.controller,
Expand All @@ -27,10 +26,10 @@ abstract class AutocompleteField<QueryT extends AutocompleteQuery, ResultT exten
AutocompleteView<QueryT, ResultT> initViewModel(BuildContext context);

@override
State<AutocompleteField<QueryT, ResultT, CandidateT>> createState() => _AutocompleteFieldState<QueryT, ResultT, CandidateT>();
State<AutocompleteField<QueryT, ResultT>> createState() => _AutocompleteFieldState<QueryT, ResultT>();
}

class _AutocompleteFieldState<QueryT extends AutocompleteQuery, ResultT extends AutocompleteResult, CandidateT> extends State<AutocompleteField<QueryT, ResultT, CandidateT>> with PerAccountStoreAwareStateMixin<AutocompleteField<QueryT, ResultT, CandidateT>> {
class _AutocompleteFieldState<QueryT extends AutocompleteQuery, ResultT extends AutocompleteResult> extends State<AutocompleteField<QueryT, ResultT>> with PerAccountStoreAwareStateMixin<AutocompleteField<QueryT, ResultT>> {
AutocompleteView<QueryT, ResultT>? _viewModel;

void _initViewModel() {
Expand Down Expand Up @@ -71,7 +70,7 @@ class _AutocompleteFieldState<QueryT extends AutocompleteQuery, ResultT extends
}

@override
void didUpdateWidget(covariant AutocompleteField<QueryT, ResultT, CandidateT> oldWidget) {
void didUpdateWidget(covariant AutocompleteField<QueryT, ResultT> oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.controller != oldWidget.controller) {
oldWidget.controller.removeListener(_handleControllerChange);
Expand Down Expand Up @@ -145,7 +144,7 @@ class _AutocompleteFieldState<QueryT extends AutocompleteQuery, ResultT extends
}
}

class ComposeAutocomplete extends AutocompleteField<MentionAutocompleteQuery, MentionAutocompleteResult, User> {
class ComposeAutocomplete extends AutocompleteField<MentionAutocompleteQuery, MentionAutocompleteResult> {
const ComposeAutocomplete({
super.key,
required this.narrow,
Expand Down Expand Up @@ -218,7 +217,7 @@ class ComposeAutocomplete extends AutocompleteField<MentionAutocompleteQuery, Me
}
}

class TopicAutocomplete extends AutocompleteField<TopicAutocompleteQuery, TopicAutocompleteResult, String> {
class TopicAutocomplete extends AutocompleteField<TopicAutocompleteQuery, TopicAutocompleteResult> {
const TopicAutocomplete({
super.key,
required this.streamId,
Expand Down

0 comments on commit e91694f

Please sign in to comment.