Skip to content

Commit

Permalink
fix: disable buttons in refresh state
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafluri committed Jul 15, 2020
1 parent dc6ec56 commit 880527c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions lib/screens/home/components/product_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class ProductListTile extends StatelessWidget {
child: Container(
color: _underTarget ? Colors.green[800] : Colors.transparent,
child: ListTile(
enabled: refreshing,
title: Text(
product.getShortName(),
overflow: TextOverflow.ellipsis,
Expand All @@ -149,8 +148,8 @@ class ProductListTile extends StatelessWidget {
leading: _buildLeadingImage(),
trailing: _buildTrailing(),
contentPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 0),
onTap: _onTap,
onLongPress: _onLongPress,
onTap: refreshing ? null : _onTap,
onLongPress: refreshing ? null : _onLongPress,
),
),
actions: <Widget>[
Expand Down
14 changes: 8 additions & 6 deletions lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ class HomeScreenView extends WidgetView<HomeScreen, HomeScreenController> {

Widget _buildFAB(BuildContext context) {
return FloatingActionButton(
onPressed: state.iConnectivity
? state.addProductDialogue
: () {
Toast.show('Please ensure an internet connection', context,
duration: 3, gravity: Toast.BOTTOM);
},
onPressed: refreshing
? null
: state.iConnectivity
? state.addProductDialogue
: () {
Toast.show('Please ensure an internet connection', context,
duration: 3, gravity: Toast.BOTTOM);
},
tooltip: state.iConnectivity ? 'Add Product' : 'No Internet',
backgroundColor: state.iConnectivity && !refreshing ? null : Colors.grey,
child: Icon(Icons.add),
Expand Down

0 comments on commit 880527c

Please sign in to comment.