Я создал ListView с AppBar с SearchIcon и значком фильтра на нем. При щелчке значка фильтра открывается диалог AlertDialogue. В этом AlertDialouge я хочу, чтобы пользователь мог пометить несколько опций фильтра и применить их к просмотру списка, нажав кнопку с надписью «все в порядке». Мой ListView - это тип, который расширяет State: class _CollectibleList<C extends Collectible> extends State<CollectibleList<C>>
Теперь я хочу добавить DialogAction
к действиям моего AlertDialog
, но я получаю следующую ошибку: The method 'DialogAction' isn't defined for the type '_CollectibleList'.Try correcting the name to the name of an existing method, or defining a method named 'DialogAction'.dart(undefined_method)
Мне кажется, что Импорт отсутствует, но я ничего не могу найти. Мой импорт:
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'collectible.dart';
...
Это кодовый код:
void _showAlertDialog(){
showDialog(
context: context,
builder: (BuildContext context){
return AlertDialog(
title: Text('Alert!'),
content: Text("content"),
actions: AlertDialog[
DialogAction("Okay")
],
);
},
);
}