Skip to content

Commit

Permalink
feat: show circular progress indicator while LockProvider loads data
Browse files Browse the repository at this point in the history
  • Loading branch information
ses110 committed May 18, 2021
1 parent a7fdb76 commit e557e34
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions lib/components/lock_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,34 @@ class LockWidget extends StatelessWidget {
Widget build(BuildContext context) {
final lockProvider = Provider.of<LockProvider>(context, listen: true);

return Column(mainAxisAlignment: MainAxisAlignment.start, children: [
Row(
children: <Widget>[
Text(
lockProvider?.deviceDetail?.displayName ?? '',
style: Theme.of(context).textTheme.headline6,
),
],
),
SizedBox(
height: 80,
),
Center(
child: Arc(
centerWidget: (lockProvider.isLocked)
? DeviceItemIcon.getLockIcon(100)
: DeviceItemIcon.getUnlockIcon(100),
initialValue: 0.0,
onFinalSetPoint: (double value) {
bool setLock = value != 0;
lockProvider.setLockUnlockAction(
lockProvider?.deviceDetail?.id, setLock);
},
maxValue: 1.0,
),
),
]);
return lockProvider.loading
? Center(child: CircularProgressIndicator())
: Column(mainAxisAlignment: MainAxisAlignment.start, children: [
Row(
children: <Widget>[
Text(
lockProvider?.deviceDetail?.displayName ?? '',
style: Theme.of(context).textTheme.headline6,
),
],
),
SizedBox(
height: 80,
),
Center(
child: Arc(
centerWidget: (lockProvider.isLocked)
? DeviceItemIcon.getLockIcon(100)
: DeviceItemIcon.getUnlockIcon(100),
initialValue: 0.0,
onFinalSetPoint: (double value) {
bool setLock = value != 0;
lockProvider.setLockUnlockAction(
lockProvider?.deviceDetail?.id, setLock);
},
maxValue: 1.0,
),
),
]);
}
}

0 comments on commit e557e34

Please sign in to comment.