From 9e78f54cc8944b59e08f7346b979256e8b8d094e Mon Sep 17 00:00:00 2001 From: Luke Knoble <35696371+Desync-o-tron@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:57:09 -0400 Subject: [PATCH] keyboard test --- lib/exercises/ex_search_page.dart | 54 ++++++++++--------- lib/history/history_page.dart | 20 +++---- lib/importing/ex_match_listview.dart | 12 +++-- lib/importing/import_training_first_page.dart | 8 --- 4 files changed, 45 insertions(+), 49 deletions(-) diff --git a/lib/exercises/ex_search_page.dart b/lib/exercises/ex_search_page.dart index cf049bc..cc208f5 100644 --- a/lib/exercises/ex_search_page.dart +++ b/lib/exercises/ex_search_page.dart @@ -89,37 +89,39 @@ class _ExerciseSearchPageState extends State { } 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, diff --git a/lib/history/history_page.dart b/lib/history/history_page.dart index 625058a..0f90714 100644 --- a/lib/history/history_page.dart +++ b/lib/history/history_page.dart @@ -72,16 +72,6 @@ class HistoryPage extends StatelessWidget { Widget _hamburgerMenuActions(BuildContext context) { return PopupMenuButton( icon: const Icon(Icons.more_horiz_outlined, size: 30), - onSelected: (String result) { - final cubit = context.read(); - 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) => >[ const PopupMenuItem( value: 'import', @@ -96,6 +86,16 @@ class HistoryPage extends StatelessWidget { child: Text('Refresh training history cache'), ), ], + onSelected: (String result) { + final cubit = context.read(); + 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(); + } + }, ); } } diff --git a/lib/importing/ex_match_listview.dart b/lib/importing/ex_match_listview.dart index 2310175..197c720 100644 --- a/lib/importing/ex_match_listview.dart +++ b/lib/importing/ex_match_listview.dart @@ -41,11 +41,13 @@ class _MatchExercisesScrollViewState extends State { 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); + }, + ), ), ), ), diff --git a/lib/importing/import_training_first_page.dart b/lib/importing/import_training_first_page.dart index 908e9e6..e4f6d1c 100644 --- a/lib/importing/import_training_first_page.dart +++ b/lib/importing/import_training_first_page.dart @@ -64,14 +64,6 @@ class _ImportTrainingDataPageState extends State { ), ), ); - - /* - - for (var session in sessions) { - myStorage.addTrainingSessionToHistory(session); - } - - */ } Row setAsDefaultUnitsSwitch() {