这里我想把share image它打通API。我尝试了不同的方法来实现此功能,但没有得到任何解决方案,因为每个解决方案仅适用于一张图像。
确切地说,我从中获取了多个图像,然后在下一页中Url打开任何特定图像。image所以,我想要我在另一个页面中打开的share内容image。
我尝试过,sharing image但我做不到。每当我尝试share这样做时image,Image url share都sharing可以选择device,但我share image不想要我URl如何image才能做到这一点?
当我尝试在 firestore 中获取不存在的数据时,我遇到了 StreamProvider 的问题。
Stream<CollectedItem> streamCollectedItem(String id,int category)
{
return _db
.collection('users')
.document(id)
.collection('CollectedItems').where('category', isEqualTo: category)
.limit(1)
.snapshots()
.map((snap) => CollectedItem.fromFirestore(snap.documents.first));
}
Run Code Online (Sandbox Code Playgroud)
我像这样调用这个函数:
return StreamProvider<CollectedItem>.value(
value: db.streamCollectedItem(userID,collectMeNotification.category),
child: AlertDialog(
title: Text('Quantité'),
content: SingleChildScrollView(
child: popUp(collectMeNotification,userID)
),
Run Code Online (Sandbox Code Playgroud)
但是我遇到了“没有提供 catchError”的问题,因为我正在将我的流与不存在的数据链接起来。
我怎样才能解决这个问题 ?
我试图从应用程序主页上 PopupMenuButton 列表上的“注销”按钮导航回登录页面。我尝试配置的“注销”按钮如下所示:
简化的代码如下所示:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home Page'),
actions: <Widget>[
PopupMenuButton<String>(
onSelected: choiceAction,
itemBuilder: (BuildContext context) {
return MenuOptions.choices.map((String choice){
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
Run Code Online (Sandbox Code Playgroud)
并 onSelected调用以下内容choiceAction:
void choiceAction(String choice) {
setState() {
if (choice == MenuOptions.SignOut) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => LoginPage()),
);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我面临的问题是它context在 Navigator.push 中说未定义。我不确定我是否使用Widget build(BuildContext context)or中定义的上下文itemBuilder: (BuildContext context),并且我不知道如何修复其未定义的错误以使其使用在 中调用的定义onSelected。
我的目标是像这样创造
我希望我的图像显示在白色大容器和背景中
我试着这样做
Stack(
overflow: Overflow.clip,
alignment: AlignmentDirectional.topCenter,
fit: StackFit.loose,
children: <Widget>[
Container(
height: 458.4,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20)
)
),
),
GFAvatar(
backgroundImage:AssetImage(url),
shape: GFAvatarShape.standard,
radius: 70,
borderRadius: BorderRadius.circular(20),
)
],
),
]
Run Code Online (Sandbox Code Playgroud)
并且不工作它仅堆叠在容器中