Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- return Scaffold(
- body: Center(
- child: FutureBuilder(
- ///If future is null then API will not be called as soon as the screen
- ///loads. This can be used to make this Future Builder dependent
- future: _controllerPresenter.getControllers("1"), //TODO: MAKE THIS NUMBER DYNAMIC
- builder: (context, snapshot) {
- switch (snapshot.connectionState) {
- ///when the future is null
- case ConnectionState.none:
- return Text(
- 'No Internet Connection',
- textAlign: TextAlign.left,
- );
- case ConnectionState.active:
- ///when data is being fetched
- case ConnectionState.waiting:
- return CircularProgressIndicator(
- valueColor: AlwaysStoppedAnimation<Color>(Colors.blue));
- case ConnectionState.done:
- return ListView.builder(
- itemCount:
- snapshot.hasError ? 0 : snapshot.data.getObjLengthSite,
- itemBuilder: (context, index) {
- return InkWell(
- splashColor: Colors.blue.withAlpha(30),
- child: Card(
- elevation: 3,
- child: Container(
- height: 100.0,
- child: Row(
- children: <Widget>[
- Container(
- height: 150.0,
- width: 70.0,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- bottomLeft: Radius.circular(5),
- topLeft: Radius.circular(5)
- ),
- image: DecorationImage(
- fit: BoxFit.cover,
- image: AssetImage('assets/login_background.jpg')
- )
- ),
- ),
- Container(
- height: 100,
- child: Padding(
- padding: EdgeInsets.fromLTRB(10, 2, 0, 0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- snapshot.data.getObj[index]["name"],
- ),
- Padding(
- padding: EdgeInsets.fromLTRB(0, 3, 0, 3),
- child: Container(
- // width: 100,
- //padding: EdgeInsets.fromLTRB(3.0, 2.0, 3.0, 2.0),
- // decoration: BoxDecoration(
- // border: Border.all(color: Colors.white),
- // borderRadius: BorderRadius.all(Radius.circular(10))
- // ),
- child: Text("Huston, Tx",textAlign: TextAlign.center,),
- ),
- ),
- Padding(
- padding: EdgeInsets.fromLTRB(0, 10, 0, 2),
- child: Container(
- width: 260,
- //TODO: MAKE THIS DYNAMIC
- child: Text("Placement holder Text",style: TextStyle(
- fontSize: 15,
- color: Color.fromARGB(255, 48, 48, 54)
- ),),
- ),
- )
- ],
- ),
- ),
- )
- ],
- ),
- ),
- ),
- );
- },
- );
- }
- return CircularProgressIndicator();
- },
- ),
- ),
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement