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",
|
||||
"Exception: Please select your fitness level": "Please select your fitness level",
|
||||
"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",
|
||||
"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 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;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 7;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@ -405,7 +405,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.1.24;
|
||||
MARKETING_VERSION = 1.1.25;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@ -531,7 +531,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 7;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@ -548,7 +548,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.1.24;
|
||||
MARKETING_VERSION = 1.1.25;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@ -566,7 +566,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 7;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@ -583,7 +583,7 @@
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.1.24;
|
||||
MARKETING_VERSION = 1.1.25;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
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/exercise.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/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/enums.dart';
|
||||
import 'package:aitrainer_app/util/track.dart';
|
||||
@ -20,27 +22,48 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
||||
on<TrainingLogLoad>(_onLoad);
|
||||
on<TrainingLogDelete>(_onDelete);
|
||||
on<TrainingResultEvent>(_onResult);
|
||||
on<TrainingLogSearch>(_onSearch);
|
||||
}
|
||||
|
||||
final List<TrainingResult> _results = [];
|
||||
get results => this._results;
|
||||
|
||||
bool search = false;
|
||||
int exerciseTypeIdSearched = 0;
|
||||
|
||||
@override
|
||||
Future<void> close() {
|
||||
return super.close();
|
||||
}
|
||||
|
||||
void _onLoad(TrainingLogLoad event, Emitter<TrainingLogState> emit) async {
|
||||
emit(TrainingLogLoading());
|
||||
await Cache().setActivityDonePrefs(ActivityDone.isExerciseLogSeen);
|
||||
_results.clear();
|
||||
_results.addAll(getTrainingResults());
|
||||
Track().track(TrackingEvent.exercise_log_open);
|
||||
emit(TrainingLogReady());
|
||||
}
|
||||
|
||||
void _onDelete(TrainingLogDelete event, Emitter<TrainingLogState> emit) async {
|
||||
emit(TrainingLogLoading());
|
||||
exerciseRepository.exerciseList!.remove(event.exercise);
|
||||
await exerciseRepository.deleteExercise(event.exercise);
|
||||
Track().track(TrackingEvent.exercise_log_delete);
|
||||
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 {
|
||||
emit(TrainingLogLoading());
|
||||
Track().track(TrackingEvent.exercise_log_result);
|
||||
emit(TrainingLogReady());
|
||||
}
|
||||
@ -48,23 +71,57 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
||||
List<TrainingResult> getTrainingResults() {
|
||||
exerciseRepository.getExerciseList();
|
||||
exerciseRepository.sortByDate();
|
||||
final TrainingPlanRepository trainingPlanRepository = TrainingPlanRepository();
|
||||
|
||||
final List<TrainingResult> trainings = <TrainingResult>[];
|
||||
if (exerciseRepository.exerciseLogList == null) {
|
||||
return trainings;
|
||||
}
|
||||
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) {
|
||||
final ExerciseType? exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId!);
|
||||
final String exerciseName = isEnglish ? exerciseType!.name : exerciseType!.nameTranslation;
|
||||
final trainingPlanId = exercise.trainingPlanDetailsId;
|
||||
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(
|
||||
exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour, exercise.dateAdd!.minute, 0);
|
||||
final DateTime end = exercise.trainingPlanDetailsId == null
|
||||
? DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour,
|
||||
exercise.dateAdd!.minute + 2, 0)
|
||||
: DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour + 2,
|
||||
exercise.dateAdd!.minute, 0);
|
||||
: DateTime(exercise.dateAdd!.year, exercise.dateAdd!.month, exercise.dateAdd!.day, exercise.dateAdd!.hour,
|
||||
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;
|
||||
if (exerciseTypeIdSearched == exercise.exerciseTypeId) {
|
||||
color = Colors.redAccent;
|
||||
}
|
||||
|
||||
trainings.add(TrainingResult(
|
||||
exercise: exercise,
|
||||
eventName: exerciseName,
|
||||
@ -73,9 +130,13 @@ class TrainingLogBloc extends Bloc<TrainingLogEvent, TrainingLogState> {
|
||||
background: color,
|
||||
isAllDay: false,
|
||||
isTest: exercise.trainingPlanDetailsId == null ? true : false,
|
||||
isExercise: true,
|
||||
summary: exercise.summary,
|
||||
));
|
||||
});
|
||||
trainings.sort((a, b) {
|
||||
return a.from.compareTo(b.from) > 0 ? -1 : 1;
|
||||
});
|
||||
return trainings;
|
||||
}
|
||||
}
|
||||
@ -102,6 +163,7 @@ class TrainingDataSource extends CalendarDataSource {
|
||||
|
||||
@override
|
||||
Color getColor(int index) {
|
||||
//print("Color ${appointments![index].eventName} - ${appointments![index].background}");
|
||||
return appointments![index].background;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,14 @@ class TrainingResultEvent extends TrainingLogEvent {
|
||||
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 {
|
||||
const TrainingLogChange();
|
||||
}
|
||||
|
@ -2,14 +2,16 @@ import 'package:aitrainer_app/model/exercise.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TrainingResult {
|
||||
final Exercise exercise;
|
||||
final Exercise? exercise;
|
||||
final String eventName;
|
||||
final DateTime from;
|
||||
final DateTime to;
|
||||
final Color background;
|
||||
Color background;
|
||||
final bool isAllDay;
|
||||
final bool isTest;
|
||||
final bool isExercise;
|
||||
String? summary;
|
||||
bool search = false;
|
||||
|
||||
TrainingResult({
|
||||
required this.eventName,
|
||||
@ -19,6 +21,7 @@ class TrainingResult {
|
||||
required this.isAllDay,
|
||||
required this.exercise,
|
||||
required this.isTest,
|
||||
required this.isExercise,
|
||||
this.summary,
|
||||
});
|
||||
}
|
||||
|
@ -219,6 +219,32 @@ class _CustomerGoalPage extends State<CustomerGoalPage> with Trans {
|
||||
SizedBox(
|
||||
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") + ": ";
|
||||
} else if (index == 3) {
|
||||
exerciseElement = t("3rd Control") + ": ";
|
||||
} else {
|
||||
exerciseElement = "$index. " + t("exercise") + ": ";
|
||||
}
|
||||
index++;
|
||||
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/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/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/app_language.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.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:badges/badges.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.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))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final exerciseBloc = BlocProvider.of<TrainingLogBloc>(context);
|
||||
final bloc = BlocProvider.of<TrainingLogBloc>(context);
|
||||
return ModalProgressHUD(
|
||||
child: getTrainingLog(exerciseBloc),
|
||||
child: getTrainingLog(bloc),
|
||||
inAsyncCall: state is TrainingLogLoading,
|
||||
opacity: 0.5,
|
||||
color: Colors.black54,
|
||||
@ -54,7 +65,7 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(children: [
|
||||
getHeader(),
|
||||
getHeader(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(
|
||||
listItems: [],
|
||||
onFind: (value) {},
|
||||
listItems: menuBloc.menuTreeRepository.menuAsExercise,
|
||||
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(
|
||||
data: SfCalendarThemeData(brightness: Brightness.dark, backgroundColor: Colors.transparent),
|
||||
child: SfCalendar(
|
||||
dataSource: TrainingDataSource(bloc.getTrainingResults()),
|
||||
view: CalendarView.month,
|
||||
dataSource: TrainingDataSource(bloc.results),
|
||||
allowedViews: [
|
||||
CalendarView.day,
|
||||
CalendarView.week,
|
||||
CalendarView.month,
|
||||
CalendarView.day,
|
||||
],
|
||||
view: CalendarView.month,
|
||||
monthViewSettings: MonthViewSettings(
|
||||
showAgenda: true,
|
||||
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
||||
@ -91,87 +107,218 @@ class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
firstDayOfWeek: 1, // Monday
|
||||
selectionDecoration: BoxDecoration(
|
||||
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)),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
todayHighlightColor: Color(0xffb4f500),
|
||||
showNavigationArrow: true,
|
||||
showDatePickerButton: true,
|
||||
showDatePickerButton: false,
|
||||
allowViewNavigation: true,
|
||||
onTap: (detail) => {
|
||||
print("${detail.appointments}"),
|
||||
},
|
||||
appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) {
|
||||
final TrainingResult result = details.appointments.first;
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 8, top: 5, right: 5, bottom: 5),
|
||||
height: 70,
|
||||
color: result.isTest ? Colors.blue : Colors.orange,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 30,
|
||||
child: Text(result.eventName, style: GoogleFonts.inter(fontSize: 14, color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
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: () {},
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Icon(Icons.delete, color: Colors.black12),
|
||||
onPressed: () {},
|
||||
)
|
||||
]));
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
child: Badge(
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.all(0),
|
||||
position: BadgePosition.topEnd(top: -15, end: -17),
|
||||
animationDuration: Duration(milliseconds: 1500),
|
||||
animationType: BadgeAnimationType.fade,
|
||||
badgeColor: Colors.transparent,
|
||||
showBadge: true,
|
||||
badgeContent: result.isExercise
|
||||
? IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: 20,
|
||||
icon: Icon(Icons.delete, color: Colors.black26),
|
||||
onPressed: () => deleteConfirmation(bloc, result.exercise!),
|
||||
)
|
||||
: Offstage(),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 8, top: 5, right: 5, bottom: 5),
|
||||
width: details.bounds.width,
|
||||
height: details.bounds.height * 1.5,
|
||||
color: result.background,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [
|
||||
Flexible(
|
||||
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(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
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(" "),
|
||||
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.search
|
||||
? RichText(
|
||||
text: TextSpan(
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: t("The found exercises are")),
|
||||
TextSpan(text: " "),
|
||||
TextSpan(
|
||||
text: t("in red"),
|
||||
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.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.1.24+103
|
||||
version: 1.1.25+104
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user