【发布时间】:2020-02-04 09:44:50
【问题描述】:
我最近学习了开发应用程序,我在任务应用程序中添加 Firestore 用户帐户有困难,我使用 Flutter 和flutter_chips_input plugins。有解决这个问题的例子吗?
ChipsInput(
initialValue: [
AppProfile('John Doe', 'jdoe@flutter.io', 'https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX4057996.jpg')
],
decoration: InputDecoration(
labelText: "Select People",
),
maxChips: 3,
findSuggestions: (String query) {
if (query.length != 0) {
var lowercaseQuery = query.toLowerCase();
return mockResults.where((profile) {
return profile.name.toLowerCase().contains(query.toLowerCase()) || profile.email.toLowerCase().contains(query.toLowerCase());
}).toList(growable: false)
..sort((a, b) => a.name
.toLowerCase()
.indexOf(lowercaseQuery)
.compareTo(b.name.toLowerCase().indexOf(lowercaseQuery)));
} else {
return const <AppProfile>[];
}
},
onChanged: (data) {
print(data);
},
chipBuilder: (context, state, profile) {
return InputChip(
key: ObjectKey(profile),
label: Text(profile.name),
avatar: CircleAvatar(
backgroundImage: NetworkImage(profile.imageUrl),
),
onDeleted: () => state.deleteChip(profile),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
},
suggestionBuilder: (context, state, profile) {
return ListTile(
key: ObjectKey(profile),
leading: CircleAvatar(
backgroundImage: NetworkImage(profile.imageUrl),
),
title: Text(profile.name),
subtitle: Text(profile.email),
onTap: () => state.selectSuggestion(profile),
);
},
)
【问题讨论】:
-
将 Firestore 用户帐户添加到任务应用程序这是什么意思?
-
抱歉,我的意思是我在 Firestore 中有一个用户,想将该用户添加到我的新任务应用中
-
username "msoleh" email "msoleh399@gmail.com" fullName "Muhammad Solihin" id "106807126702075940257" photoUrl "lh5.googleusercontent.com/-PMvWjGkMFp0/AAAAAAAAAAI/AAAAAAAAAAA/…" (string) status "" timestamp 2020 年 1 月 15 日 4:18 :14 PM UTC+7
-
您想用现有用户填充小部件吗?
-
@easeccy 是的,怎么做?
标签: flutter google-cloud-firestore