|
|
|
|
@ -18,23 +18,29 @@ class WaterActionButtonsWidget extends StatelessWidget {
|
|
|
|
|
return Consumer<WaterMonitorViewModel>(builder: (context, vm, _) {
|
|
|
|
|
final cupAmount = vm.selectedCupCapacityMl;
|
|
|
|
|
final isGoalAchieved = vm.progressPercent >= 100 || vm.nextDrinkTime.toLowerCase().contains('goal achieved');
|
|
|
|
|
final isDisabled = vm.isLoading || isGoalAchieved;
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (cupAmount > 0) {
|
|
|
|
|
await vm.undoUserActivity();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.minimizeIcon,
|
|
|
|
|
height: 20.h,
|
|
|
|
|
width: 20.h,
|
|
|
|
|
iconColor: AppColors.textColor,
|
|
|
|
|
Opacity(
|
|
|
|
|
opacity: vm.isLoading ? 0.4 : 1.0,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: vm.isLoading
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
if (cupAmount > 0) {
|
|
|
|
|
await vm.undoUserActivity();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Utils.buildSvgWithAssets(
|
|
|
|
|
icon: AppAssets.minimizeIcon,
|
|
|
|
|
height: 20.h,
|
|
|
|
|
width: 20.h,
|
|
|
|
|
iconColor: AppColors.textColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
@ -51,9 +57,9 @@ class WaterActionButtonsWidget extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Opacity(
|
|
|
|
|
opacity: isGoalAchieved ? 0.4 : 1.0,
|
|
|
|
|
opacity: isDisabled ? 0.4 : 1.0,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: isGoalAchieved
|
|
|
|
|
onTap: isDisabled
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
if (cupAmount > 0) {
|
|
|
|
|
|