fix swiope, now you can swipe from anywhere
This commit is contained in:
@@ -703,41 +703,23 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
SwipeDetector(
|
GridView.builder(
|
||||||
onSwipeLeft: (offset) {
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
if (_selectedIndex == 0) {
|
shrinkWrap: true,
|
||||||
setState(() {
|
padding: EdgeInsets.only(
|
||||||
_selectedIndex = 1;
|
left: width / 10,
|
||||||
});
|
right: width / 10,
|
||||||
}
|
//bottom: height / 5,
|
||||||
//print("swipe left");
|
//top: 20,
|
||||||
},
|
|
||||||
onSwipeRight: (offset) {
|
|
||||||
if (_selectedIndex == 1) {
|
|
||||||
setState(() {
|
|
||||||
_selectedIndex = 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//print("swipe right");
|
|
||||||
},
|
|
||||||
child: GridView.builder(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: width / 10,
|
|
||||||
right: width / 10,
|
|
||||||
//bottom: height / 5,
|
|
||||||
//top: 20,
|
|
||||||
),
|
|
||||||
// physics: ,
|
|
||||||
// shrinkWrap: true,
|
|
||||||
itemCount: searchApp(pbswitch[_selectedIndex], appSearch).length,
|
|
||||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
|
||||||
mainAxisSpacing: 15, maxCrossAxisExtent: 200),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return searchApp(pbswitch[_selectedIndex], appSearch)[index];
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
// physics: ,
|
||||||
|
// shrinkWrap: true,
|
||||||
|
itemCount: searchApp(pbswitch[_selectedIndex], appSearch).length,
|
||||||
|
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
|
mainAxisSpacing: 15, maxCrossAxisExtent: 200),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return searchApp(pbswitch[_selectedIndex], appSearch)[index];
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -886,16 +868,34 @@ 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(
|
||||||
actionButton: getActionButton(),
|
onSwipeLeft: (offset) {
|
||||||
header: getHeader(),
|
if (_selectedIndex == 0) {
|
||||||
secondaryActionButton: getSecondaryActionButton(),
|
setState(() {
|
||||||
body: getBody(width, height),
|
_selectedIndex = 1;
|
||||||
actionDrawer: getActionDrawer(),
|
});
|
||||||
secondaryActionDrawer: getSecondaryActionDrawer(),
|
}
|
||||||
bottomNavBar: getBottomNavBar(),
|
//print("swipe left");
|
||||||
pullDownToRefresh: true,
|
},
|
||||||
onPullDown: refreshNotifications,
|
onSwipeRight: (offset) {
|
||||||
|
if (_selectedIndex == 1) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//print("swipe right");
|
||||||
|
},
|
||||||
|
child: MIHLayoutBuilder(
|
||||||
|
actionButton: getActionButton(),
|
||||||
|
header: getHeader(),
|
||||||
|
secondaryActionButton: getSecondaryActionButton(),
|
||||||
|
body: getBody(width, height),
|
||||||
|
actionDrawer: getActionDrawer(),
|
||||||
|
secondaryActionDrawer: getSecondaryActionDrawer(),
|
||||||
|
bottomNavBar: getBottomNavBar(),
|
||||||
|
pullDownToRefresh: true,
|
||||||
|
onPullDown: refreshNotifications,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user