fix(learn): Fix learn practice pop issue
This commit is contained in:
parent
dc8918e519
commit
c2fc40fc3b
|
|
@ -6,7 +6,6 @@ import 'package:yimaru_app/ui/widgets/custom_elevated_button.dart';
|
|||
import 'package:yimaru_app/ui/widgets/custom_small_radio_button.dart';
|
||||
import 'package:yimaru_app/ui/widgets/large_app_bar.dart';
|
||||
|
||||
import '../../../widgets/assessment_loading_screen.dart';
|
||||
import '../assessment_viewmodel.dart';
|
||||
|
||||
class AssessmentQuestionsScreen extends ViewModelWidget<AssessmentViewModel> {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:yimaru_app/ui/common/app_colors.dart';
|
||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
||||
import 'package:yimaru_app/ui/widgets/custom_elevated_button.dart';
|
||||
import 'package:yimaru_app/ui/widgets/large_app_bar.dart';
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import 'package:yimaru_app/ui/views/learn_program/learn_program_view.dart';
|
|||
import 'package:yimaru_app/ui/views/profile/profile_view.dart';
|
||||
import 'package:yimaru_app/ui/widgets/coming_soon.dart';
|
||||
|
||||
import '../../common/enmus.dart';
|
||||
import '../../widgets/page_loading_indicator.dart';
|
||||
import 'home_viewmodel.dart';
|
||||
|
||||
class HomeView extends StackedView<HomeViewModel> {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ class LearnPracticeView extends StackedView<LearnPracticeViewModel> {
|
|||
: super(key: key);
|
||||
|
||||
Future<void> _cancel(LearnPracticeViewModel viewModel) async {
|
||||
await viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
}
|
||||
|
||||
|
|
@ -59,8 +59,12 @@ class LearnPracticeView extends StackedView<LearnPracticeViewModel> {
|
|||
required LearnPracticeViewModel viewModel}) =>
|
||||
PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (value, data) async =>
|
||||
await _showSheet(context: context, viewModel: viewModel),
|
||||
onPopInvokedWithResult: (didPop, data) {
|
||||
if (!didPop) {
|
||||
Future.microtask(()async =>await _showSheet(context: context, viewModel: viewModel));
|
||||
}
|
||||
},
|
||||
|
||||
child: _buildScaffoldWrapper(viewModel));
|
||||
|
||||
Widget _buildSheet(LearnPracticeViewModel viewModel) =>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import 'package:yimaru_app/ui/views/learn_practice/learn_practice_viewmodel.dart
|
|||
import 'package:yimaru_app/ui/widgets/cancel_learn_practice_sheet.dart';
|
||||
import 'package:yimaru_app/ui/widgets/custom_circular_progress_indicator.dart';
|
||||
import 'package:yimaru_app/ui/widgets/custom_linear_progress_indicator.dart';
|
||||
import 'package:yimaru_app/ui/widgets/page_loading_indicator.dart';
|
||||
import 'package:yimaru_app/ui/widgets/wave_wrapper.dart';
|
||||
|
||||
import '../../../../models/learn_question.dart';
|
||||
|
|
@ -26,11 +25,11 @@ class InteractLearnPracticeScreen
|
|||
{super.key, required this.index, required this.question});
|
||||
|
||||
Future<void> _cancel(LearnPracticeViewModel viewModel) async {
|
||||
await viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
viewModel.pop();
|
||||
viewModel.stopRecording();
|
||||
}
|
||||
|
||||
}
|
||||
void _reply(LearnPracticeViewModel viewModel) =>
|
||||
viewModel.replayVoicePrompt(question);
|
||||
|
||||
|
|
@ -360,7 +359,8 @@ class InteractLearnPracticeScreen
|
|||
onClose: viewModel.pop,
|
||||
onContinue: viewModel.pop,
|
||||
user: viewModel.user?.firstName ?? '',
|
||||
onCancel: () async => await _cancel(viewModel),
|
||||
onCancel: ()async => await _cancel(viewModel),
|
||||
|
||||
);
|
||||
|
||||
Widget _buildProgressIndicatorState(LearnPracticeViewModel viewModel) =>
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import 'package:yimaru_app/ui/widgets/small_app_bar.dart';
|
|||
|
||||
import '../../../common/app_colors.dart';
|
||||
import '../../../common/ui_helpers.dart';
|
||||
import '../../../widgets/large_app_bar.dart';
|
||||
import '../../../widgets/refresh_button.dart';
|
||||
|
||||
class LearnLoadingScreen extends StatelessWidget {
|
||||
final bool isEmpty;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ class LearnPracticeIntroScreen extends ViewModelWidget<LearnPracticeViewModel> {
|
|||
const LearnPracticeIntroScreen({super.key});
|
||||
|
||||
Future<void> _cancel(LearnPracticeViewModel viewModel) async {
|
||||
await viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
viewModel.pop();
|
||||
viewModel.stopRecording();
|
||||
|
||||
}
|
||||
|
||||
Future<void> _showSheet(
|
||||
|
|
@ -81,7 +82,8 @@ class LearnPracticeIntroScreen extends ViewModelWidget<LearnPracticeViewModel> {
|
|||
onClose: viewModel.pop,
|
||||
onContinue: viewModel.pop,
|
||||
user: viewModel.user?.firstName ?? '',
|
||||
onCancel: () async => await _cancel(viewModel),
|
||||
onCancel: ()async => await _cancel(viewModel),
|
||||
|
||||
);
|
||||
|
||||
Widget _buildBodyColumnWrapper(LearnPracticeViewModel viewModel) => Expanded(
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@ class LearnPracticeResultScreen
|
|||
}
|
||||
|
||||
Future<void> _cancel(LearnPracticeViewModel viewModel) async {
|
||||
await viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
viewModel.pop();
|
||||
viewModel.stopRecording();
|
||||
|
||||
}
|
||||
|
||||
Future<void> _showSheet(
|
||||
|
|
@ -95,7 +96,7 @@ class LearnPracticeResultScreen
|
|||
onClose: viewModel.pop,
|
||||
onContinue: viewModel.pop,
|
||||
user: viewModel.user?.firstName ?? '',
|
||||
onCancel: () async => await _cancel(viewModel),
|
||||
onCancel: ()async => await _cancel(viewModel),
|
||||
);
|
||||
|
||||
Widget _buildBodyWrapper(LearnPracticeViewModel viewMode) => Expanded(
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@ class StartLearnPracticeScreen extends ViewModelWidget<LearnPracticeViewModel> {
|
|||
{super.key, required this.index, required this.question});
|
||||
|
||||
Future<void> _cancel(LearnPracticeViewModel viewModel) async {
|
||||
await viewModel.stopRecording();
|
||||
viewModel.pop();
|
||||
viewModel.pop();
|
||||
viewModel.stopRecording();
|
||||
|
||||
}
|
||||
|
||||
void _start(LearnPracticeViewModel viewModel) {
|
||||
|
|
@ -106,7 +107,7 @@ class StartLearnPracticeScreen extends ViewModelWidget<LearnPracticeViewModel> {
|
|||
onClose: viewModel.pop,
|
||||
onContinue: viewModel.pop,
|
||||
user: viewModel.user?.firstName ?? '',
|
||||
onCancel: () async => await _cancel(viewModel),
|
||||
onCancel: ()async => await _cancel(viewModel),
|
||||
);
|
||||
|
||||
Widget _buildStartButtonWrapper(LearnPracticeViewModel viewModel) => Expanded(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'package:stacked/stacked.dart';
|
|||
import 'package:yimaru_app/ui/common/app_colors.dart';
|
||||
import 'package:yimaru_app/ui/common/enmus.dart';
|
||||
import 'package:yimaru_app/ui/common/ui_helpers.dart';
|
||||
import 'package:yimaru_app/ui/widgets/page_loading_indicator.dart';
|
||||
import 'package:yimaru_app/ui/widgets/profile_card.dart';
|
||||
import 'package:yimaru_app/ui/widgets/profile_image.dart';
|
||||
import 'package:yimaru_app/ui/widgets/view_profile_button.dart';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user