This commit is contained in:
2024-09-20 14:05:39 +02:00
parent 43a9524c1f
commit 46c6ef251b

View File

@@ -439,184 +439,181 @@ class _HomeTileGridState extends State<HomeTileGrid> {
final Size size = MediaQuery.sizeOf(context); final Size size = MediaQuery.sizeOf(context);
final double width = size.width; final double width = size.width;
//final double height = size.height; //final double height = size.height;
return PopScope( return Scaffold(
canPop: false, drawerEnableOpenDragGesture: true,
child: Scaffold( drawer: MIHAppDrawer(
drawerEnableOpenDragGesture: true, signedInUser: widget.signedInUser,
drawer: MIHAppDrawer( propicFile: widget.propicFile,
signedInUser: widget.signedInUser, ),
propicFile: widget.propicFile, body: SafeArea(
), child: Stack(
body: SafeArea( children: [
child: Stack( Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Column( mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, children: [
mainAxisSize: MainAxisSize.max, const SizedBox(height: 20.0),
children: [ Text(
const SizedBox(height: 20.0), "Mzanzi Innovation Hub",
Text( textAlign: TextAlign.center,
"Mzanzi Innovation Hub", style: TextStyle(
textAlign: TextAlign.center, fontWeight: FontWeight.bold,
style: TextStyle( fontSize: 20.0,
fontWeight: FontWeight.bold, color: MzanziInnovationHub.of(context)!
fontSize: 20.0, .theme
color: MzanziInnovationHub.of(context)! .secondaryColor(),
.theme
.secondaryColor(),
),
), ),
const SizedBox(height: 20), ),
Row( const SizedBox(height: 20),
mainAxisAlignment: MainAxisAlignment.center, Row(
mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center,
children: [ mainAxisSize: MainAxisSize.max,
Flexible( children: [
flex: 4, Flexible(
child: KeyboardListener( flex: 4,
focusNode: _focusNode, child: KeyboardListener(
autofocus: true, focusNode: _focusNode,
onKeyEvent: (event) async { autofocus: true,
if (event is KeyDownEvent && onKeyEvent: (event) async {
event.logicalKey == LogicalKeyboardKey.enter) { if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.enter) {
setState(() {
appSearch = searchController.text;
});
}
},
child: SizedBox(
child: MIHSearchField(
controller: searchController,
hintText: "Search Mzansi Apps",
required: false,
editable: true,
onTap: () {
setState(() { setState(() {
appSearch = searchController.text; appSearch = searchController.text;
}); });
} },
},
child: SizedBox(
child: MIHSearchField(
controller: searchController,
hintText: "Search Mzansi Apps",
required: false,
editable: true,
onTap: () {
setState(() {
appSearch = searchController.text;
});
},
),
), ),
), ),
), ),
Flexible(
flex: 1,
child: IconButton(
//padding: const EdgeInsets.all(0),
onPressed: () {
setState(() {
appSearch = "";
searchController.clear();
});
},
icon: const Icon(
Icons.filter_alt_off,
size: 30,
),
),
),
],
),
const SizedBox(height: 10),
Expanded(
child: GridView.builder(
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];
},
), ),
), Flexible(
], flex: 1,
), child: IconButton(
// MIHAction( //padding: const EdgeInsets.all(0),
// icon: Icons.apps, onPressed: () {
// iconSize: 50, setState(() {
// onTap: () { appSearch = "";
// setState(() { searchController.clear();
// appSearch = ""; });
// searchController.clear(); },
// }); icon: const Icon(
// Scaffold.of(context).openDrawer(); Icons.filter_alt_off,
// }, size: 30,
// ), ),
Positioned( ),
top: 10, ),
left: 5, ],
width: 50, ),
height: 50, const SizedBox(height: 10),
child: Builder( Expanded(
builder: (context) => IconButton( child: GridView.builder(
padding: const EdgeInsets.all(0), padding: EdgeInsets.only(
onPressed: () { left: width / 10,
setState(() { right: width / 10,
appSearch = ""; //bottom: height / 5,
searchController.clear(); top: 20,
}); ),
Scaffold.of(context).openDrawer(); // 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];
}, },
icon: const Icon(
Icons.apps,
size: 50,
),
), ),
), ),
),
],
),
),
//),
// ],
// ),
bottomNavigationBar: Visibility(
visible: isBusinessUser(widget.signedInUser),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: GNav(
//hoverColor: Colors.lightBlueAccent,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
iconSize: 35.0,
activeColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
tabBackgroundColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
//gap: 20,
//padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.perm_identity,
text: "Personal",
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
),
GButton(
icon: Icons.business_center,
text: "Business",
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
),
], ],
selectedIndex: _selectedIndex,
), ),
// MIHAction(
// icon: Icons.apps,
// iconSize: 50,
// onTap: () {
// setState(() {
// appSearch = "";
// searchController.clear();
// });
// Scaffold.of(context).openDrawer();
// },
// ),
Positioned(
top: 10,
left: 5,
width: 50,
height: 50,
child: Builder(
builder: (context) => IconButton(
padding: const EdgeInsets.all(0),
onPressed: () {
setState(() {
appSearch = "";
searchController.clear();
});
Scaffold.of(context).openDrawer();
},
icon: const Icon(
Icons.apps,
size: 50,
),
),
),
),
],
),
),
//),
// ],
// ),
bottomNavigationBar: Visibility(
visible: isBusinessUser(widget.signedInUser),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: GNav(
//hoverColor: Colors.lightBlueAccent,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
iconSize: 35.0,
activeColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
tabBackgroundColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
//gap: 20,
//padding: EdgeInsets.all(15),
tabs: [
GButton(
icon: Icons.perm_identity,
text: "Personal",
onPressed: () {
setState(() {
_selectedIndex = 0;
});
},
),
GButton(
icon: Icons.business_center,
text: "Business",
onPressed: () {
setState(() {
_selectedIndex = 1;
});
},
),
],
selectedIndex: _selectedIndex,
), ),
), ),
), ),