Skip to content

Commit

Permalink
Fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Oct 17, 2024
1 parent b51665f commit 60b6260
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
11 changes: 9 additions & 2 deletions lib/presentation/atoms/card_atom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:infinite_horizons/presentation/core/theme_data.dart';

import '../../domain/controllers/vibration_controller.dart';

class CardAtom extends StatelessWidget {
const CardAtom({required this.child, this.onClick, this.image});

Expand All @@ -12,7 +14,12 @@ class CardAtom extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onClick,
onTap: onClick != null
? () {
VibrationController.instance.vibrate(VibrationType.light);
onClick!();
}
: null,
child: Card.filled(
margin: EdgeInsets.zero,
clipBehavior: Clip.hardEdge,
Expand All @@ -23,7 +30,7 @@ class CardAtom extends StatelessWidget {
borderRadius:
const BorderRadius.vertical(bottom: Radius.circular(15)),
child: SizedBox(
height: 170,
height: 150,
width: double.infinity,
child: image,
),
Expand Down
20 changes: 7 additions & 13 deletions lib/presentation/pages/intro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ class _IntroPageState extends State<IntroPage> {
GlobalKey<IntroductionScreenState>();

bool showNextButton = true;
IntroState state = IntroState.welcome;
IntroState state = IntroState.tips;
final Duration selectionTransitionDelay = const Duration(milliseconds: 200);

void onIntroPageChange(int n) {
state = IntroState.getStateByPageNumber(n);
bool showNextButtonTemp = true;

if (state == IntroState.workType &&
(WorkTypeAbstract.instance?.tipType == null ||
WorkTypeAbstract.instance!.tipType == TipType.undefined)) {
showNextButtonTemp = false;
} else if (state == IntroState.energy &&
if (state == IntroState.energy &&
WorkTypeAbstract.instance!.getTimerStates().type ==
EnergyType.undefined) {
showNextButtonTemp = false;
Expand Down Expand Up @@ -89,7 +85,7 @@ class _IntroPageState extends State<IntroPage> {

return Scaffold(
body: PopScope(
canPop: state == IntroState.welcome,
canPop: state == IntroState.tips,
onPopInvokedWithResult: (bool a, b) => previousPage(),
child: GestureDetector(
onHorizontalDragEnd: onHorizontalDrag,
Expand Down Expand Up @@ -146,11 +142,9 @@ class _IntroPageState extends State<IntroPage> {
}

enum IntroState {
welcome(0),
workType(1),
tips(2),
energy(3),
encouragementSentence(4),
tips(0),
energy(1),
encouragementSentence(2),
;

const IntroState(this.pageNumber);
Expand All @@ -163,6 +157,6 @@ enum IntroState {
return state;
}
}
return IntroState.welcome;
return IntroState.tips;
}
}

0 comments on commit 60b6260

Please sign in to comment.