exercises_page.dart 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import 'package:flutter/material.dart';
  2. import 'package:physigo/exercises/exercises_validation/models/exercise.dart';
  3. import 'package:physigo/exercises/exercises_validation/models/squat.dart';
  4. import 'package:physigo/walking/walking_page.dart';
  5. import 'exercises_validation/exercise_validation_page.dart';
  6. import 'exercises_validation/models/push_up.dart';
  7. class ExercisesPage extends StatelessWidget {
  8. const ExercisesPage({Key? key}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. return Scaffold(
  12. body: Padding(
  13. padding: const EdgeInsets.all(16.0),
  14. child: Column(
  15. mainAxisAlignment: MainAxisAlignment.center,
  16. children: [
  17. const Center(
  18. child: Text(
  19. "Exercises",
  20. textAlign: TextAlign.center,
  21. style: TextStyle(
  22. fontSize: 28,
  23. fontWeight: FontWeight.bold,
  24. // color: Colors.white,
  25. ),
  26. ),
  27. ),
  28. const SizedBox(height: 24),
  29. const TextField(
  30. decoration: InputDecoration(
  31. border: OutlineInputBorder(),
  32. hintText: "Search exercise...",
  33. ),
  34. ),
  35. const SizedBox(height: 24),
  36. Row(
  37. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  38. children: [
  39. FilterChip(
  40. label: const Text("Easy", style: TextStyle(color: Colors.white, fontSize: 18)),
  41. selected: true,
  42. backgroundColor: Colors.lightGreen,
  43. selectedColor: Colors.lightGreen,
  44. checkmarkColor: Colors.white,
  45. onSelected: (_) {},
  46. ),
  47. FilterChip(
  48. label: const Text("Normal", style: TextStyle(color: Colors.white, fontSize: 18)),
  49. selected: false,
  50. backgroundColor: Colors.amber,
  51. selectedColor: Colors.yellow,
  52. checkmarkColor: Colors.white,
  53. onSelected: (_) {},
  54. ),
  55. FilterChip(
  56. label: const Text("Hard", style: TextStyle(color: Colors.white, fontSize: 18)),
  57. selected: true,
  58. backgroundColor: Colors.red,
  59. selectedColor: Colors.red,
  60. checkmarkColor: Colors.white,
  61. onSelected: (_) {},
  62. ),
  63. ],
  64. ),
  65. const SizedBox(height: 48),
  66. const WalkExerciseTile(),
  67. const ExerciseTile(
  68. exerciseName: "push up",
  69. exercise: pushUp,
  70. ),
  71. const ExerciseTile(exerciseName: "squat", exercise: squat),
  72. ],
  73. ),
  74. ),
  75. );
  76. }
  77. }
  78. class ExerciseTile extends StatelessWidget {
  79. final String exerciseName;
  80. final Exercise exercise;
  81. const ExerciseTile({
  82. required this.exerciseName,
  83. required this.exercise,
  84. Key? key,
  85. }) : super(key: key);
  86. @override
  87. Widget build(BuildContext context) {
  88. return Center(
  89. child: Card(
  90. color: Colors.blueGrey,
  91. elevation: 3,
  92. child: ListTile(
  93. iconColor: Colors.white,
  94. textColor: Colors.white,
  95. title: Text(
  96. exerciseName.toUpperCase(),
  97. textAlign: TextAlign.center,
  98. style: const TextStyle(
  99. fontSize: 18,
  100. fontWeight: FontWeight.bold,
  101. letterSpacing: 1.8,
  102. ),
  103. ),
  104. trailing: const Icon(Icons.arrow_forward),
  105. onTap: () {
  106. Navigator.push(
  107. context,
  108. MaterialPageRoute(
  109. builder: (_) => ExerciseValidationPage(exercise: exercise),
  110. ),
  111. );
  112. },
  113. ),
  114. ),
  115. );
  116. }
  117. }
  118. class WalkExerciseTile extends StatelessWidget {
  119. const WalkExerciseTile({
  120. Key? key,
  121. }) : super(key: key);
  122. @override
  123. Widget build(BuildContext context) {
  124. return Center(
  125. child: Card(
  126. color: Colors.blueGrey,
  127. elevation: 3,
  128. child: ListTile(
  129. iconColor: Colors.white,
  130. textColor: Colors.white,
  131. title: Text(
  132. "walk".toUpperCase(),
  133. textAlign: TextAlign.center,
  134. style: const TextStyle(
  135. fontSize: 18,
  136. fontWeight: FontWeight.bold,
  137. letterSpacing: 1.8,
  138. ),
  139. ),
  140. trailing: const Icon(Icons.arrow_forward),
  141. onTap: () {
  142. Navigator.push(
  143. context,
  144. MaterialPageRoute(
  145. builder: (_) => WalkingPage(),
  146. ),
  147. );
  148. },
  149. ),
  150. ),
  151. );
  152. }
  153. }