Skip to content

Commit

Permalink
keyboard test
Browse files Browse the repository at this point in the history
  • Loading branch information
Desync-o-tron committed Oct 9, 2024
1 parent 15c8e39 commit 9e78f54
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 49 deletions.
54 changes: 28 additions & 26 deletions lib/exercises/ex_search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,37 +89,39 @@ class _ExerciseSearchPageState extends State<ExerciseSearchPage> {
} else {
pageChildren.add(
Text('Exercise Match', style: Theme.of(context).textTheme.headlineSmall));
// pageChildren.add(ExerciseTile(
// exercise: widget.foreignEx!,
// isSelectable: false,
// colorDecoration: true,
// ));
pageChildren.add(ExerciseTile(
exercise: widget.foreignEx!,
isSelectable: false,
colorDecoration: true,
));
pageChildren.add(Text('To', style: Theme.of(context).textTheme.bodyMedium));
}
pageChildren.addAll([
_exListView(scrollController, filteredExercises),
SearchBar(
onKeywordChanged: (value) {
setState(() {
keyword = value;
});
},
),
_muscleAndCategoryFilterButtons(context, exercisesState),
]);

if (widget.useForAddingToTraining) {
pageChildren.add(_addSelectedButton(context));
}
if (widget.useForMappingForeignExercise) {
final isKeyboardOpen = MediaQuery.of(context).viewInsets.bottom > 0;
if (!isKeyboardOpen) {
pageChildren.addAll([
_thisIsMyExButton(widget.setForeignExerciseCallback!),
_noExerciseMatchButton(widget.setForeignExerciseCallback!),
_exListView(scrollController, filteredExercises),
SearchBar(
onKeywordChanged: (value) {
setState(() {
keyword = value;
});
},
),
_muscleAndCategoryFilterButtons(context, exercisesState),
]);
} else {
pageChildren.add(_createNewExButton(context));
}

if (widget.useForAddingToTraining) {
pageChildren.add(_addSelectedButton(context));
}
if (widget.useForMappingForeignExercise) {
pageChildren.addAll([
_thisIsMyExButton(widget.setForeignExerciseCallback!),
_noExerciseMatchButton(widget.setForeignExerciseCallback!),
]);
} else {
pageChildren.add(_createNewExButton(context));
}
}
return SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down
20 changes: 10 additions & 10 deletions lib/history/history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ class HistoryPage extends StatelessWidget {
Widget _hamburgerMenuActions(BuildContext context) {
return PopupMenuButton<String>(
icon: const Icon(Icons.more_horiz_outlined, size: 30),
onSelected: (String result) {
final cubit = context.read<TrainingHistoryCubit>();
if (result == 'import') {
appRouter.push(routeNames.ImportExternalAppHistory.text);
} else if (result == 'refresh training history') {
cubit.loadUserTrainingHistory(useCache: false);
} else if (result == 'rm all') {
cubit.deleteEntireTrainingHistory();
}
},
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
const PopupMenuItem<String>(
value: 'import',
Expand All @@ -96,6 +86,16 @@ class HistoryPage extends StatelessWidget {
child: Text('Refresh training history cache'),
),
],
onSelected: (String result) {
final cubit = context.read<TrainingHistoryCubit>();
if (result == 'import') {
appRouter.push(routeNames.ImportExternalAppHistory.text);
} else if (result == 'refresh training history') {
cubit.loadUserTrainingHistory(useCache: false);
} else if (result == 'rm all') {
cubit.deleteEntireTrainingHistory();
}
},
);
}
}
Expand Down
12 changes: 7 additions & 5 deletions lib/importing/ex_match_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class _MatchExercisesScrollViewState extends State<MatchExercisesScrollView> {
Expanded(
child: Container(
decoration: BoxDecoration(border: Border.all()),
child: ListView.builder(
itemCount: widget.exerciseMatches.length,
itemBuilder: (context, index) {
return _buildExerciseMatchTile(index);
},
child: Scrollbar(
child: ListView.builder(
itemCount: widget.exerciseMatches.length,
itemBuilder: (context, index) {
return _buildExerciseMatchTile(index);
},
),
),
),
),
Expand Down
8 changes: 0 additions & 8 deletions lib/importing/import_training_first_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ class _ImportTrainingDataPageState extends State<ImportTrainingDataPage> {
),
),
);

/*
for (var session in sessions) {
myStorage.addTrainingSessionToHistory(session);
}
*/
}

Row setAsDefaultUnitsSwitch() {
Expand Down

0 comments on commit 9e78f54

Please sign in to comment.