Skip to content

Commit

Permalink
fix:统一动作、训练、计划的分类为同一个列表;修正训练的动作组为空时不显示“开始”按钮。
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanotsu committed Dec 29, 2023
1 parent 9c23d19 commit 47700f0
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 48 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> -->
<application
android:label="Free Fitness"
android:name="${applicationName}"
Expand Down
10 changes: 1 addition & 9 deletions lib/common/global/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ List<CusLabel> countingOptions = [
CusLabel(enLabel: 'counted', cnLabel: "计次", value: 'counted'),
];

// 这个分类除了exercise外,plan计划也用这个
// 这个分类除了exercise外,group、plan计划也用这个
List<CusLabel> categoryOptions = [
CusLabel(enLabel: 'strength', cnLabel: "力量", value: 'strength'),
CusLabel(enLabel: 'stretching', cnLabel: "拉伸", value: 'stretching'),
Expand All @@ -378,14 +378,6 @@ List<CusLabel> categoryOptions = [
CusLabel(enLabel: 'other', cnLabel: "其他", value: 'other'),
];

// 训练组的分类示例(???可以考虑也用上面那一个?)
List<CusLabel> groupCategoryOptions = [
CusLabel(enLabel: 'chest training', cnLabel: "练胸", value: 'chest_training'),
CusLabel(enLabel: 'arm training', cnLabel: "练臂", value: 'arm_training'),
CusLabel(enLabel: 'slimming', cnLabel: "减肥", value: 'slimming'),
CusLabel(enLabel: 'other', cnLabel: "其他", value: 'other'),
];

List<CusLabel> equipmentOptions = [
CusLabel(enLabel: 'body', cnLabel: "无器械", value: 'body'),
CusLabel(enLabel: 'body only', cnLabel: "仅身体", value: 'body only'),
Expand Down
6 changes: 2 additions & 4 deletions lib/views/me/_feature_mock_data/test_funcs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ Future<int> _insertOneRandomGroup() async {
var group = TrainingGroup(
groupName: generateRandomString(5, 20),
groupCategory:
groupCategoryOptions[Random().nextInt(groupCategoryOptions.length)]
.value,
categoryOptions[Random().nextInt(categoryOptions.length)].value,
groupLevel: levelOptions[Random().nextInt(levelOptions.length)].value,
consumption: Random().nextInt(1000),
timeSpent: Random().nextInt(100),
Expand Down Expand Up @@ -393,8 +392,7 @@ insertTrainingDetailLogDemo({int? size = 10}) async {
// 单次记录,有计划及其训练日,就没有训练编号了;反之亦然
groupName: generateRandomString(5, 20),
groupCategory:
groupCategoryOptions[Random().nextInt(groupCategoryOptions.length)]
.value,
categoryOptions[Random().nextInt(categoryOptions.length)].value,
groupLevel: levelOptions[Random().nextInt(levelOptions.length)].value,
consumption: Random().nextInt(1000),
// 起止时间就测试插入时的1个小时
Expand Down
2 changes: 1 addition & 1 deletion lib/views/training/plans/group_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class _GroupListState extends State<GroupList> {
TextSpan(
text: '\n${getCusLabelText(
groupItem.groupCategory,
groupCategoryOptions,
categoryOptions,
)}',
style: TextStyle(color: Theme.of(context).shadowColor),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/views/training/workouts/action_config_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void showConfigDialog(
CusAL.of(context).saveLabel,
style: TextStyle(
fontSize: CusFontSizes.buttonMedium,
color: Theme.of(context).primaryColor,
// color: Theme.of(context).primaryColor,
),
),
),
Expand Down
61 changes: 32 additions & 29 deletions lib/views/training/workouts/action_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,36 +235,39 @@ class _ActionListState extends State<ActionList> {
: SizedBox(
height: 50.sp,
width: 0.6.sw,
child: ElevatedButton(
onPressed: () {
/// 点击开始跟练
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ActionFollowPracticeWithTTS(
// 虽然计划编号、训练日 和训练编号都有传,但理论上两者不会同时存在也不会同时为空
plan: widget.planItem,
dayNumber: widget.dayNumber,
// 有计划编号,就不传训练编号了
group:
widget.planItem != null ? null : widget.groupItem,
// 动作组数据是必须要传的
actionList: actionList,
child: (actionList.isNotEmpty)
? ElevatedButton(
onPressed: () {
/// 点击开始跟练
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ActionFollowPracticeWithTTS(
// 虽然计划编号、训练日 和训练编号都有传,但理论上两者不会同时存在也不会同时为空
plan: widget.planItem,
dayNumber: widget.dayNumber,
// 有计划编号,就不传训练编号了
group: widget.planItem != null
? null
: widget.groupItem,
// 动作组数据是必须要传的
actionList: actionList,
),
),
);
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.sp), // 设置圆角
),
backgroundColor: Colors.green,
),
),
);
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.sp), // 设置圆角
),
backgroundColor: Colors.green,
),
child: Text(
CusAL.of(context).startLabel,
style: TextStyle(fontSize: CusFontSizes.pageTitle),
),
),
child: Text(
CusAL.of(context).startLabel,
style: TextStyle(fontSize: CusFontSizes.pageTitle),
),
)
: Container(),
),
// 悬浮按钮位置
floatingActionButtonLocation: _isEditing
Expand Down
6 changes: 3 additions & 3 deletions lib/views/training/workouts/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class _TrainingWorkoutsState extends State<TrainingWorkouts> {
Expanded(
child: cusFormBuilerDropdown(
"group_category",
groupCategoryOptions,
categoryOptions,
labelText: CusAL.of(context).workoutQuerys('1'),
optionFontSize: CusFontSizes.itemContent,
),
Expand Down Expand Up @@ -275,7 +275,7 @@ class _TrainingWorkoutsState extends State<TrainingWorkouts> {
),
TextSpan(
text:
'${getCusLabelText(groupItem.group.groupCategory, groupCategoryOptions)}',
'${getCusLabelText(groupItem.group.groupCategory, categoryOptions)}',
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium?.color,
),
Expand Down Expand Up @@ -412,7 +412,7 @@ class _TrainingWorkoutsState extends State<TrainingWorkouts> {
),
cusFormBuilerDropdown(
"group_category",
groupCategoryOptions,
categoryOptions,
labelText: '*${CusAL.of(context).workoutQuerys('1')}',
validator: FormBuilderValidators.required(),
),
Expand Down
4 changes: 4 additions & 0 deletions readme-merged.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,8 @@

- fix:修正饮食记录添加摄入条目的餐次下拉按钮样式。

### 2023-12-29

- fix:统一动作、训练、计划的分类为同一个列表;修正训练的动作组为空时不显示“开始”按钮。

flutter build apk --split-per-abi

0 comments on commit 47700f0

Please sign in to comment.