-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ui Changes and Added functionality of designation * Updated kserverLink,kAuthUrl and gradle ver (7.4.2) --------- Co-authored-by: TusharGupta03 <[email protected]>
- Loading branch information
1 parent
838008a
commit d329bf3
Showing
17 changed files
with
1,543 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:fusion/constants.dart'; | ||
import 'package:fusion/services/service_locator.dart'; | ||
import 'package:fusion/services/storage_service.dart'; | ||
|
||
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget { | ||
final String curr_desig; | ||
final String headerTitle; | ||
|
||
final ValueChanged<String> onDesignationChanged; | ||
|
||
const CustomAppBar({ | ||
Key? key, | ||
required this.curr_desig, | ||
required this.headerTitle, | ||
|
||
required this.onDesignationChanged, | ||
}) : super(key: key); | ||
|
||
@override | ||
_CustomAppBarState createState() => _CustomAppBarState(); | ||
|
||
@override | ||
Size get preferredSize => Size.fromHeight(kToolbarHeight); | ||
} | ||
|
||
class _CustomAppBarState extends State<CustomAppBar> { | ||
late List<String> designations; | ||
late String current; | ||
var service = locator<StorageService>(); | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
designations = (service!.getFromDisk('designations') as List<dynamic>) | ||
.map((dynamic item) => item.toString()) | ||
.toList(); | ||
|
||
current = service!.getFromDisk( | ||
'Current_designation'); // Ensure designations is not null before accessing index 0 | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AppBar( | ||
iconTheme: IconThemeData(color: Colors.white), | ||
backgroundColor: kPrimaryColor, | ||
title: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Flexible( | ||
child: Padding( | ||
padding: EdgeInsets.only(right: 20.0), // Add some right padding to ensure space for the dropdown | ||
child: Text( | ||
widget.headerTitle, // Example of a long title | ||
overflow: TextOverflow.ellipsis, // Prevents overflow by adding ellipsis | ||
style: TextStyle( | ||
color: Colors.white, | ||
fontSize: 20, | ||
fontWeight: FontWeight.bold, | ||
), | ||
), | ||
), | ||
), | ||
DropdownButtonHideUnderline( | ||
child: DropdownButton<String>( | ||
padding: const EdgeInsets.all(15), | ||
borderRadius: BorderRadius.circular(5), | ||
value: current, | ||
icon: Icon(Icons.arrow_drop_down, color: Colors.white), | ||
iconSize: 24, | ||
style: TextStyle(color: Colors.white, fontSize: 18), | ||
dropdownColor: | ||
kPrimaryColor, // Set the dropdown background color to orange | ||
onChanged: (String? newValue) { | ||
widget.onDesignationChanged(newValue!); | ||
setState(() { | ||
current = newValue!; | ||
service!.saveToDisk('Current_designation', current); | ||
}); | ||
}, | ||
items: designations.map<DropdownMenuItem<String>>((String value) { | ||
return DropdownMenuItem<String>( | ||
value: value, | ||
child: Text( | ||
value, | ||
style: TextStyle( | ||
color: Colors.white), // Set the text color to white | ||
), | ||
); | ||
}).toList(), | ||
onTap: () { | ||
// Find the index of the selected value | ||
int index = designations.indexOf(current); | ||
// Scroll the dropdown to the selected value | ||
Scrollable.ensureVisible(context, | ||
alignment: 0.5, duration: Duration(milliseconds: 300)); | ||
}, | ||
), | ||
), | ||
], | ||
), | ||
actions: <Widget>[], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class MyBottomNavigationBar extends StatefulWidget { | ||
@override | ||
_MyBottomNavigationBarState createState() => _MyBottomNavigationBarState(); | ||
} | ||
|
||
class _MyBottomNavigationBarState extends State<MyBottomNavigationBar> { | ||
bool _notificationsBool = false; | ||
bool _announcementsBool = false; | ||
bool _newsBool = false; | ||
bool _homeBool = false; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
height: 100.0, | ||
child: Padding( | ||
padding: EdgeInsets.only(bottom: 40), | ||
child: Card( | ||
color: Colors.deepOrangeAccent, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(17.0), | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.only( | ||
left: 13.0, right: 10.0, top: 5.0, bottom: 5.0), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
GestureDetector( | ||
onTap: () { | ||
_notificationsBool = false; | ||
_announcementsBool = false; | ||
_newsBool = false; | ||
_homeBool = true; | ||
setState(() { | ||
_notificationsBool = false; | ||
_announcementsBool = false; | ||
_newsBool = false; | ||
_homeBool = true; | ||
}); | ||
Navigator.pushReplacementNamed(context, "/dashboard"); | ||
|
||
}, | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Icon( | ||
Icons.home_rounded, | ||
color: Colors.white, | ||
size: _homeBool ? 30.0 : 25.0, | ||
), | ||
], | ||
), | ||
), | ||
GestureDetector( | ||
onTap: () { | ||
_newsBool = true; | ||
_announcementsBool = false; | ||
_notificationsBool = false; | ||
_homeBool = false; | ||
|
||
setState(() { | ||
_newsBool = true; | ||
_announcementsBool = false; | ||
_notificationsBool = false; | ||
_homeBool = false; | ||
}); | ||
Navigator.pushReplacementNamed(context, "/news"); | ||
}, | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Icon( | ||
Icons.newspaper_rounded, | ||
color: Colors.white, | ||
size: _newsBool ? 30.0 : 25.0, | ||
), | ||
], | ||
), | ||
), | ||
GestureDetector( | ||
onTap: () { | ||
_announcementsBool = false; | ||
_newsBool = false; | ||
_notificationsBool = true; | ||
_homeBool = false; | ||
|
||
setState(() { | ||
_announcementsBool = false; | ||
_newsBool = false; | ||
_notificationsBool = true; | ||
_homeBool = false; | ||
}); | ||
Navigator.pushReplacementNamed(context, "/notification"); | ||
}, | ||
child: Padding( | ||
padding: const EdgeInsets.only(right: 16.0), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Icon( | ||
Icons.notifications_active_rounded, | ||
color: Colors.white, | ||
size: _notificationsBool ? 30.0 : 25.0, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
GestureDetector( | ||
onTap: () { | ||
_announcementsBool = true; | ||
_newsBool = false; | ||
_notificationsBool = false; | ||
_homeBool = false; | ||
|
||
setState(() { | ||
_announcementsBool = true; | ||
_newsBool = false; | ||
_notificationsBool = false; | ||
_homeBool = false; | ||
}); | ||
Navigator.pushReplacementNamed(context, "/announcement"); | ||
}, | ||
child: Padding( | ||
padding: const EdgeInsets.only(right: 16.0), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Icon( | ||
Icons.campaign_rounded, | ||
color: Colors.white, | ||
size: _announcementsBool ? 30.0 : 25.0, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.