1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-25 15:42:28 +01:00

change all variables with name instance to instanceHost

This commit is contained in:
krawieck 2021-01-10 01:51:26 +01:00
parent 586f26c277
commit f80ab01e04
2 changed files with 20 additions and 16 deletions

View File

@ -11,15 +11,15 @@ import 'communities_list.dart';
import 'users_list.dart';
class SearchResultsPage extends HookWidget {
final String instance;
final String instanceHost;
final String query;
SearchResultsPage({
@required this.instance,
@required this.instanceHost,
@required this.query,
}) : assert(instance != null),
}) : assert(instanceHost != null),
assert(query != null),
assert(instance.isNotEmpty),
assert(instanceHost.isNotEmpty),
assert(query.isNotEmpty);
@override
@ -42,15 +42,19 @@ class SearchResultsPage extends HookWidget {
body: TabBarView(
children: [
_SearchResultsList(
instanceHost: instance, query: query, type: SearchType.posts),
instanceHost: instanceHost,
query: query,
type: SearchType.posts),
_SearchResultsList(
instanceHost: instance,
instanceHost: instanceHost,
query: query,
type: SearchType.comments),
_SearchResultsList(
instanceHost: instance, query: query, type: SearchType.users),
instanceHost: instanceHost,
query: query,
type: SearchType.users),
_SearchResultsList(
instanceHost: instance,
instanceHost: instanceHost,
query: query,
type: SearchType.communities),
],

View File

@ -15,7 +15,7 @@ class SearchTab extends HookWidget {
final searchInputController = useTextEditingController();
final accStore = useAccountsStore();
final instance = useState(accStore.instances.first);
final instanceHost = useState(accStore.instances.first);
useValueListenable(searchInputController);
return Scaffold(
@ -51,8 +51,8 @@ class SearchTab extends HookWidget {
),
Expanded(
child: SelectInstanceButton(
instance: instance.value,
onChange: (s) => instance.value = s,
instanceHost: instanceHost.value,
onChange: (s) => instanceHost.value = s,
),
),
],
@ -62,7 +62,7 @@ class SearchTab extends HookWidget {
onPressed: () => goTo(
context,
(c) => SearchResultsPage(
instance: instance.value,
instanceHost: instanceHost.value,
query: searchInputController.text,
)),
child: const Text('search'),
@ -76,9 +76,9 @@ class SearchTab extends HookWidget {
class SelectInstanceButton extends HookWidget {
final ValueChanged<String> onChange;
final String instance;
final String instanceHost;
const SelectInstanceButton(
{@required this.onChange, @required this.instance});
{@required this.onChange, @required this.instanceHost});
@override
Widget build(BuildContext context) {
@ -95,7 +95,7 @@ class SelectInstanceButton extends HookWidget {
children: [
for (final inst in accStore.instances)
ListTile(
leading: inst == instance
leading: inst == instanceHost
? Icon(
Icons.radio_button_on,
color: theme.accentColor,
@ -120,7 +120,7 @@ class SelectInstanceButton extends HookWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(instance),
Text(instanceHost),
const Icon(Icons.arrow_drop_down),
],
),