convert to dao calls, prep for migration strategy and first start db seed
This commit is contained in:
@ -2,11 +2,13 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
import 'package:sendtrain/database/database.dart';
|
||||
import 'package:sendtrain/models/activity_model.dart';
|
||||
|
||||
class ActivityTimerModel with ChangeNotifier {
|
||||
int _actionCounter = 0;
|
||||
ActivityModel? _activity;
|
||||
ActivityModel? _activityModel;
|
||||
Activity? _activity;
|
||||
List _sets = [];
|
||||
int _currentActionNum = 0;
|
||||
int _currentSetNum = 0;
|
||||
@ -20,20 +22,21 @@ class ActivityTimerModel with ChangeNotifier {
|
||||
dynamic get currentAction => currentSet[_currentActionNum];
|
||||
int get currentSetNum => _currentSetNum;
|
||||
dynamic get currentSet => _sets[_currentSetNum];
|
||||
ActivityModel? get activity => _activity;
|
||||
ActivityModel? get activityModel => _activityModel;
|
||||
Activity? get activity => _activity;
|
||||
List get sets => _sets;
|
||||
Timer? get periodicTimer => _periodicTimer;
|
||||
bool get isActive => _isActive();
|
||||
double get progress => _progress;
|
||||
int get totalTime => _totalTime;
|
||||
|
||||
void setup(ActivityModel activity) {
|
||||
if (_activity == null || activity.id != _activity?.id) {
|
||||
void setup(ActivityModel activityModel) {
|
||||
if (_activityModel == null || activityModel.id != _activityModel?.id) {
|
||||
_periodicTimer?.cancel();
|
||||
_progress = 0;
|
||||
_isc = null;
|
||||
_activity = activity;
|
||||
_sets = activity.actions[0].items();
|
||||
_activityModel = activityModel;
|
||||
_sets = activityModel.actions[0].items();
|
||||
_currentActionNum = 0;
|
||||
_currentSetNum = 0;
|
||||
setActionCount();
|
||||
|
Reference in New Issue
Block a user