Skip to content

Commit

Permalink
fixed maxY
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalraja committed Mar 7, 2024
1 parent f54d47b commit 8bca378
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/app_drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class AppDrawerState extends State<AppDrawerPage> with WidgetsBindingObserver {
if (_scaffoldKey.currentState != null && event.runtimeType.toString() == "RawKeyDownEvent") {
var orient = MediaQuery.of(context).orientation;
var maxX = orient == Orientation.portrait ? 4 : 9;
var maxY = (filteredApps()!.length / (maxX + 1)).floor() - 1;
var maxY = (filteredApps()!.length / (maxX + 1)).ceil() - 1;
var state = _scaffoldKey.currentState!;
var key = event.logicalKey.keyLabel;
if (key == "Arrow Left") {
Expand Down Expand Up @@ -306,7 +306,7 @@ class AppDrawerState extends State<AppDrawerPage> with WidgetsBindingObserver {
appLoc[1] = 0;
}
}
var itemHeight = appGridController.position.maxScrollExtent / maxY;
double itemHeight = maxY > 0 ? appGridController.position.maxScrollExtent / maxY : 0;
appGridController.animateTo(appLoc[1] * itemHeight, duration: Duration(milliseconds: 100), curve: Curves.linear);
setState(() {
appLoc = appLoc;
Expand Down

0 comments on commit 8bca378

Please sign in to comment.