Skip to content

Commit

Permalink
reverse=true workaround in Cart ListView is corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinmay-KB committed Apr 26, 2020
1 parent ab64612 commit ef49afe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion gogrocy/lib/core/services/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,13 @@ class Apis {
Future<cart_list> getCartList() async {
var client = new http.Client();
bool connectionState = await checkStatus();
String jwt=await _sharedPrefsService.getJWT();
if (connectionState) //TODO: Add a proper else return
{
var response = await client.post(cartList, headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer $TOKEN',
'Authorization': 'Bearer $jwt',
});
return cart_list.fromJson(json.decode(response.body));
} else
Expand Down
14 changes: 6 additions & 8 deletions gogrocy/lib/ui/views/cart/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,24 @@ class Cart extends StatelessWidget {
else if (model.state == ViewState.Intermediate) {
return ListView(
shrinkWrap: true,
reverse: true,
controller: scrollController,
children: <Widget>[
SizedBox(height: 50,),
CartBill(model.cartList,),
CartHeader(model: model.cartList,checkoutButtonPressed: (){scrollController.animateTo(scrollController.position.maxScrollExtent, duration: Duration(milliseconds: 500), curve: Curves.easeIn);print("Callback succeeds");},),
CartList(model, model.intermediateCartList),
CartHeader(model: model.cartList,checkoutButtonPressed: (){scrollController.animateTo(0, duration: Duration(milliseconds: 600), curve: Curves.easeIn);print("Callback succeeds");},),
CartBill(model.cartList,),
SizedBox(height: 50,),

],
);
} else
return ListView(
shrinkWrap: true,
reverse: true,
controller: scrollController,
children: <Widget>[
SizedBox(height: 50,),
CartBill(model.cartList),
CartHeader(model:model.cartList,checkoutButtonPressed:(){scrollController.animateTo(scrollController.position.maxScrollExtent, duration: Duration(milliseconds: 500), curve: Curves.easeIn);print("Callback succeeds");}),
CartList(model, model.cartList),
CartHeader(model:model.cartList,checkoutButtonPressed:(){scrollController.animateTo(0, duration: Duration(milliseconds: 600), curve: Curves.easeIn);print("Callback succeeds");}),
CartBill(model.cartList),
SizedBox(height: 50,),

],
);
Expand Down

0 comments on commit ef49afe

Please sign in to comment.