Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center" width="100%">
<img src="assets/icon/wave_app_icon_transparent.png" width="30%" height="30%">
<h1 align="center">IronFlow</h1>
<h3 align="center">Cross-platform mobile app for strength training progress tracking.</h3>
<h3 align="center">Cross-platform app for strength training progress tracking.</h3>

<h3 align="center">

Expand All @@ -12,14 +12,15 @@
![CI](https://github.com/andreped/IronFlow/workflows/Linting/badge.svg)
</h3>

**IronFlow** was developed to allow free, private, and seemless tracking of training progress and activities.
**IronFlow** was developed to allow free, private, and seemless tracking of training progress and activities.
A live web demo is available at [andreped.pages.dev](https://andreped.pages.dev), deployed via Cloudflare Pages.
</div>

<img src="assets/showcase/mobile_app_mosaic.png" width="100%" height="100%">

## [Features](https://github.com/andreped/IronFlow#Features)

The app is compatible with both Android and iOS.
The app is compatible with Android, iOS, and web (demo).

- [x] Ability to save individual exercises with weight and number of reps and sets.
- [x] All data is stored in a private SQLite database on the device.
Expand Down Expand Up @@ -100,10 +101,10 @@ The web build output is in `build/web/`. Serve it locally with:
npx serve build/web
```

### Deploy web to GitHub Pages
### Deploy web to Cloudflare Pages

Push to `main` or trigger the **Build & Deploy Web** workflow manually from the Actions tab.
The app will be live at `https://<your-username>.github.io/IronFlow/`.
The app will be live at `https://andreped.pages.dev`.

## [Getting Started](https://github.com/andreped/IronFlow#Getting-Started)

Expand Down
16 changes: 10 additions & 6 deletions lib/core/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class DatabaseHelper {
}

Future<String> _databasePath() async {
if (kIsWeb) {
return 'exercises.db';
}
return join(await getDatabasesPath(), 'exercises.db');
}

Expand Down Expand Up @@ -462,14 +465,15 @@ class DatabaseHelper {
final db = await database;
final List<Map<String, dynamic>> maxWeights = await db.rawQuery(
'''
SELECT exercise, weight, reps, sets
FROM exercises
WHERE (exercise, weight) IN (
SELECT exercise, MAX(CAST(weight AS REAL)) as weight
SELECT e.exercise, e.weight, e.reps, e.sets
FROM exercises e
INNER JOIN (
SELECT exercise, MAX(CAST(weight AS REAL)) AS max_weight
FROM exercises
GROUP BY exercise
)
ORDER BY exercise, reps DESC
) m ON e.exercise = m.exercise
AND CAST(e.weight AS REAL) = m.max_weight
ORDER BY e.exercise, e.reps DESC
''',
);

Expand Down
7 changes: 7 additions & 0 deletions lib/tabs/home_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class ExerciseStoreHomePageState extends State<ExerciseStoreHomePage>
late TabController _tabController;
late PageController _pageController;
final PageStorageBucket bucket = PageStorageBucket();
final GlobalKey<RecordsTabState> _recordsTabKey =
GlobalKey<RecordsTabState>();

void _refreshTable() {
setState(() {});
Expand All @@ -108,6 +110,9 @@ class ExerciseStoreHomePageState extends State<ExerciseStoreHomePage>
super.initState();
_tabController = TabController(length: 5, vsync: this, initialIndex: 2)
..addListener(() {
if (_tabController.index == 0) {
_recordsTabKey.currentState?.fetchAndSortRecords();
}
if (_tabController.index == 4) {
_refreshTable();
}
Expand Down Expand Up @@ -176,6 +181,7 @@ class ExerciseStoreHomePageState extends State<ExerciseStoreHomePage>
},
children: [
RecordsTab(
key: _recordsTabKey,
isKg: widget.isKg,
bodyweightEnabledGlobal: widget.bodyweightEnabledGlobal),
SummaryTab(
Expand All @@ -190,6 +196,7 @@ class ExerciseStoreHomePageState extends State<ExerciseStoreHomePage>
isKg: widget.isKg,
onExerciseAdded: () {
setState(() {});
_recordsTabKey.currentState?.fetchAndSortRecords();
},
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/tabs/records_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RecordsTabState extends State<RecordsTab> {
bool _isSearching = false;
final TextEditingController _searchController = TextEditingController();

Future<void> _fetchAndSortRecords() async {
Future<void> fetchAndSortRecords() async {
setState(() {
_isLoading = true;
_errorMessage = null;
Expand Down Expand Up @@ -124,7 +124,7 @@ class RecordsTabState extends State<RecordsTab> {
@override
void initState() {
super.initState();
_fetchAndSortRecords();
fetchAndSortRecords();
}

double _convertWeight(double weightInKg) {
Expand Down
Loading