| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- import 'package:flutter/material.dart';
- import 'package:physigo/exercises/exercises_validation/models/arm_raises.dart';
- import 'package:physigo/exercises/exercises_validation/models/exercise.dart';
- import 'package:physigo/exercises/exercises_validation/models/leg_curl.dart';
- import 'package:physigo/exercises/exercises_validation/models/leg_raises.dart';
- import 'package:physigo/exercises/exercises_validation/models/squat.dart';
- import 'package:physigo/walking/walking_page.dart';
- import 'exercises_validation/exercise_validation_page.dart';
- import 'exercises_validation/models/push_up.dart';
- class ExercisesPage extends StatelessWidget {
- const ExercisesPage({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const Center(
- child: Text(
- "Exercises",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 28,
- fontWeight: FontWeight.bold,
- // color: Colors.white,
- ),
- ),
- ),
- const SizedBox(height: 24),
- const TextField(
- decoration: InputDecoration(
- border: OutlineInputBorder(),
- hintText: "Search exercise...",
- ),
- ),
- const SizedBox(height: 24),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- FilterChip(
- label: const Text("Easy", style: TextStyle(color: Colors.white, fontSize: 18)),
- selected: true,
- backgroundColor: Colors.lightGreen,
- selectedColor: Colors.lightGreen,
- checkmarkColor: Colors.white,
- onSelected: (_) {},
- ),
- FilterChip(
- label: const Text("Normal", style: TextStyle(color: Colors.white, fontSize: 18)),
- selected: true,
- backgroundColor: Colors.amber,
- selectedColor: Colors.amber,
- checkmarkColor: Colors.white,
- onSelected: (_) {},
- ),
- FilterChip(
- label: const Text("Hard", style: TextStyle(color: Colors.white, fontSize: 18)),
- selected: true,
- backgroundColor: Colors.red,
- selectedColor: Colors.red,
- checkmarkColor: Colors.white,
- onSelected: (_) {},
- ),
- ],
- ),
- const SizedBox(height: 48),
- const WalkExerciseTile(),
- ExerciseTile(exerciseName: "leg curl", exercise: legCurl, difficulty: 0),
- ExerciseTile(exerciseName: "leg raises", exercise: legRaises, difficulty: 0),
- ExerciseTile(exerciseName: "knee raises", exercise: pushUp, difficulty: 1),
- ExerciseTile(exerciseName: "arm raises", exercise: armRaises, difficulty: 1),
- ExerciseTile(exerciseName: "squat", exercise: squat, difficulty: 2),
- ],
- ),
- ),
- );
- }
- }
- class ExerciseTile extends StatelessWidget {
- final String exerciseName;
- final Exercise exercise;
- final int difficulty;
- const ExerciseTile({
- required this.exerciseName,
- required this.exercise,
- required this.difficulty,
- Key? key,
- }) : super(key: key);
- Color get cardColor {
- if (difficulty == 0) return Colors.lightGreen;
- if (difficulty == 1) return Colors.amber;
- if (difficulty == 2) return Colors.red;
- return Colors.blueGrey;
- }
- @override
- Widget build(BuildContext context) {
- return Center(
- child: Card(
- color: cardColor,
- elevation: 3,
- child: ListTile(
- iconColor: Colors.white,
- textColor: Colors.white,
- title: Text(
- exerciseName.toUpperCase(),
- textAlign: TextAlign.center,
- style: const TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.bold,
- letterSpacing: 1.8,
- ),
- ),
- trailing: const Icon(Icons.arrow_forward),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) => ExerciseValidationPage(exercise: exercise),
- ),
- );
- },
- ),
- ),
- );
- }
- }
- class WalkExerciseTile extends StatelessWidget {
- const WalkExerciseTile({
- Key? key,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Center(
- child: Card(
- color: Colors.lightGreen,
- elevation: 3,
- child: ListTile(
- iconColor: Colors.white,
- textColor: Colors.white,
- title: Text(
- "walk".toUpperCase(),
- textAlign: TextAlign.center,
- style: const TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.bold,
- letterSpacing: 1.8,
- ),
- ),
- trailing: const Icon(Icons.arrow_forward),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (_) => WalkingPage(),
- ),
- );
- },
- ),
- ),
- );
- }
- }
|