WT 1.1.25+2 training log search
This commit is contained in:
parent
4d22d98ae0
commit
72ae1c8f8c
@ -549,5 +549,8 @@
|
|||||||
"Total Repeats": "Total Repeats",
|
"Total Repeats": "Total Repeats",
|
||||||
"Exception: Please select your fitness level": "Please select your fitness level",
|
"Exception: Please select your fitness level": "Please select your fitness level",
|
||||||
"Exception: Please select your goal": "Please select your goal",
|
"Exception: Please select your goal": "Please select your goal",
|
||||||
"Exception: Please select your biologial gender": "Please select your biologial gender"
|
"Exception: Please select your biologial gender": "Please select your biologial gender",
|
||||||
|
"The found exercises are": "The found exercises are",
|
||||||
|
"in red": "in red",
|
||||||
|
"in your calendar": "in your calendar"
|
||||||
}
|
}
|
@ -549,5 +549,8 @@
|
|||||||
"Total Repeats": "Összes ismétlés",
|
"Total Repeats": "Összes ismétlés",
|
||||||
"Exception: Please select your fitness level": "Kérlek válaszd ki a fizikai állapotod",
|
"Exception: Please select your fitness level": "Kérlek válaszd ki a fizikai állapotod",
|
||||||
"Exception: Please select your goal": "Kérlek válaszd ki a célod",
|
"Exception: Please select your goal": "Kérlek válaszd ki a célod",
|
||||||
"Exception: Please select your biologial gender": "Kérlek válaszd ki a biológiai nemed"
|
"Exception: Please select your biologial gender": "Kérlek válaszd ki a biológiai nemed",
|
||||||
|
"The found exercises are": "A keresett gyakorlatot",
|
||||||
|
"in red": "pirossal",
|
||||||
|
"in your calendar": "jelöltük a naptárban"
|
||||||
}
|
}
|
@ -388,7 +388,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 7;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -405,7 +405,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.24;
|
MARKETING_VERSION = 1.1.25;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@ -531,7 +531,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 7;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -548,7 +548,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.24;
|
MARKETING_VERSION = 1.1.25;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@ -566,7 +566,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 7;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -583,7 +583,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)/Flutter",
|
"$(PROJECT_DIR)/Flutter",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.24;
|
MARKETING_VERSION = 1.1.25;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import 'package:aitrainer_app/model/cache.dart';
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
import 'package:aitrainer_app/model/exercise.dart';
|
import 'package:aitrainer_app/model/exercise.dart';
|
||||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
|
import 'package:aitrainer_app/model/training_plan.dart';
|
||||||
import 'package:aitrainer_app/model/training_result.dart';
|
import 'package:aitrainer_app/model/training_result.dart';
|
||||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
|
import 'package:aitrainer_app/repository/training_plan_repository.dart';
|
||||||
import 'package:aitrainer_app/util/app_language.dart';
|
import 'package:aitrainer_app/util/app_language.dart';
|
||||||
import 'package:aitrainer_app/util/enums.dart';
|
import 'package:aitrainer_app/util/enums.dart';
|
||||||
import 'package:aitrainer_app/util/track.dart';
|
import 'package:aitrainer_app/util/track.dart';
|
||||||
@ -20,27 +22,48 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
|||||||
on<TrainingLogLoad>(_onLoad);
|
on<TrainingLogLoad>(_onLoad);
|
||||||
on<TrainingLogDelete>(_onDelete);
|
on<TrainingLogDelete>(_onDelete);
|
||||||
on<TrainingResultEvent>(_onResult);
|
on<TrainingResultEvent>(_onResult);
|
||||||
|
on<TrainingLogSearch>(_onSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<TrainingResult> _results = [];
|
||||||
|
get results => this._results;
|
||||||
|
|
||||||
|
bool search = false;
|
||||||
|
int exerciseTypeIdSearched = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() {
|
Future<void> close() {
|
||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLoad(TrainingLogLoad event, Emitter<TrainingLogState> emit) async {
|
void _onLoad(TrainingLogLoad event, Emitter<TrainingLogState> emit) async {
|
||||||
|
emit(TrainingLogLoading());
|
||||||
await Cache().setActivityDonePrefs(ActivityDone.isExerciseLogSeen);
|
await Cache().setActivityDonePrefs(ActivityDone.isExerciseLogSeen);
|
||||||
|
_results.clear();
|
||||||
|
_results.addAll(getTrainingResults());
|
||||||
Track().track(TrackingEvent.exercise_log_open);
|
Track().track(TrackingEvent.exercise_log_open);
|
||||||
emit(TrainingLogReady());
|
emit(TrainingLogReady());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onDelete(TrainingLogDelete event, Emitter<TrainingLogState> emit) async {
|
void _onDelete(TrainingLogDelete event, Emitter<TrainingLogState> emit) async {
|
||||||
|
emit(TrainingLogLoading());
|
||||||
exerciseRepository.exerciseList!.remove(event.exercise);
|
exerciseRepository.exerciseList!.remove(event.exercise);
|
||||||
await exerciseRepository.deleteExercise(event.exercise);
|
await exerciseRepository.deleteExercise(event.exercise);
|
||||||
Track().track(TrackingEvent.exercise_log_delete);
|
Track().track(TrackingEvent.exercise_log_delete);
|
||||||
emit(TrainingLogReady());
|
emit(TrainingLogReady());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onSearch(TrainingLogSearch event, Emitter<TrainingLogState> emit) async {
|
||||||
|
emit(TrainingLogLoading());
|
||||||
|
exerciseTypeIdSearched = event.exerciseTypeId;
|
||||||
|
search = true;
|
||||||
|
_results.clear();
|
||||||
|
_results.addAll(getTrainingResults());
|
||||||
|
emit(TrainingLogReady());
|
||||||
|
}
|
||||||
|
|
||||||
void _onResult(TrainingResultEvent event, Emitter<TrainingLogState> emit) async {
|
void _onResult(TrainingResultEvent event, Emitter<TrainingLogState> emit) async {
|
||||||
|
emit(TrainingLogLoading());
|
||||||
Track().track(TrackingEvent.exercise_log_result);
|
Track().track(TrackingEvent.exercise_log_result);
|
||||||
emit(TrainingLogReady());
|
emit(TrainingLogReady());
|
||||||
}
|
}
|
||||||
@ -48,23 +71,57 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
|||||||
List<TrainingResult> getTrainingResults() {
|
List<TrainingResult> getTrainingResults() {
|
||||||
exerciseRepository.getExerciseList();
|
exerciseRepository.getExerciseList();
|
||||||
exerciseRepository.sortByDate();
|
exerciseRepository.sortByDate();
|
||||||
|
final TrainingPlanRepository trainingPlanRepository = TrainingPlanRepository();
|
||||||
|
|
||||||
final List<TrainingResult> trainings = <TrainingResult>[];
|
final List<TrainingResult> trainings = <TrainingResult>[];
|
||||||
if (exerciseRepository.exerciseLogList == null) {
|
if (exerciseRepository.exerciseLogList == null) {
|
||||||
return trainings;
|
return trainings;
|
||||||
}
|
}
|
||||||
bool isEnglish = AppLanguage().appLocal == Locale('en');
|
bool isEnglish = AppLanguage().appLocal == Locale('en');
|
||||||
|
int trainingPlanOrigId = 0;
|
||||||
|
exerciseRepository.exerciseLogList!.sort((a, b) {
|
||||||
|
return a.dateAdd!.compareTo(b.dateAdd!) > 0 ? 1 : -1;
|
||||||
|
});
|
||||||
exerciseRepository.exerciseLogList!.forEach((exercise) {
|
exerciseRepository.exerciseLogList!.forEach((exercise) {
|
||||||
final ExerciseType? exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId!);
|
final trainingPlanId = exercise.trainingPlanDetailsId;
|
||||||
final String exerciseName = isEnglish ? exerciseType!.name : exerciseType!.nameTranslation;
|
final DateTime startTraining = DateTime(
|
||||||
|
exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour, exercise.dateAdd!.minute - 5, 0);
|
||||||
final DateTime start = DateTime(
|
final DateTime start = DateTime(
|
||||||
exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour, exercise.dateAdd!.minute, 0);
|
exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour, exercise.dateAdd!.minute, 0);
|
||||||
final DateTime end = exercise.trainingPlanDetailsId == null
|
final DateTime end = exercise.trainingPlanDetailsId == null
|
||||||
? DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour,
|
? DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour,
|
||||||
exercise.dateAdd!.minute + 2, 0)
|
exercise.dateAdd!.minute + 2, 0)
|
||||||
: DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour + 2,
|
: DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour,
|
||||||
exercise.dateAdd!.minute, 0);
|
exercise.dateAdd!.minute + 10, 0);
|
||||||
|
if (trainingPlanId != null && trainingPlanId != trainingPlanOrigId) {
|
||||||
|
trainingPlanOrigId = trainingPlanId;
|
||||||
|
TrainingPlan? plan = trainingPlanRepository.getTrainingPlanById(trainingPlanId);
|
||||||
|
final String? trainingName = plan != null
|
||||||
|
? isEnglish
|
||||||
|
? plan.name
|
||||||
|
: plan.nameTranslations[AppLanguage().appLocal.toString()]
|
||||||
|
: "Training";
|
||||||
|
trainings.add(TrainingResult(
|
||||||
|
exercise: null,
|
||||||
|
eventName: trainingName != null ? trainingName : "",
|
||||||
|
from: startTraining,
|
||||||
|
to: DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour + 2,
|
||||||
|
exercise.dateAdd!.minute, 0),
|
||||||
|
background: Colors.orange[800]!,
|
||||||
|
isAllDay: false,
|
||||||
|
isTest: false,
|
||||||
|
isExercise: false,
|
||||||
|
summary: null,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
final ExerciseType? exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId!);
|
||||||
|
final String exerciseName = isEnglish ? exerciseType!.name : exerciseType!.nameTranslation;
|
||||||
|
|
||||||
Color color = exercise.trainingPlanDetailsId == null ? Colors.blue : Colors.orange;
|
Color color = exercise.trainingPlanDetailsId == null ? Colors.blue : Colors.orange;
|
||||||
|
if (exerciseTypeIdSearched == exercise.exerciseTypeId) {
|
||||||
|
color = Colors.redAccent;
|
||||||
|
}
|
||||||
|
|
||||||
trainings.add(TrainingResult(
|
trainings.add(TrainingResult(
|
||||||
exercise: exercise,
|
exercise: exercise,
|
||||||
eventName: exerciseName,
|
eventName: exerciseName,
|
||||||
@ -73,9 +130,13 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
|||||||
background: color,
|
background: color,
|
||||||
isAllDay: false,
|
isAllDay: false,
|
||||||
isTest: exercise.trainingPlanDetailsId == null ? true : false,
|
isTest: exercise.trainingPlanDetailsId == null ? true : false,
|
||||||
|
isExercise: true,
|
||||||
summary: exercise.summary,
|
summary: exercise.summary,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
trainings.sort((a, b) {
|
||||||
|
return a.from.compareTo(b.from) > 0 ? -1 : 1;
|
||||||
|
});
|
||||||
return trainings;
|
return trainings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,6 +163,7 @@ class TrainingDataSource extends CalendarDataSource {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Color getColor(int index) {
|
Color getColor(int index) {
|
||||||
|
//print("Color ${appointments![index].eventName} - ${appointments![index].background}");
|
||||||
return appointments![index].background;
|
return appointments![index].background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,14 @@ class TrainingResultEvent extends TrainingLogEvent {
|
|||||||
List<Object> get props => [exercise];
|
List<Object> get props => [exercise];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TrainingLogSearch extends TrainingLogEvent {
|
||||||
|
final int exerciseTypeId;
|
||||||
|
const TrainingLogSearch({required this.exerciseTypeId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [exerciseTypeId];
|
||||||
|
}
|
||||||
|
|
||||||
class TrainingLogChange extends TrainingLogEvent {
|
class TrainingLogChange extends TrainingLogEvent {
|
||||||
const TrainingLogChange();
|
const TrainingLogChange();
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,16 @@ import 'package:aitrainer_app/model/exercise.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class TrainingResult {
|
class TrainingResult {
|
||||||
final Exercise exercise;
|
final Exercise? exercise;
|
||||||
final String eventName;
|
final String eventName;
|
||||||
final DateTime from;
|
final DateTime from;
|
||||||
final DateTime to;
|
final DateTime to;
|
||||||
final Color background;
|
Color background;
|
||||||
final bool isAllDay;
|
final bool isAllDay;
|
||||||
final bool isTest;
|
final bool isTest;
|
||||||
|
final bool isExercise;
|
||||||
String? summary;
|
String? summary;
|
||||||
|
bool search = false;
|
||||||
|
|
||||||
TrainingResult({
|
TrainingResult({
|
||||||
required this.eventName,
|
required this.eventName,
|
||||||
@ -19,6 +21,7 @@ class TrainingResult {
|
|||||||
required this.isAllDay,
|
required this.isAllDay,
|
||||||
required this.exercise,
|
required this.exercise,
|
||||||
required this.isTest,
|
required this.isTest,
|
||||||
|
required this.isExercise,
|
||||||
this.summary,
|
this.summary,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -219,6 +219,32 @@ class _CustomerGoalPage extends State<CustomerGoalPage> with Trans {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: h,
|
height: h,
|
||||||
), */
|
), */
|
||||||
|
InkWell(
|
||||||
|
child: Text(
|
||||||
|
t('Login'),
|
||||||
|
style: GoogleFonts.inter(
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
shadows: <Shadow>[
|
||||||
|
Shadow(
|
||||||
|
offset: Offset(3.0, 3.0),
|
||||||
|
blurRadius: 6.0,
|
||||||
|
color: Colors.black54,
|
||||||
|
),
|
||||||
|
Shadow(
|
||||||
|
offset: Offset(-3.0, 3.0),
|
||||||
|
blurRadius: 6.0,
|
||||||
|
color: Colors.black54,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => Navigator.of(context).pushNamed('login'),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
@ -669,6 +669,8 @@ class EvaluationPage extends StatelessWidget with Trans {
|
|||||||
exerciseElement = t("2nd Control") + ": ";
|
exerciseElement = t("2nd Control") + ": ";
|
||||||
} else if (index == 3) {
|
} else if (index == 3) {
|
||||||
exerciseElement = t("3rd Control") + ": ";
|
exerciseElement = t("3rd Control") + ": ";
|
||||||
|
} else {
|
||||||
|
exerciseElement = "$index. " + t("exercise") + ": ";
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
resultList.add(RichText(
|
resultList.add(RichText(
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
|
import 'dart:collection';
|
||||||
|
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:aitrainer_app/bloc/training_log/training_log_bloc.dart';
|
import 'package:aitrainer_app/bloc/training_log/training_log_bloc.dart';
|
||||||
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
|
import 'package:aitrainer_app/model/exercise.dart';
|
||||||
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
import 'package:aitrainer_app/model/training_result.dart';
|
import 'package:aitrainer_app/model/training_result.dart';
|
||||||
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
|
import 'package:aitrainer_app/util/app_language.dart';
|
||||||
import 'package:aitrainer_app/util/common.dart';
|
import 'package:aitrainer_app/util/common.dart';
|
||||||
import 'package:aitrainer_app/util/trans.dart';
|
import 'package:aitrainer_app/util/trans.dart';
|
||||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||||
|
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||||
import 'package:aitrainer_app/widgets/menu_search_bar.dart';
|
import 'package:aitrainer_app/widgets/menu_search_bar.dart';
|
||||||
|
import 'package:badges/badges.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
@ -27,9 +38,9 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
|||||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||||
}
|
}
|
||||||
}, builder: (context, state) {
|
}, builder: (context, state) {
|
||||||
final exerciseBloc = BlocProvider.of<TrainingLogBloc>(context);
|
final bloc = BlocProvider.of<TrainingLogBloc>(context);
|
||||||
return ModalProgressHUD(
|
return ModalProgressHUD(
|
||||||
child: getTrainingLog(exerciseBloc),
|
child: getTrainingLog(bloc),
|
||||||
inAsyncCall: state is TrainingLogLoading,
|
inAsyncCall: state is TrainingLogLoading,
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
color: Colors.black54,
|
color: Colors.black54,
|
||||||
@ -54,7 +65,7 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 10, right: 10),
|
padding: EdgeInsets.only(left: 10, right: 10),
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
getHeader(),
|
getHeader(bloc),
|
||||||
getCalendar(bloc),
|
getCalendar(bloc),
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
@ -62,10 +73,16 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getSearchBar() {
|
Widget getSearchBar(TrainingLogBloc bloc) {
|
||||||
|
final MenuBloc menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||||
return MenuSearchBar(
|
return MenuSearchBar(
|
||||||
listItems: [],
|
listItems: menuBloc.menuTreeRepository.menuAsExercise,
|
||||||
onFind: (value) {},
|
onFind: (value) {
|
||||||
|
print("Found exercise $value");
|
||||||
|
if (value != null) {
|
||||||
|
bloc.add(TrainingLogSearch(exerciseTypeId: value.exerciseTypeId));
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,13 +91,12 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
|||||||
child: SfCalendarTheme(
|
child: SfCalendarTheme(
|
||||||
data: SfCalendarThemeData(brightness: Brightness.dark, backgroundColor: Colors.transparent),
|
data: SfCalendarThemeData(brightness: Brightness.dark, backgroundColor: Colors.transparent),
|
||||||
child: SfCalendar(
|
child: SfCalendar(
|
||||||
dataSource: TrainingDataSource(bloc.getTrainingResults()),
|
dataSource: TrainingDataSource(bloc.results),
|
||||||
view: CalendarView.month,
|
|
||||||
allowedViews: [
|
allowedViews: [
|
||||||
CalendarView.day,
|
|
||||||
CalendarView.week,
|
|
||||||
CalendarView.month,
|
CalendarView.month,
|
||||||
|
CalendarView.day,
|
||||||
],
|
],
|
||||||
|
view: CalendarView.month,
|
||||||
monthViewSettings: MonthViewSettings(
|
monthViewSettings: MonthViewSettings(
|
||||||
showAgenda: true,
|
showAgenda: true,
|
||||||
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
||||||
@ -91,87 +107,218 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
|||||||
firstDayOfWeek: 1, // Monday
|
firstDayOfWeek: 1, // Monday
|
||||||
selectionDecoration: BoxDecoration(
|
selectionDecoration: BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(color: Colors.red, width: 2),
|
border: Border.all(color: Color(0xffb4f500), width: 2),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||||
shape: BoxShape.rectangle,
|
shape: BoxShape.rectangle,
|
||||||
),
|
),
|
||||||
todayHighlightColor: Color(0xffb4f500),
|
todayHighlightColor: Color(0xffb4f500),
|
||||||
showNavigationArrow: true,
|
showNavigationArrow: true,
|
||||||
showDatePickerButton: true,
|
showDatePickerButton: false,
|
||||||
allowViewNavigation: true,
|
allowViewNavigation: true,
|
||||||
onTap: (detail) => {
|
|
||||||
print("${detail.appointments}"),
|
|
||||||
},
|
|
||||||
appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) {
|
appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) {
|
||||||
final TrainingResult result = details.appointments.first;
|
final TrainingResult result = details.appointments.first;
|
||||||
return Container(
|
return ClipRRect(
|
||||||
padding: EdgeInsets.only(left: 8, top: 5, right: 5, bottom: 5),
|
borderRadius: BorderRadius.circular(6.0),
|
||||||
height: 70,
|
child: Badge(
|
||||||
color: result.isTest ? Colors.blue : Colors.orange,
|
elevation: 0,
|
||||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
padding: EdgeInsets.all(0),
|
||||||
Flexible(
|
position: BadgePosition.topEnd(top: -15, end: -17),
|
||||||
fit: FlexFit.tight,
|
animationDuration: Duration(milliseconds: 1500),
|
||||||
flex: 30,
|
animationType: BadgeAnimationType.fade,
|
||||||
child: Text(result.eventName, style: GoogleFonts.inter(fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold)),
|
badgeColor: Colors.transparent,
|
||||||
),
|
showBadge: true,
|
||||||
Flexible(
|
badgeContent: result.isExercise
|
||||||
fit: FlexFit.tight,
|
? IconButton(
|
||||||
flex: 25,
|
padding: EdgeInsets.zero,
|
||||||
child: Text(
|
iconSize: 20,
|
||||||
result.summary == null ? "" : result.summary!,
|
icon: Icon(Icons.delete, color: Colors.black26),
|
||||||
style: TextStyle(fontSize: 12, color: Colors.white),
|
onPressed: () => deleteConfirmation(bloc, result.exercise!),
|
||||||
)),
|
)
|
||||||
IconButton(
|
: Offstage(),
|
||||||
padding: EdgeInsets.zero,
|
child: Container(
|
||||||
icon: Icon(Icons.info_outline, color: Color(0xffb4f500)),
|
padding: EdgeInsets.only(left: 8, top: 5, right: 5, bottom: 5),
|
||||||
onPressed: () {},
|
width: details.bounds.width,
|
||||||
),
|
height: details.bounds.height * 1.5,
|
||||||
IconButton(
|
color: result.background,
|
||||||
padding: EdgeInsets.zero,
|
child: Row(mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [
|
||||||
icon: Icon(Icons.delete, color: Colors.black12),
|
Flexible(
|
||||||
onPressed: () {},
|
fit: FlexFit.tight,
|
||||||
)
|
flex: 30,
|
||||||
]));
|
child: Text(result.eventName,
|
||||||
|
style: GoogleFonts.inter(
|
||||||
|
fontSize: result.isExercise ? 14 : 16, color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: result.isExercise,
|
||||||
|
child: Flexible(
|
||||||
|
fit: FlexFit.tight,
|
||||||
|
flex: 25,
|
||||||
|
child: Text(
|
||||||
|
result.summary == null ? "" : result.summary!,
|
||||||
|
style: TextStyle(fontSize: 12, color: Colors.white),
|
||||||
|
))),
|
||||||
|
IconButton(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
icon: Icon(Icons.info_outline, color: Color(0xffb4f500)),
|
||||||
|
onPressed: () => result.isExercise ? evaluation(bloc.exerciseRepository, result.exercise!) : trainingEvaluation(),
|
||||||
|
),
|
||||||
|
/* */
|
||||||
|
])),
|
||||||
|
));
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getHeader() {
|
void deleteConfirmation(TrainingLogBloc bloc, Exercise exercise) {
|
||||||
|
ExerciseType? exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId!);
|
||||||
|
String exerciseName = AppLanguage().appLocal == Locale("en") ? exerciseType!.name : exerciseType!.nameTranslation;
|
||||||
|
|
||||||
|
String strDate = AppLanguage().appLocal == Locale("en")
|
||||||
|
? "on the " + DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd!.toUtc())
|
||||||
|
: DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd!.toUtc()) + "-n";
|
||||||
|
|
||||||
|
final String unitQuantity = exercise.unitQuantity == null ? "" : "x" + exercise.unitQuantity!.toStringAsFixed(0);
|
||||||
|
|
||||||
|
showCupertinoDialog(
|
||||||
|
useRootNavigator: true,
|
||||||
|
context: context,
|
||||||
|
//barrierDismissible: false,
|
||||||
|
builder: (_) => CupertinoAlertDialog(
|
||||||
|
title: Text(t("Are you sure to delete this exercise?")),
|
||||||
|
content: Column(children: [
|
||||||
|
Divider(),
|
||||||
|
Text(
|
||||||
|
t("Exercise") + ": " + exerciseName,
|
||||||
|
style: (TextStyle(color: Colors.blue)),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
exercise.quantity!.toStringAsFixed(0) + unitQuantity + " ",
|
||||||
|
style: (TextStyle(color: Colors.deepOrange)),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
strDate,
|
||||||
|
style: (TextStyle(color: Colors.deepOrange)),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(t("No")),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text(t("Yes")),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
if (!Cache().hasPurchased) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return DialogPremium(
|
||||||
|
unlocked: Cache().hasPurchased,
|
||||||
|
unlockRound: 1,
|
||||||
|
unlockedText: t("Enjoy also this premium fetaure to delete mistyped old exercises."),
|
||||||
|
function: "Delete Exercise",
|
||||||
|
onTap: () => {Navigator.of(context).pop()},
|
||||||
|
onCancel: () => {Navigator.of(context).pop()},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
bloc.add(TrainingLogDelete(exercise: exercise));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
void trainingEvaluation() {}
|
||||||
|
|
||||||
|
void evaluation(ExerciseRepository exerciseRepository, Exercise exercise) {
|
||||||
|
if (Cache().userLoggedIn != null) {
|
||||||
|
if (!Cache().hasPurchased) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return DialogPremium(
|
||||||
|
unlocked: Cache().hasPurchased,
|
||||||
|
unlockRound: 1,
|
||||||
|
unlockedText: t("Enjoy also this premium feature to show all old evaluation data of your successful exercises."),
|
||||||
|
function: "My Exercise Logs",
|
||||||
|
onTap: () => {Navigator.of(context).pop()},
|
||||||
|
onCancel: () => {Navigator.of(context).pop()},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
LinkedHashMap args = LinkedHashMap();
|
||||||
|
args['exerciseRepository'] = exerciseRepository;
|
||||||
|
args['exercise'] = exercise;
|
||||||
|
args['past'] = true;
|
||||||
|
Navigator.of(context).pushNamed('evaluationPage', arguments: args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getHeader(TrainingLogBloc bloc) {
|
||||||
return Card(
|
return Card(
|
||||||
color: Colors.white60,
|
color: Colors.white60,
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
child: Column(children: [
|
||||||
child: Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.info,
|
Icons.info,
|
||||||
color: Colors.orangeAccent,
|
color: Colors.orangeAccent,
|
||||||
|
),
|
||||||
|
Text(" "),
|
||||||
|
Text(
|
||||||
|
t("My Exercise Logs"),
|
||||||
|
style: GoogleFonts.inter(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(),
|
||||||
|
Flexible(
|
||||||
|
fit: FlexFit.tight,
|
||||||
|
flex: 5,
|
||||||
|
child: getSearchBar(bloc),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(" "),
|
bloc.search
|
||||||
Text(
|
? RichText(
|
||||||
t("My Exercise Logs"),
|
text: TextSpan(
|
||||||
style: GoogleFonts.inter(
|
style: GoogleFonts.inter(
|
||||||
fontSize: 16,
|
fontSize: 14,
|
||||||
color: Colors.white,
|
fontWeight: FontWeight.normal,
|
||||||
fontWeight: FontWeight.bold,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
children: [
|
||||||
Divider(),
|
TextSpan(text: t("The found exercises are")),
|
||||||
Flexible(
|
TextSpan(text: " "),
|
||||||
fit: FlexFit.tight,
|
TextSpan(
|
||||||
flex: 5,
|
text: t("in red"),
|
||||||
child: getSearchBar(),
|
style: GoogleFonts.inter(
|
||||||
)
|
fontSize: 14,
|
||||||
],
|
fontWeight: FontWeight.normal,
|
||||||
),
|
color: Colors.redAccent,
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: " "),
|
||||||
|
TextSpan(text: t("in your calendar")),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
: Offstage()
|
||||||
|
])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.1.24+103
|
version: 1.1.25+104
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user