WT 1.1.25+1 training log
This commit is contained in:
@@ -2,7 +2,6 @@ import 'dart:collection';
|
||||
import 'package:aitrainer_app/bloc/exercise_log/exercise_log_bloc.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_common.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
import 'package:aitrainer_app/bloc/training_log/training_log_bloc.dart';
|
||||
import 'package:aitrainer_app/model/training_result.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/menu_search_bar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
import 'package:syncfusion_flutter_core/theme.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MyDevelopmentLog extends StatelessWidget with Trans, Common {
|
||||
MyDevelopmentLog({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
return BlocProvider(
|
||||
create: (context) => TrainingLogBloc()..add(TrainingLogLoad()),
|
||||
child: BlocConsumer<TrainingLogBloc, TrainingLogState>(listener: (context, state) {
|
||||
if (state is TrainingLogError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final exerciseBloc = BlocProvider.of<TrainingLogBloc>(context);
|
||||
return ModalProgressHUD(
|
||||
child: getTrainingLog(exerciseBloc),
|
||||
inAsyncCall: state is TrainingLogLoading,
|
||||
opacity: 0.5,
|
||||
color: Colors.black54,
|
||||
progressIndicator: CircularProgressIndicator(),
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
Widget getTrainingLog(TrainingLogBloc bloc) {
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_plainblack_background.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(children: [
|
||||
getHeader(),
|
||||
getCalendar(bloc),
|
||||
]),
|
||||
)),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSearchBar() {
|
||||
return MenuSearchBar(
|
||||
listItems: [],
|
||||
onFind: (value) {},
|
||||
);
|
||||
}
|
||||
|
||||
Widget getCalendar(TrainingLogBloc bloc) {
|
||||
return Expanded(
|
||||
child: SfCalendarTheme(
|
||||
data: SfCalendarThemeData(brightness: Brightness.dark, backgroundColor: Colors.transparent),
|
||||
child: SfCalendar(
|
||||
dataSource: TrainingDataSource(bloc.getTrainingResults()),
|
||||
view: CalendarView.month,
|
||||
allowedViews: [
|
||||
CalendarView.day,
|
||||
CalendarView.week,
|
||||
CalendarView.month,
|
||||
],
|
||||
monthViewSettings: MonthViewSettings(
|
||||
showAgenda: true,
|
||||
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
||||
showTrailingAndLeadingDates: true,
|
||||
),
|
||||
appointmentTimeTextFormat: 'HH:mm',
|
||||
headerDateFormat: "y MMMM",
|
||||
firstDayOfWeek: 1, // Monday
|
||||
selectionDecoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(color: Colors.red, width: 2),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
todayHighlightColor: Color(0xffb4f500),
|
||||
showNavigationArrow: true,
|
||||
showDatePickerButton: true,
|
||||
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: () {},
|
||||
)
|
||||
]));
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
Widget getHeader() {
|
||||
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,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: 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(),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/enums.dart';
|
||||
import 'package:aitrainer_app/util/track.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_common.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_html.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -67,7 +66,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
child: ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: t("My Exercise Logs"),
|
||||
text: t("My Training Logs"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
@@ -76,7 +75,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
|
||||
onTap: () => Navigator.of(context).pushNamed('mydevelopmentLog', arguments: args),
|
||||
isLocked: false,
|
||||
)),
|
||||
Badge(
|
||||
|
||||
@@ -158,9 +158,10 @@ class _ExerciseTabs extends State<ExerciseTabs> with TickerProviderStateMixin {
|
||||
}
|
||||
|
||||
Widget getTabs(TrainingPlanBloc bloc) {
|
||||
final String tabName = bloc.getMyPlan() != null && bloc.getMyPlan()!.name != null ? bloc.getMyPlan()!.name! : "";
|
||||
return Column(children: [
|
||||
Text(
|
||||
bloc.getMyPlan()!.name!,
|
||||
tabName,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
|
||||
Reference in New Issue
Block a user