Last active
April 3, 2020 00:29
-
-
Save VB10/70ffded7867edd32e9e8b55c3a678d0f to your computer and use it in GitHub Desktop.
Shoppi - Home
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ShopView extends StatefulWidget { | |
| @override | |
| _ShopViewState createState() => _ShopViewState(); | |
| } | |
| class _ShopViewState extends BaseState<ShopView> { | |
| List<Product> subList = []; | |
| int currentPage = 0; | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| backgroundColor: currentTheme.primaryColor, | |
| body: PageView( | |
| controller: PageController(viewportFraction: pageViewHeight), | |
| onPageChanged: (value) => onPageChanged(value), | |
| scrollDirection: Axis.vertical, | |
| children: <Widget>[ | |
| ShopListView(isUserOnPage: isShopPage), | |
| ShopPaymentView() | |
| ], | |
| ), | |
| ); | |
| } | |
| bool get isShopPage => currentPage == PageViews.PRODUCT_LIST.index; | |
| void onPageChanged(int val) { | |
| setState(() { | |
| currentPage = val; | |
| }); | |
| } | |
| double get pageViewHeight => currentPage == 1 ? 0.8 : 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment