exercises_page.dart 4.9 KB

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