mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Add an additional step when adding exercises
This commit is contained in:
@@ -574,7 +574,8 @@
|
||||
"images": "Images",
|
||||
"language": "Language",
|
||||
"addExercise": "Add exercise",
|
||||
"baseData": "Base data",
|
||||
"translation": "Translation",
|
||||
"baseData": "Basics in English",
|
||||
"@baseData": {
|
||||
"description": "The base data for an exercise such as category, trained muscles, etc."
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class AddExerciseScreen extends StatefulWidget {
|
||||
const AddExerciseScreen({Key? key}) : super(key: key);
|
||||
|
||||
static const routeName = '/exercises/add';
|
||||
static const STEPS_IN_FORM = 4;
|
||||
static const STEPS_IN_FORM = 5;
|
||||
|
||||
@override
|
||||
_AddExerciseScreenState createState() => _AddExerciseScreenState();
|
||||
@@ -38,6 +38,7 @@ class _AddExerciseScreenState extends State<AddExerciseScreen> {
|
||||
GlobalKey<FormState>(),
|
||||
GlobalKey<FormState>(),
|
||||
GlobalKey<FormState>(),
|
||||
GlobalKey<FormState>(),
|
||||
GlobalKey<FormState>()
|
||||
];
|
||||
|
||||
@@ -83,14 +84,18 @@ class _AddExerciseScreenState extends State<AddExerciseScreen> {
|
||||
title: Text(AppLocalizations.of(context).variations),
|
||||
content: _DuplicatesAndVariationsStepContent(formkey: _keys[1]),
|
||||
),
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context).description),
|
||||
content: _DescriptionStepContent(formkey: _keys[3]),
|
||||
),
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context).translation),
|
||||
content: _DescriptionTranslationStepContent(formkey: _keys[4]),
|
||||
),
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context).images),
|
||||
content: _ImagesStepContent(formkey: _keys[2]),
|
||||
),
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context).description),
|
||||
content: _DescriptionStepContent(formkey: _keys[3]),
|
||||
)
|
||||
],
|
||||
currentStep: _currentStep,
|
||||
onStepContinue: () {
|
||||
@@ -148,6 +153,22 @@ class _BasicStepContent extends StatelessWidget {
|
||||
key: formkey,
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('All exercises need a base name in English'),
|
||||
AddExerciseTextArea(
|
||||
onChange: (value) => {},
|
||||
title: '${AppLocalizations.of(context).name}*',
|
||||
isRequired: true,
|
||||
validator: (name) => name?.isEmpty ?? true ? 'Name is required' : null,
|
||||
onSaved: (String? name) => addExerciseProvider.exerciseNameEn = name!,
|
||||
),
|
||||
AddExerciseTextArea(
|
||||
onChange: (value) => {},
|
||||
title: AppLocalizations.of(context).alternativeNames,
|
||||
isMultiline: true,
|
||||
helperText: AppLocalizations.of(context).oneNamePerLine,
|
||||
onSaved: (String? alternateName) =>
|
||||
addExerciseProvider.alternateNamesEn = alternateName!.split('\n'),
|
||||
),
|
||||
ExerciseCategoryInputWidget<ExerciseCategory>(
|
||||
categories: categories,
|
||||
title: AppLocalizations.of(context).category,
|
||||
@@ -279,23 +300,6 @@ class _DescriptionStepContent extends StatelessWidget {
|
||||
key: formkey,
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('All exercises need a base name in English'),
|
||||
const Text('*** Add flag here ***'),
|
||||
AddExerciseTextArea(
|
||||
onChange: (value) => {},
|
||||
title: '${AppLocalizations.of(context).name}*',
|
||||
isRequired: true,
|
||||
validator: (name) => name?.isEmpty ?? true ? 'Name is required' : null,
|
||||
onSaved: (String? name) => addExerciseProvider.exerciseNameEn = name!,
|
||||
),
|
||||
AddExerciseTextArea(
|
||||
onChange: (value) => {},
|
||||
title: AppLocalizations.of(context).alternativeNames,
|
||||
isMultiline: true,
|
||||
helperText: AppLocalizations.of(context).oneNamePerLine,
|
||||
onSaved: (String? alternateName) =>
|
||||
addExerciseProvider.alternateNamesEn = alternateName!.split('\n'),
|
||||
),
|
||||
AddExerciseTextArea(
|
||||
onChange: (value) => {},
|
||||
title: '${AppLocalizations.of(context).description}*',
|
||||
@@ -304,7 +308,27 @@ class _DescriptionStepContent extends StatelessWidget {
|
||||
validator: (name) => name?.isEmpty ?? true ? 'Name is required' : null,
|
||||
onSaved: (String? description) => addExerciseProvider.descriptionEn = description!,
|
||||
),
|
||||
const Text('*** Add flag here ***'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DescriptionTranslationStepContent extends StatelessWidget {
|
||||
final GlobalKey<FormState> formkey;
|
||||
const _DescriptionTranslationStepContent({required this.formkey});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final addExerciseProvider = context.read<AddExerciseProvider>();
|
||||
final exerciseProvider = context.read<ExercisesProvider>();
|
||||
|
||||
final languages = exerciseProvider.languages;
|
||||
|
||||
return Form(
|
||||
key: formkey,
|
||||
child: Column(
|
||||
children: [
|
||||
ExerciseCategoryInputWidget<Language>(
|
||||
categories: languages,
|
||||
title: AppLocalizations.of(context).language,
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -112,7 +112,7 @@ packages:
|
||||
name: camera
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.4+14"
|
||||
version: "0.9.4+17"
|
||||
camera_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -383,7 +383,7 @@ packages:
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_svg
|
||||
url: "https://pub.dartlang.org"
|
||||
@@ -475,7 +475,7 @@ packages:
|
||||
name: image_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.4+9"
|
||||
version: "0.8.4+11"
|
||||
image_picker_for_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -567,6 +567,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -588,6 +595,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
multi_select_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: multi_select_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -879,7 +893,7 @@ packages:
|
||||
name: table_calendar
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
version: "3.0.5"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -893,7 +907,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.3"
|
||||
version: "0.4.8"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user