CopyPastor

Detecting plagiarism made easy.

Score: 0.8052943348884583; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-02-11
by bangbang

Original Post

Original - Posted on 2018-10-17
by Ashutosh Sharma



            
Present in both answers; Present only in the new answer; Present only in the old answer;

So here's the solution. Basically, I looped through the document snapshot and saved the result in a list. Then, I set the list to the image.


Widget build(BuildContext context) { var idx = 1; return Container( child: FutureBuilder( future: getCarouselWidget(), builder: (context, AsyncSnapshot snapshot) { List<NetworkImage> list = new List<NetworkImage>(); if (snapshot.connectionState == ConnectionState.waiting) { return new CircularProgressIndicator(); } else { if (snapshot.hasError) { return new Text("fetch error"); } else {
//Create for loop and store the urls in the list for(int i = 0; i < snapshot.data[0].data.length; i++ ) { debugPrint("Index is " + idx.toString()); list.add(NetworkImage(snapshot.data[0].data["img_"+idx.toString()])); idx++; } return new Container( height: 250.0, child: new Carousel( boxFit: BoxFit.cover, images: list, <== Set the list here autoplay: true, dotSize: 4.0, indicatorBgPadding: 4.0, animationCurve: Curves.fastOutSlowIn, animationDuration: Duration(milliseconds: 1000), )); } } }), );
try this:
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; class PostGetter extends StatelessWidget { @override Widget build(BuildContext context) { // TODO: implement build return new Scaffold( body: new Container( child: new FutureBuilder( future: Firestore.instance .collection('post') .where('article', isEqualTo: 'lpquVtoRNsu0vBLjNByS') .getDocuments(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasData) { if (snapshot.data != null) { return new Column( children: <Widget>[ new Expanded( child: new ListView( children: snapshot.data.documents .map<Widget>((DocumentSnapshot document) { return new ListTile( title: new Text(document['comment']), subtitle: new Text(document['author']), ); }).toList(), ), ), ], ); } }else { return new CircularProgressIndicator(); } }),), ); } }
else should be on the snapshot.hasdata not on snapshot.data != null

        
Present in both answers; Present only in the new answer; Present only in the old answer;