dart format
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -14,10 +13,11 @@ class JoinChat extends SearchDelegate<String> {
|
||||
|
||||
@override
|
||||
List<Widget>? buildActions(BuildContext context) => [
|
||||
if(future != null && query.isNotEmpty) FutureBuilder(
|
||||
if (future != null && query.isNotEmpty)
|
||||
FutureBuilder(
|
||||
future: future!.value,
|
||||
builder: (context, snapshot) {
|
||||
if(snapshot.connectionState != ConnectionState.done) {
|
||||
if (snapshot.connectionState != ConnectionState.done) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Center(child: AppProgressIndicator.medium()),
|
||||
@@ -26,17 +26,18 @@ class JoinChat extends SearchDelegate<String> {
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
if(query.isNotEmpty) IconButton(onPressed: () => query = '', icon: const Icon(Icons.delete)),
|
||||
];
|
||||
if (query.isNotEmpty)
|
||||
IconButton(onPressed: () => query = '', icon: const Icon(Icons.delete)),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget? buildLeading(BuildContext context) => null;
|
||||
|
||||
@override
|
||||
Widget buildResults(BuildContext context) {
|
||||
if(future != null) future!.cancel();
|
||||
if (future != null) future!.cancel();
|
||||
|
||||
if(query.isEmpty) {
|
||||
if (query.isEmpty) {
|
||||
return const PlaceholderView(
|
||||
text: 'Suche nach benutzern',
|
||||
icon: Icons.person_search_outlined,
|
||||
@@ -47,13 +48,15 @@ class JoinChat extends SearchDelegate<String> {
|
||||
return FutureBuilder<AutocompleteResponse>(
|
||||
future: future!.value,
|
||||
builder: (context, snapshot) {
|
||||
if(snapshot.hasData) {
|
||||
if (snapshot.hasData) {
|
||||
return ListView.builder(
|
||||
itemCount: snapshot.data!.data.length,
|
||||
itemBuilder: (context, index) {
|
||||
var object = snapshot.data!.data[index];
|
||||
var circleAvatar = CircleAvatar(
|
||||
foregroundImage: Image.network('https://${EndpointData().nextcloud().full()}/avatar/${object.id}/128').image,
|
||||
foregroundImage: Image.network(
|
||||
'https://${EndpointData().nextcloud().full()}/avatar/${object.id}/128',
|
||||
).image,
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Colors.white,
|
||||
child: const Icon(Icons.person),
|
||||
@@ -67,9 +70,9 @@ class JoinChat extends SearchDelegate<String> {
|
||||
close(context, object.id);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else if(snapshot.hasError) {
|
||||
} else if (snapshot.hasError) {
|
||||
return PlaceholderView(
|
||||
icon: Icons.search_off,
|
||||
text: errorToUserMessage(snapshot.error),
|
||||
@@ -83,5 +86,4 @@ class JoinChat extends SearchDelegate<String> {
|
||||
|
||||
@override
|
||||
Widget buildSuggestions(BuildContext context) => buildResults(context);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user