fix swiope, now you can swipe from anywhere

This commit is contained in:
2024-11-07 15:14:19 +02:00
parent 85731b3eb6
commit 09f5e94f00

View File

@@ -703,24 +703,7 @@ class _MIHHomeState extends State<MIHHome> {
], ],
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
SwipeDetector( GridView.builder(
onSwipeLeft: (offset) {
if (_selectedIndex == 0) {
setState(() {
_selectedIndex = 1;
});
}
//print("swipe left");
},
onSwipeRight: (offset) {
if (_selectedIndex == 1) {
setState(() {
_selectedIndex = 0;
});
}
//print("swipe right");
},
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.only( padding: EdgeInsets.only(
@@ -738,7 +721,6 @@ class _MIHHomeState extends State<MIHHome> {
return searchApp(pbswitch[_selectedIndex], appSearch)[index]; return searchApp(pbswitch[_selectedIndex], appSearch)[index];
}, },
), ),
),
], ],
); );
} }
@@ -886,7 +868,24 @@ class _MIHHomeState extends State<MIHHome> {
final double width = size.width; final double width = size.width;
final double height = size.height; final double height = size.height;
return MIHLayoutBuilder( return SwipeDetector(
onSwipeLeft: (offset) {
if (_selectedIndex == 0) {
setState(() {
_selectedIndex = 1;
});
}
//print("swipe left");
},
onSwipeRight: (offset) {
if (_selectedIndex == 1) {
setState(() {
_selectedIndex = 0;
});
}
//print("swipe right");
},
child: MIHLayoutBuilder(
actionButton: getActionButton(), actionButton: getActionButton(),
header: getHeader(), header: getHeader(),
secondaryActionButton: getSecondaryActionButton(), secondaryActionButton: getSecondaryActionButton(),
@@ -896,6 +895,7 @@ class _MIHHomeState extends State<MIHHome> {
bottomNavBar: getBottomNavBar(), bottomNavBar: getBottomNavBar(),
pullDownToRefresh: true, pullDownToRefresh: true,
onPullDown: refreshNotifications, onPullDown: refreshNotifications,
),
); );
} }
} }