Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 4.69 KB | None | 0 0
  1.     return Scaffold(
  2.       body: Center(
  3.         child: FutureBuilder(
  4.           ///If future is null then API will not be called as soon as the screen
  5.           ///loads. This can be used to make this Future Builder dependent
  6.           future: _controllerPresenter.getControllers("1"), //TODO: MAKE THIS NUMBER DYNAMIC
  7.           builder: (context, snapshot) {
  8.             switch (snapshot.connectionState) {
  9.  
  10.             ///when the future is null
  11.               case ConnectionState.none:
  12.                 return Text(
  13.                   'No Internet Connection',
  14.                   textAlign: TextAlign.left,
  15.                 );
  16.               case ConnectionState.active:
  17.  
  18.               ///when data is being fetched
  19.               case ConnectionState.waiting:
  20.                 return CircularProgressIndicator(
  21.                     valueColor: AlwaysStoppedAnimation<Color>(Colors.blue));
  22.               case ConnectionState.done:
  23.                 return ListView.builder(
  24.                   itemCount:
  25.                   snapshot.hasError ? 0 : snapshot.data.getObjLengthSite,
  26.                   itemBuilder: (context, index) {
  27.  
  28.                     return InkWell(
  29.                       splashColor: Colors.blue.withAlpha(30),
  30.                       child: Card(
  31.                         elevation: 3,
  32.                         child: Container(
  33.                           height: 100.0,
  34.                           child: Row(
  35.                             children: <Widget>[
  36.                               Container(
  37.                                 height: 150.0,
  38.                                 width: 70.0,
  39.                                 decoration: BoxDecoration(
  40.                                     borderRadius: BorderRadius.only(
  41.                                         bottomLeft: Radius.circular(5),
  42.                                         topLeft: Radius.circular(5)
  43.                                     ),
  44.                                     image: DecorationImage(
  45.                                         fit: BoxFit.cover,
  46.                                         image: AssetImage('assets/login_background.jpg')
  47.                                     )
  48.                                 ),
  49.                               ),
  50.                               Container(
  51.                                 height: 100,
  52.                                 child: Padding(
  53.                                   padding: EdgeInsets.fromLTRB(10, 2, 0, 0),
  54.                                   child: Column(
  55.                                     crossAxisAlignment: CrossAxisAlignment.start,
  56.                                     children: <Widget>[
  57.                                       Text(
  58.                                         snapshot.data.getObj[index]["name"],
  59.                                       ),
  60.                                       Padding(
  61.                                         padding: EdgeInsets.fromLTRB(0, 3, 0, 3),
  62.                                         child: Container(
  63.                                           // width: 100,
  64.                                           //padding: EdgeInsets.fromLTRB(3.0, 2.0, 3.0, 2.0),
  65. //                                          decoration: BoxDecoration(
  66. //                                              border: Border.all(color: Colors.white),
  67. //                                              borderRadius: BorderRadius.all(Radius.circular(10))
  68. //                                          ),
  69.                                           child: Text("Huston, Tx",textAlign: TextAlign.center,),
  70.                                         ),
  71.                                       ),
  72.                                       Padding(
  73.                                         padding: EdgeInsets.fromLTRB(0, 10, 0, 2),
  74.                                         child: Container(
  75.                                           width: 260,
  76.                                           //TODO: MAKE THIS DYNAMIC
  77.                                           child: Text("Placement holder Text",style: TextStyle(
  78.                                               fontSize: 15,
  79.                                               color: Color.fromARGB(255, 48, 48, 54)
  80.                                           ),),
  81.                                         ),
  82.                                       )
  83.                                     ],
  84.                                   ),
  85.                                 ),
  86.                               )
  87.                             ],
  88.                           ),
  89.                         ),
  90.                       ),
  91.                     );
  92.                   },
  93.                 );
  94.             }
  95.             return CircularProgressIndicator();
  96.           },
  97.         ),
  98.       ),
  99.     );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement