- Random Workout Generator
Random Workout Generator is a Flutter application designed to help users create diverse and engaging bodyweight workouts. With a library of various exercises, this app randomly generates workouts and allows users to customize their routines.
The main goal of this app is to provide a quick and easy way for users to create varied workouts without equipment. It's perfect for those who want to stay active at home, while traveling, or when they don't have access to a gym. By randomizing workouts, it helps prevent boredom and keeps exercise routines fresh and challenging.
- Random Workout Generation: Users can generate random workouts based on exercise categories (Strength, Mobility, Stretching).
- Custom Exercise Creation: Users can add custom exercises to their workouts.
- Exercise Management: Users can view, add, and remove exercises from their current workout.
- Dark Mode: Users can toggle between light and dark themes for comfortable viewing.
- Exercise Details: Users can view detailed information about each exercise, including muscle and joint targets.
- Random Workout Generation: Users can generate random workouts based on exercise categories (Strength, Mobility, Stretching).
- Custom Exercise Creation: Users can add custom exercises to their workouts.
- Exercise Management: Users can view, add, and remove exercises from their current workout.
- Dark Mode: Users can toggle between light and dark themes for comfortable viewing.
- Exercise Details: Users can view detailed information about each exercise, including muscle and joint targets.
The app follows a feature-based structure, organizing code by functionality rather than type. This approach improves scalability and makes it easier to locate and manage related code.
lib/
├── data/
├── models/
├── pages/
├── providers/
├── widgets/
└── main.dart
data/
: Contains static data and sample exercises.models/
: Defines data structures used throughout the app.pages/
: Contains full-screen UI components (pages/screens).providers/
: Houses state management logic.widgets/
: Stores reusable UI components.main.dart
: The entry point of the application.
lib/
├── data/
│ ├── all_exercises.dart
│ ├── mobility_exercises.dart
│ ├── strength_exercises.dart
│ └── stretching_exercises.dart
├── models/
│ └── exercise.dart
├── pages/
│ ├── category_selection_page.dart
│ └── workout_page.dart
├── providers/
│ └── app_state.dart
├── widgets/
│ └── exercise/
│ ├── add_exercise_options_dialog.dart
│ ├── create_exercise_dialog.dart
│ └── exercise_list_tile.dart
└── main.dart
data/*.dart
: Define lists of pre-defined exercises for each category.models/exercise.dart
: Defines theExercise
class and related enums.pages/category_selection_page.dart
: UI for selecting workout categories.pages/workout_page.dart
: Main workout view and management UI.providers/app_state.dart
: Manages the global state of the application.widgets/exercise/*.dart
: Reusable widgets for exercise-related UI components.main.dart
: Sets up the app, including theming and initial routing.
-
add_exercise_options_dialog.dart
: This widget displays a dialog that gives the user two options: to choose from pre-defined exercises or to create a custom exercise. It's typically shown when the user taps the "Add Exercise" button on the workout page. The dialog uses callback functions to handle the user's choice, allowing for flexible implementation in different contexts. -
create_exercise_dialog.dart
: This widget provides a form dialog for users to create custom exercises. It includes input fields for the exercise name, description, and optional instructions. It also allows users to select muscle targets, joint targets, and special targets for the exercise. The dialog handles input validation and returns the created exercise object to the caller. -
exercise_list_tile.dart
: This widget represents a single exercise in a list view. It displays the exercise name, description, and target information (muscles, joints, special areas). It also provides options to remove the exercise from the workout and to view more detailed instructions. The widget is designed to be used within a ListView, typically on the workout page.
The app uses the Provider package for state management. The AppState
class in providers/app_state.dart
is the central state management solution, handling:
- Current workout exercises
- Theme mode (light/dark)
- Workout generation
Provider was chosen for its simplicity and ease of use, making it suitable for small to medium-sized applications. It allows for easy access to the app state throughout the widget tree and supports reactive rebuilds of the UI when the state changes.
- Ensure you have Flutter installed on your machine. If not, follow the official Flutter installation guide.
- An IDE with Flutter support (e.g., Android Studio, VS Code with Flutter extension)
-
Clone this repository:
git clone https://github.com/FlutterFriends/random_workout_generator.git
-
Navigate to the project directory:
cd random_workout_generator
-
Get the dependencies:
flutter pub get
-
Run the app:
flutter run
To run tests for the app, use the following command:
flutter test
To generate a coverage report, use the following command:
flutter test --coverage
To run integration tests, use the following command:
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/app_test.dart
To generate mocks for testing, use the following command:
dart run build_runner build
We welcome contributions from the community! Whether you're fixing bugs, adding new features, or improving documentation, your input is valuable.
If you have suggestions for new features or improvements, please open an issue in the repository's "Issues" tab. We'd love to hear your thoughts!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Add categories for exercises (e.g., upper body, lower body, core)
- Implement a search functionality for exercises
- Create preset workouts for different fitness levels
- Add a timer feature for timed workouts
- Implement user accounts to save favorite workouts
Join our community discussions! If you have questions, ideas, or need support, please don't hesitate to open an issue or start a discussion in the repository's "Discussions" tab.
We're excited to see how you'll help improve the Random Workout Generator!
This project is licensed under the MIT License - see the LICENSE.md file for details.