first commit
This commit is contained in:
commit
a2663f415e
144 changed files with 6324 additions and 0 deletions
51
lib/providers/settings_provider.dart
Normal file
51
lib/providers/settings_provider.dart
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class SettingsState {
|
||||
final int trainingTimeMinutes;
|
||||
final double weightLeft;
|
||||
final double weightRight;
|
||||
final int repsPerSet;
|
||||
final int goalSets;
|
||||
final String notes;
|
||||
|
||||
SettingsState({
|
||||
this.trainingTimeMinutes = 20,
|
||||
this.weightLeft = 16.0,
|
||||
this.weightRight = 16.0,
|
||||
this.repsPerSet = 5,
|
||||
this.goalSets = 5,
|
||||
this.notes = "",
|
||||
});
|
||||
|
||||
SettingsState copyWith({
|
||||
int? trainingTimeMinutes,
|
||||
double? weightLeft,
|
||||
double? weightRight,
|
||||
int? repsPerSet,
|
||||
int? goalSets,
|
||||
String? notes,
|
||||
}) {
|
||||
return SettingsState(
|
||||
trainingTimeMinutes: trainingTimeMinutes ?? this.trainingTimeMinutes,
|
||||
weightLeft: weightLeft ?? this.weightLeft,
|
||||
weightRight: weightRight ?? this.weightRight,
|
||||
repsPerSet: repsPerSet ?? this.repsPerSet,
|
||||
goalSets: goalSets ?? this.goalSets,
|
||||
notes: notes ?? this.notes,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsNotifier extends StateNotifier<SettingsState> {
|
||||
SettingsNotifier() : super(SettingsState());
|
||||
|
||||
void updateSettings(SettingsState newSettings) {
|
||||
state = newSettings;
|
||||
}
|
||||
}
|
||||
|
||||
final settingsProvider = StateNotifierProvider<SettingsNotifier, SettingsState>(
|
||||
(ref) {
|
||||
return SettingsNotifier();
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue