Compare commits

..

No commits in common. "bdc4fee8c2ac771901e40f78ae1d00a10c88f7a2" and "2eda79737562dfc7b80dd9d2d4f43d0072884488" have entirely different histories.

10 changed files with 15 additions and 31 deletions

Binary file not shown.

Binary file not shown.

BIN
assets/audio/count_tone.wav Normal file

Binary file not shown.

@ -53,7 +53,7 @@ Future<void> seedDb(AppDatabase database) async {
// final int totalActions = 5;
final int totalMedia = 5;
final random = Random();
final whitespaceRE = RegExp(r"(?! )\s+| \s+");
// we gotta build all the activities!
final jsondata =
await root_bundle.rootBundle.loadString('assets/exercises.json');
@ -72,12 +72,9 @@ Future<void> seedDb(AppDatabase database) async {
}
Map<Symbol, Value> payload = {
Symbol('title'): Value<String>(
exercise['name'].toString().trim().replaceAll(whitespaceRE, " ")),
Symbol('description'): Value<String>(json.encode(exercise['instructions']
.toString()
.trim()
.replaceAll(whitespaceRE, " "))),
Symbol('title'): Value<String>(exercise['name']),
Symbol('description'):
Value<String>(json.encode(exercise['instructions'])),
Symbol('force'): Value<String>(exercise['force'] ?? "")
};

@ -3,11 +3,11 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_sound/public/flutter_sound_player.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:sendtrain/database/database.dart';
import 'package:sendtrain/models/action_model.dart';
import 'package:vibration/vibration.dart';
class ActionTimer with ChangeNotifier {
ActionModel? actionModel;
@ -56,7 +56,6 @@ class ActionTimer with ChangeNotifier {
void setup(ActionModel actionModel, ItemScrollController scrollController,
[bool resetOnLoad = true]) async {
_scrollControllers.clear();
_scrollControllers.add(scrollController);
if (resetOnLoad) {
@ -86,7 +85,7 @@ class ActionTimer with ChangeNotifier {
Uint8List? countTone;
Uint8List? finishTone;
await rootBundle
.load('assets/audio/count_tone.mp3')
.load('assets/audio/count_tone.wav')
.then((data) => countTone = data.buffer.asUint8List());
await rootBundle
.load('assets/audio/count_finish.mp3')
@ -103,25 +102,14 @@ class ActionTimer with ChangeNotifier {
_currentTime--;
if (_currentTime <= 3 && _currentTime != 0) {
await _mPlayer
.startPlayer(fromDataBuffer: countTone, codec: Codec.mp3)
.then((duration) async {
if (await Vibration.hasVibrator()) {
Vibration.vibrate(duration: 250);
}
});
await _mPlayer.startPlayer(
fromDataBuffer: countTone, codec: Codec.pcm16WAV);
}
if (_currentTime == 0) {
// move to next action
await _mPlayer
.startPlayer(fromDataBuffer: finishTone, codec: Codec.mp3)
.then((duration) async {
if (await Vibration.hasVibrator()) {
Vibration.vibrate(duration: 250);
}
});
await _mPlayer.startPlayer(
fromDataBuffer: finishTone, codec: Codec.mp3);
await setAction(state['currentAction'] + 1);
}

@ -254,8 +254,8 @@ class _ActivityActionEditorState extends State<ActivityActionEditor> {
// create action
await ActionsDao(db)
.createOrUpdate(ActionsCompanion(
title: Value('rep'),
description: Value('exercise action'),
title: Value('title'),
description: Value('description'),
totalSets: Value(int.parse(
actionEditController['sets']!
.text)),

@ -80,7 +80,7 @@ class _ActivityViewState extends State<ActivityView> {
distance: 70,
type: ExpandableFabType.up,
overlayStyle: ExpandableFabOverlayStyle(
color: Colors.black.withValues(alpha: 0.5),
color: Colors.black.withOpacity(0.5),
blur: 10,
),
onOpen: () {

@ -4,7 +4,7 @@ import 'package:sendtrain/providers/action_timer.dart';
Future showGenericDialog(dynamic object, BuildContext parentContext) {
return showGeneralDialog(
barrierColor: Colors.black.withValues(alpha: 0.5),
barrierColor: Colors.black.withOpacity(0.5),
transitionDuration: const Duration(milliseconds: 220),
transitionBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {

@ -78,7 +78,7 @@ class _SessionViewState extends State<SessionView> {
distance: 70,
type: ExpandableFabType.up,
overlayStyle: ExpandableFabOverlayStyle(
color: Colors.black.withValues(alpha: 0.5),
color: Colors.black.withOpacity(0.5),
blur: 10,
),
children: [

@ -53,7 +53,6 @@ dependencies:
dart_casing: ^3.0.1
collection: ^1.18.0
flutter_sound: ^9.23.1
vibration: ^3.1.2
flutter_launcher_name:
name: "SendTrain"