【发布时间】:2021-05-06 07:00:25
【问题描述】:
我想用 Cloud Firestore 创建旋转木马滑块。我创建了名为“slider”的云 Firestore 集合,我有两个字段,一个是“image”,另一个是“url”。
现在我需要在我的轮播滑块中流式传输 Firestore 集合,当用户单击图像时,想要启动 url。
我的轮播滑块代码
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
class Dashboard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
children: <Widget>[
SizedBox(height: 15.0),
CarouselSlider(
options: CarouselOptions(
height: 400.0,
enlargeCenterPage: true,
autoPlay: true,
aspectRatio: 16 / 9,
autoPlayCurve: Curves.fastOutSlowIn,
enableInfiniteScroll: true,
autoPlayAnimationDuration: Duration(milliseconds: 800),
viewportFraction: 0.8),
items: [
Container(
margin: EdgeInsets.all(5.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: AssetImage('$show Firestore image'),
onPressed: () {
launchURL(
"$ launch firestore url");
}
fit: BoxFit.cover,
),
),
),
],
),
],
);
}
}
谁能指导我?
【问题讨论】:
标签: flutter google-cloud-firestore slider carousel