Unfocus search on tap away

This commit is contained in:
2025-04-09 09:01:40 +02:00
parent f841562fa4
commit e32f61a67e
12 changed files with 79 additions and 72 deletions

View File

@@ -96,13 +96,9 @@ PODS:
- nanopb/encode (= 3.30910.0)
- nanopb/decode (3.30910.0)
- nanopb/encode (3.30910.0)
- "no_screenshot (0.0.1+4)":
- Flutter
- ScreenProtectorKit (~> 1.3.1)
- printing (1.0.0):
- Flutter
- PromisesObjC (2.4.0)
- ScreenProtectorKit (1.3.1)
- SDWebImage (5.20.0):
- SDWebImage/Core (= 5.20.0)
- SDWebImage/Core (5.20.0)
@@ -128,7 +124,6 @@ DEPENDENCIES:
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`)
- local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
- no_screenshot (from `.symlinks/plugins/no_screenshot/ios`)
- printing (from `.symlinks/plugins/printing/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- syncfusion_flutter_pdfviewer (from `.symlinks/plugins/syncfusion_flutter_pdfviewer/ios`)
@@ -150,7 +145,6 @@ SPEC REPOS:
- MLKitVision
- nanopb
- PromisesObjC
- ScreenProtectorKit
- SDWebImage
- SwiftyGif
@@ -173,8 +167,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/local_auth_darwin/darwin"
mobile_scanner:
:path: ".symlinks/plugins/mobile_scanner/ios"
no_screenshot:
:path: ".symlinks/plugins/no_screenshot/ios"
printing:
:path: ".symlinks/plugins/printing/ios"
shared_preferences_foundation:
@@ -208,10 +200,8 @@ SPEC CHECKSUMS:
MLKitVision: 45e79d68845a2de77e2dd4d7f07947f0ed157b0e
mobile_scanner: af8f71879eaba2bbcb4d86c6a462c3c0e7f23036
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
no_screenshot: 6d183496405a3ab709a67a54e5cd0f639e94729e
printing: 54ff03f28fe9ba3aa93358afb80a8595a071dd07
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
ScreenProtectorKit: 83a6281b02c7a5902ee6eac4f5045f674e902ae4
SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4

View File

@@ -28,6 +28,10 @@ class MihApp extends StatefulWidget {
class _MihAppState extends State<MihApp> {
late PageController _pageController;
void unfocusAll() {
FocusScope.of(context).unfocus();
}
@override
void dispose() {
super.dispose();
@@ -55,69 +59,72 @@ class _MihAppState extends State<MihApp> {
@override
Widget build(BuildContext context) {
Size screenSize = MediaQuery.of(context).size;
return Scaffold(
drawer: widget.actionDrawer,
body: SafeArea(
child: Container(
width: screenSize.width,
height: screenSize.height,
//color: Colors.black,
padding: const EdgeInsets.only(top: 5),
child: Column(
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.appActionButton,
Flexible(child: widget.appTools),
],
),
Expanded(
child: PageView.builder(
controller: _pageController,
itemCount: widget.appBody.length,
itemBuilder: (context, index) {
return widget.appBody[index];
},
onPageChanged: (index) {
setState(() {
widget.selectedbodyIndex = index;
widget.onIndexChange(widget.selectedbodyIndex);
});
},
return GestureDetector(
onTap: unfocusAll,
child: Scaffold(
drawer: widget.actionDrawer,
body: SafeArea(
child: Container(
width: screenSize.width,
height: screenSize.height,
//color: Colors.black,
padding: const EdgeInsets.only(top: 5),
child: Column(
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.appActionButton,
Flexible(child: widget.appTools),
],
),
),
// Expanded(
// child: SwipeDetector(
// onSwipeLeft: (offset) {
// if (widget.selectedbodyIndex <
// widget.appTools.tools.length - 1) {
// setState(() {
// widget.selectedbodyIndex += 1;
// widget.onIndexChange(widget.selectedbodyIndex);
// });
// }
// // print("swipe left");
// },
// onSwipeRight: (offset) {
// if (widget.selectedbodyIndex > 0) {
// setState(() {
// widget.selectedbodyIndex -= 1;
// widget.onIndexChange(widget.selectedbodyIndex);
// });
// }
// // print("swipe right");
// },
// child: Row(
// children: [
// Expanded(
// child: widget.appBody[widget.selectedbodyIndex],
// )
// ],
// ),
// )),
],
Expanded(
child: PageView.builder(
controller: _pageController,
itemCount: widget.appBody.length,
itemBuilder: (context, index) {
return widget.appBody[index];
},
onPageChanged: (index) {
setState(() {
widget.selectedbodyIndex = index;
widget.onIndexChange(widget.selectedbodyIndex);
});
},
),
),
// Expanded(
// child: SwipeDetector(
// onSwipeLeft: (offset) {
// if (widget.selectedbodyIndex <
// widget.appTools.tools.length - 1) {
// setState(() {
// widget.selectedbodyIndex += 1;
// widget.onIndexChange(widget.selectedbodyIndex);
// });
// }
// // print("swipe left");
// },
// onSwipeRight: (offset) {
// if (widget.selectedbodyIndex > 0) {
// setState(() {
// widget.selectedbodyIndex -= 1;
// widget.onIndexChange(widget.selectedbodyIndex);
// });
// }
// // print("swipe right");
// },
// child: Row(
// children: [
// Expanded(
// child: widget.appBody[widget.selectedbodyIndex],
// )
// ],
// ),
// )),
],
),
),
),
),

View File

@@ -50,6 +50,7 @@ class _AboutMihState extends State<AboutMih> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -40,6 +40,7 @@ class _MihAccessState extends State<MihAccess> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -41,6 +41,7 @@ class _MIHCalculatorState extends State<MIHCalculator> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -41,6 +41,7 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -25,6 +25,7 @@ class _MzansiAiState extends State<MzansiAi> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -41,6 +41,7 @@ class _MzansiBusinessProfileState extends State<MzansiBusinessProfile> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -41,6 +41,7 @@ class _MzansiProfileState extends State<MzansiProfile> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -49,6 +49,7 @@ class _MihWalletState extends State<MihWallet> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -48,6 +48,7 @@ class _PatManagerState extends State<PatManager> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}

View File

@@ -42,6 +42,7 @@ class _PatientProfileState extends State<PatientProfile> {
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
FocusScope.of(context).unfocus();
},
);
}