CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2022-01-24
by masum billah sanjid

Original Post

Original - Posted on 2020-04-07
by user12208004



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

Try with this i slowed for 1 second because if i don't add this you will see always 0 .
import 'package:flutter/material.dart'; void main() => runApp(MaterialApp( debugShowCheckedModeBanner: false, home: idcard(), )); class idcard extends StatefulWidget { @override State<idcard> createState() => _idcardState(); } class _idcardState extends State<idcard> { int ballNumber = 0; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[800], floatingActionButton: FloatingActionButton( onPressed: () { setState(() { for (ballNumber = 0; ballNumber <= 5; ballNumber += 1); }); Future.delayed(Duration(seconds:1),(){ setState((){ ballNumber=0; }); }); }, backgroundColor: Colors.yellow[800], child: Icon(Icons.add), ), appBar: AppBar( backgroundColor: Colors.yellow[800], title: Text("Ball Counter"), centerTitle: true, elevation: 0.0, ), body: Padding( padding: EdgeInsets.fromLTRB(0, 50, 0, 0), child: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text("Ball number", textAlign: TextAlign.center, style: TextStyle(fontSize: 20, color: Colors.white)), SizedBox(height: 10), Text("$ballNumber", textAlign: TextAlign.center, style: TextStyle(fontSize: 90, color: Colors.yellow[800])), ], ), ), ), ); } }
najeira's solution is easy and simple, but you can get the same and more flexible result without touching index.
Instead of using listView, you could use **CustomScrollView & SliverList** which is functionally the same as listView.
``` return Scaffold( body: CustomScrollView( slivers: <Widget>[ SliverToBoxAdapter( // you could add any widget child: ListTile( leading: CircleAvatar( backgroundColor: Colors.transparent, ), title: Row( children: <Widget>[ Expanded(child: Text("First Name")), Expanded(child: Text("Last Name")), Expanded(child: Text("City")), Expanded(child: Text("Id")), ], ), ), ), SliverList( delegate: SliverChildBuilderDelegate( (context, index) { return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => APIDetailView(data[index])), ); }, child: ListTile( //return ListTile( leading: CircleAvatar( backgroundColor: Colors.blue, child: Text(data[index]["FirstName"][0]), ), title: Row( children: <Widget>[ Expanded(child: Text(data[index]["FirstName"])), Expanded(child: Text(data[index]["LastName"])), Expanded(child: Text(data[index]["Bill_City"])), Expanded(child: Text(data[index]["Customer_Id"])), ], ), ), ); }, childCount: data == null ? 0 : data.length, ), ), ], ), ); ```

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