Skip to content

Commit

Permalink
Fix checkup submission build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ferndot committed Mar 21, 2020
1 parent dcd5b97 commit 0cad0dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
20 changes: 15 additions & 5 deletions lib/src/ui/screens/checkup/checkup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class _CheckupScreenState extends State<CheckupScreen> {
// Storing the page controller at this level so that we can access it
// across the entire checkup experience
PageController _pageController;
bool _showLoadingAssessmentHUD = false;

@override
void initState() {
Expand Down Expand Up @@ -88,10 +89,8 @@ class _CheckupScreenState extends State<CheckupScreen> {
case CheckupStateInProgress:
return CheckupLoadedBody();
case CheckupStateCompleting:
return Container();
case CheckupStateCompleted:
_handleCheckupCompletion(preferencesState, checkupState);
return null;
return Container();
default:
return _getErrorBody();
}
Expand All @@ -103,12 +102,23 @@ class _CheckupScreenState extends State<CheckupScreen> {
builder: (context, state) {
final PreferencesState preferencesState = state;

return BlocBuilder<CheckupBloc, CheckupState>(
return BlocConsumer<CheckupBloc, CheckupState>(
listener: (context, state) {
if (state is CheckupStateCompleting) {
if (!_showLoadingAssessmentHUD) {
setState(() {
_showLoadingAssessmentHUD = true;
});
}
} else if (state is CheckupStateCompleted) {
_handleCheckupCompletion(preferencesState, state);
}
},
builder: (context, state) {
final CheckupState checkupState = state;

return WidgetHUD(
showHUD: checkupState is CheckupStateCompleting,
showHUD: _showLoadingAssessmentHUD,
hud: HUD(label: 'Loading your assessment'),
builder: (context) {
return ChangeNotifierProvider<PageController>.value(
Expand Down
1 change: 0 additions & 1 deletion lib/src/ui/screens/checkup/steps/intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';

import 'package:coronavirus_diary/src/blocs/checkup/checkup.dart';
import 'package:coronavirus_diary/src/ui/router.dart';
import 'index.dart';

class IntroStep extends StatefulWidget implements CheckupStep {
Expand Down
1 change: 0 additions & 1 deletion lib/src/ui/screens/checkup/steps/subjective.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';

import 'package:coronavirus_diary/src/blocs/checkup/checkup.dart';
import 'package:coronavirus_diary/src/blocs/questions/questions.dart';
import 'package:coronavirus_diary/src/ui/router.dart';
import 'package:coronavirus_diary/src/ui/widgets/questions/question_view.dart';
import 'package:coronavirus_diary/src/ui/utils/checkups.dart';
import 'index.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/src/ui/screens/checkup/steps/temperature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

import 'package:coronavirus_diary/src/blocs/checkup/checkup.dart';
import 'package:coronavirus_diary/src/ui/router.dart';
import 'package:coronavirus_diary/src/ui/widgets/tutorial_step.dart';
import 'package:coronavirus_diary/src/ui/utils/checkups.dart';
import 'index.dart';
Expand Down

0 comments on commit 0cad0dc

Please sign in to comment.