Line data Source code
1 : import 'package:amadeus_proto/constants.dart';
2 : import 'package:amadeus_proto/models/chapter_info.dart';
3 : import 'package:amadeus_proto/widget/padded_card.dart';
4 : import 'package:amadeus_proto/widget/progress_bar.dart';
5 : import 'package:flutter/material.dart';
6 : import 'package:localization/localization.dart';
7 :
8 : class ExercisesButton extends StatelessWidget {
9 0 : const ExercisesButton({
10 : super.key,
11 : this.onPressed,
12 : required this.chapterInfo,
13 : });
14 :
15 : final void Function()? onPressed;
16 : final ChapterInfo chapterInfo;
17 :
18 0 : @override
19 : Widget build(BuildContext context) {
20 0 : return GestureDetector(
21 : onTap: null, // TODO: add redirection to exercises
22 0 : child: PaddedCard(
23 0 : child: Row(
24 0 : children: [
25 0 : ClipRRect(
26 0 : borderRadius: BorderRadius.circular(24),
27 0 : child: Image.asset(chapterInfo.imagePath),
28 : ),
29 0 : Padding(
30 : padding: const EdgeInsets.symmetric(horizontal: 8.0),
31 0 : child: Column(
32 : mainAxisAlignment: MainAxisAlignment.center,
33 : crossAxisAlignment: CrossAxisAlignment.start,
34 0 : children: [
35 0 : Text(
36 0 : chapterInfo.name,
37 : style: const TextStyle(
38 : fontSize: 16, fontWeight: FontWeight.bold),
39 : ),
40 0 : Text(
41 0 : "exercises.chapter".i18n([
42 0 : chapterInfo.chapterNumber.toString(),
43 0 : chapterInfo.clearedExercises.toString(),
44 0 : chapterInfo.totalExercises.toString()
45 : ]),
46 : style: const TextStyle(color: lightGrey1),
47 : ),
48 : const SizedBox(
49 : height: 10,
50 : ),
51 0 : ProgressBar(
52 0 : totalAmount: chapterInfo.totalExercises,
53 0 : progressAmount: chapterInfo.clearedExercises,
54 : width: 200,
55 : height: 15)
56 : ],
57 : ),
58 : )
59 : ],
60 : ),
61 : ),
62 : );
63 : }
64 : }
|