finish sender_list && plain-text-search
This commit is contained in:
60
flutter/lib/components/modals/filter_modal_searchplain.dart
Normal file
60
flutter/lib/components/modals/filter_modal_searchplain.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:simplecloudnotifier/pages/message_list/message_filter_chiplet.dart';
|
||||
import 'package:simplecloudnotifier/state/app_events.dart';
|
||||
|
||||
class FilterModalSearchPlain extends StatefulWidget {
|
||||
@override
|
||||
_FilterModalSearchPlainState createState() => _FilterModalSearchPlainState();
|
||||
}
|
||||
|
||||
class _FilterModalSearchPlainState extends State<FilterModalSearchPlain> {
|
||||
final _controller = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Search'),
|
||||
content: Container(
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: _controller,
|
||||
decoration: InputDecoration(hintText: "Search..."),
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Apply'),
|
||||
onPressed: _onOkay,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _onOkay() {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
List<MessageFilterChiplet> chiplets = [];
|
||||
if (_controller.text.isNotEmpty) {
|
||||
chiplets.add(MessageFilterChiplet(
|
||||
label: _controller.text,
|
||||
value: _controller.text,
|
||||
type: MessageFilterChipletType.plainSearch,
|
||||
));
|
||||
}
|
||||
|
||||
AppEvents().notifyFilterListeners([MessageFilterChipletType.plainSearch], chiplets);
|
||||
}
|
||||
}
|
@@ -73,15 +73,13 @@ class _FilterModalSendernameState extends State<FilterModalSendername> {
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Apply'),
|
||||
onPressed: () {
|
||||
onOkay();
|
||||
},
|
||||
onPressed: _onOkay,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void onOkay() {
|
||||
void _onOkay() {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
final chiplets = _selectedEntries
|
||||
|
Reference in New Issue
Block a user