Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code comment refactoring #397

Merged
merged 3 commits into from
Jan 6, 2025
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
22 changes: 12 additions & 10 deletions lib/tabs/visualization_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class VisualizationTab extends StatefulWidget {

class VisualizationTabState extends State<VisualizationTab> {
String? _selectedExercise;
String _selectedTable = 'Exercise'; // Default selected table
String _selectedTable = 'Exercise';
late String _aggregationMethod;
late String _chartType;
String _dataType = 'Weight'; // Default data type for Fitness table
String _dataType = 'Weight';
List<String> _exerciseNames = [];
List<ScatterSpot> _dataPoints = [];
DateTimeRange? _selectedDateRange;
Expand All @@ -44,7 +44,7 @@ class VisualizationTabState extends State<VisualizationTab> {
void initState() {
super.initState();
_initializeDefaults();
_fetchExerciseNames(); // Fetch exercise names initially
_fetchExerciseNames();
}

void _initializeDefaults() {
Expand Down Expand Up @@ -231,7 +231,7 @@ class VisualizationTabState extends State<VisualizationTab> {
case 'Weight':
return widget.isKg
? value
: value * 2.20462; // Convert to lbs if needed
: value * 2.20462;
case 'Height':
return value; // Assuming height is already in the desired unit
case 'Age':
Expand Down Expand Up @@ -269,6 +269,7 @@ class VisualizationTabState extends State<VisualizationTab> {

// Get the height of the screen
final screenHeight = MediaQuery.of(context).size.height;

// Define the maximum height for the chart as 45% of the screen height
final chartMaxHeight = screenHeight * 0.45;

Expand All @@ -291,13 +292,14 @@ class VisualizationTabState extends State<VisualizationTab> {
onChanged: (newValue) {
if (newValue != null && newValue != _selectedTable) {
setState(() {
// reset
_selectedTable = newValue;
_selectedExercise = null; // Reset the selected exercise
_exerciseNames = []; // Clear the exercise names
_dataPoints = []; // Clear the data points
_dataType = 'Weight'; // Reset data type to default
_selectedExercise = null;
_exerciseNames = [];
_dataPoints = [];
_dataType = 'Weight';
});
_fetchExerciseNames(); // Fetch the new exercise names if needed
_fetchExerciseNames();
}
},
hint: 'Select Table',
Expand All @@ -311,7 +313,7 @@ class VisualizationTabState extends State<VisualizationTab> {
onChanged: (newValue) {
if (newValue != null) {
setState(() {
_dataPoints = []; // Clear the data points
_dataPoints = []; // reset
_selectedExercise = newValue;
});
_fetchDataPoints(newValue);
Expand Down
18 changes: 9 additions & 9 deletions lib/widgets/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class SettingsModalState extends State<SettingsModal> {
_appTheme = widget.appTheme;
_isKg = widget.isKg;
_bodyweightEnabledGlobal = widget.bodyweightEnabledGlobal;
_aggregationMethod = 'Top3Avg'; // Default value
_plotType = 'Line'; // Default value
_aggregationMethod = 'Top3Avg';
_plotType = 'Line';
_appVersion = _getAppVersion();
_loadSettings();
}
Expand Down Expand Up @@ -235,8 +235,8 @@ class SettingsModalState extends State<SettingsModal> {
style: TextStyle(
fontSize: 14,
color: isDarkMode
? Colors.purple // Use primary color for dark mode
: Colors.black, // Set text color for light mode
? Colors.purple
: Colors.black,
),
items: const [
DropdownMenuItem(
Expand Down Expand Up @@ -289,7 +289,7 @@ class SettingsModalState extends State<SettingsModal> {
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary, // Use theme primary color
.primary,
fontSize: 16,
),
),
Expand Down Expand Up @@ -325,8 +325,8 @@ class SettingsModalState extends State<SettingsModal> {
style: TextStyle(
fontSize: 14,
color: isDarkMode
? Colors.purple // Use primary color for dark mode
: Colors.black, // Set text color for light mode
? Colors.purple
: Colors.black,
),
items: const [
DropdownMenuItem(
Expand Down Expand Up @@ -367,8 +367,8 @@ class SettingsModalState extends State<SettingsModal> {
style: TextStyle(
fontSize: 14,
color: isDarkMode
? Colors.purple // Use primary color for dark mode
: Colors.black, // Set text color for light mode
? Colors.purple
: Colors.black,
),
items: const [
DropdownMenuItem(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: IronFlow
description: "Strength training and fitness app for mobile devices."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 0.12.2+60
version: 0.12.1+61

environment:
sdk: '>=3.4.3 <4.0.0'
Expand Down
Loading