fix: section description dialog and review pretest exercise logic
This commit is contained in:
parent
8e770d2e6e
commit
276d616bf0
|
|
@ -1,3 +1,3 @@
|
|||
const String baseUrl = 'https://580d-36-85-62-81.ngrok-free.app/';
|
||||
const String baseUrl = 'http://54.173.167.62/';
|
||||
|
||||
const String mediaUrl = 'https://580d-36-85-62-81.ngrok-free.app/api/uploads/';
|
||||
const String mediaUrl = 'http://54.173.167.62/api/uploads/';
|
||||
|
|
|
|||
|
|
@ -48,7 +48,11 @@ class LevelProvider with ChangeNotifier {
|
|||
|
||||
bool isPretestFinished(String levelId) {
|
||||
return _levels.any(
|
||||
(level) => level.idLevel == levelId && level.idStudentLearning != null);
|
||||
(level) =>
|
||||
level.idLevel == levelId &&
|
||||
level.idStudentLearning != null &&
|
||||
level.score != null,
|
||||
);
|
||||
}
|
||||
|
||||
int getPretestScore(String levelId) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class PretestCard extends StatelessWidget {
|
|||
final score = levelProvider.getPretestScore(pretest.idLevel);
|
||||
// final isAllowed = levelProvider.isLevelAllowed(pretest.idLevel);
|
||||
void navigateToMaterial() {
|
||||
if (isFinished) {
|
||||
if (isFinished && pretest.score != null) {
|
||||
// Mode review untuk pretest yang sudah selesai
|
||||
Navigator.push(
|
||||
context,
|
||||
|
|
@ -133,8 +133,10 @@ class PretestCard extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(height: 13),
|
||||
CustomButton(
|
||||
text: isFinished ? 'Review' : 'Learn Now',
|
||||
textStyle: isFinished
|
||||
text: isFinished && pretest.score != null
|
||||
? 'Review'
|
||||
: 'Learn Now',
|
||||
textStyle: isFinished && pretest.score != null
|
||||
? AppTextStyles.whiteTextStyle.copyWith(
|
||||
fontWeight: FontWeight.w900,
|
||||
)
|
||||
|
|
@ -143,7 +145,9 @@ class PretestCard extends StatelessWidget {
|
|||
),
|
||||
width: double.infinity,
|
||||
height: 36,
|
||||
color: isFinished ? Colors.green : AppColors.yellowButtonColor,
|
||||
color: isFinished && pretest.score != null
|
||||
? Colors.green
|
||||
: AppColors.yellowButtonColor,
|
||||
onPressed: navigateToMaterial,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:english_learning/core/services/constants.dart';
|
||||
import 'package:english_learning/core/widgets/custom_snackbar.dart';
|
||||
import 'package:english_learning/core/widgets/global_button.dart';
|
||||
import 'package:english_learning/core/widgets/loading/shimmer_loading_widget.dart';
|
||||
import 'package:english_learning/features/auth/provider/user_provider.dart';
|
||||
import 'package:english_learning/features/learning/modules/level/screens/level_list_screen.dart';
|
||||
|
|
@ -126,25 +127,10 @@ class _TopicsListScreenState extends State<TopicsListScreen> {
|
|||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12, horizontal: 20),
|
||||
),
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: GlobalButton(
|
||||
text: 'Close',
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
label: const Text(
|
||||
'Close',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user