mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-05 13:07:36 +01:00
Add "Contribute an exercise" to "No matching exercise" suggestion
Created noItemsFoundBuilder callback for typeAheadFormField in exercise search form.
This commit is contained in:
@@ -30,6 +30,7 @@ import 'package:wger/models/workouts/weight_unit.dart';
|
||||
import 'package:wger/models/workouts/workout_plan.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/screens/add_exercise_screen.dart';
|
||||
import 'package:wger/screens/workout_plan_screen.dart';
|
||||
import 'package:wger/widgets/exercises/images.dart';
|
||||
|
||||
@@ -423,7 +424,25 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
),
|
||||
);
|
||||
},
|
||||
noItemsFoundBuilder: (context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).noMatchingExerciseFound),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(AddExerciseScreen.routeName);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context).contributeExercise),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
transitionBuilder: (context, suggestionsBox, controller) {
|
||||
// TODO: Return suggestion box w/ button
|
||||
return suggestionsBox;
|
||||
},
|
||||
onSuggestionSelected: (ExerciseBase exerciseSuggestion) {
|
||||
|
||||
Reference in New Issue
Block a user