layout changes
This commit is contained in:
parent
5c31a33ff2
commit
15992c4008
@ -307,13 +307,25 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
// appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -321,11 +333,14 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
|
||||
Widget buildGroupListLayout(bool isDesktop) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// color: Colors.white,
|
||||
// width: 3.5)),
|
||||
child: buildTableLayout(isDesktop),
|
||||
);
|
||||
}
|
||||
@ -341,25 +356,26 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
}
|
||||
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
padding: const EdgeInsets.all(10),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// padding: const EdgeInsets.all(10),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(1.0),
|
||||
child: Container(
|
||||
@ -368,7 +384,10 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 2),
|
||||
// Divider(
|
||||
// thickness: 0.2, // how "thick" the line is
|
||||
// color: Colors.grey, // optional
|
||||
// ),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -382,16 +401,6 @@ class _ApprovalListState extends State<ApprovalList> {
|
||||
color: Color(0xFF212121))),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Divider(
|
||||
thickness: 0.2, // how "thick" the line is
|
||||
color: Colors.grey, // optional
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.2,
|
||||
// or use Flexible
|
||||
|
||||
@ -178,7 +178,7 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
const Text(
|
||||
"Welcome To Travel Spends",
|
||||
"Welcome To TravelSpends",
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontFamily: "Nunito",
|
||||
|
||||
@ -9,27 +9,19 @@ class HomePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInfo) {
|
||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||
|
||||
return Scaffold(
|
||||
appBar: isDesktop ? null : const CustomAppBar(title:'Home'),
|
||||
appBar: isDesktop ? null : const CustomAppBar(),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body:
|
||||
Row(
|
||||
body: Row(
|
||||
children: [
|
||||
if(isDesktop)
|
||||
CustomDrawer(isDesktop: true),
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
const Expanded(child: Center(child: Text("Home Page Content"))),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,13 +324,23 @@ class _groupState extends State<Group> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildData(isDesktop, context))
|
||||
],
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildData(isDesktop, context))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -339,17 +349,20 @@ class _groupState extends State<Group> {
|
||||
Widget buildData(bool isDesktop, context) {
|
||||
return Container(
|
||||
// margin: const EdgeInsets.only(left: 10.0, right: 15.0, top: 10.0, bottom: 10.0),
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// width: 3.5)),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
// color: Color(0xFFE1F5FE),
|
||||
child: buildOrganizationLayout(isDesktop),
|
||||
),
|
||||
),
|
||||
@ -373,25 +386,26 @@ class _groupState extends State<Group> {
|
||||
|
||||
Widget buildOrganizationLayout(isDesktop) {
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
//
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@ -132,13 +132,23 @@ class _GroupListState extends State<GroupList> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -146,11 +156,14 @@ class _GroupListState extends State<GroupList> {
|
||||
|
||||
Widget buildGroupListLayout(bool isDesktop) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// width: 3.5)),
|
||||
child: buildGroupData(isDesktop),
|
||||
);
|
||||
}
|
||||
@ -163,25 +176,26 @@ class _GroupListState extends State<GroupList> {
|
||||
|
||||
Widget buildGroupData(isDesktop) {
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
padding: const EdgeInsets.all(10),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// padding: const EdgeInsets.all(10),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
|
||||
@ -184,7 +184,7 @@ class TaxiListWidget extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passernger",
|
||||
"${getRequestForTaxiClass(item["car_type"]!.toString())} For ${item["no_of_passengers"]!} Passenger",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
|
||||
@ -331,13 +331,23 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildOrganizationLayout(isDesktop))
|
||||
],
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildOrganizationLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -345,10 +355,13 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
|
||||
Widget buildOrganizationLayout(isDesktop) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
color: bodyColor,
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// width: 3.5)),
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -401,24 +414,25 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
}
|
||||
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
|
||||
@ -59,11 +59,13 @@ class _OrganizationListState extends State<OrganizationList> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
// appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
|
||||
@ -67,13 +67,25 @@ class _CreatePlansState extends State<CreatePlan> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(
|
||||
child:
|
||||
buildUserTable(isDesktop, context, bodyColor, layoutColor)),
|
||||
],
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(
|
||||
child: buildUserTable(
|
||||
isDesktop, context, bodyColor, layoutColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -99,11 +111,15 @@ class _CreatePlansState extends State<CreatePlan> {
|
||||
|
||||
return Container(
|
||||
// margin: const EdgeInsets.only(left: 10.0, right: 15.0, top: 10.0, bottom: 10.0),
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// width: 3.5)),
|
||||
child: Column(
|
||||
children: [
|
||||
// Container(
|
||||
@ -133,26 +149,27 @@ class _CreatePlansState extends State<CreatePlan> {
|
||||
// ),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(
|
||||
left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
padding: const EdgeInsets.all(10),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(
|
||||
// left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// padding: const EdgeInsets.all(10),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
|
||||
// color: bodyColor,
|
||||
child: SingleChildScrollView(
|
||||
|
||||
@ -233,13 +233,25 @@ class _ListPlansState extends State<ListPlans> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
// appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupListLayout(isDesktop))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -247,11 +259,14 @@ class _ListPlansState extends State<ListPlans> {
|
||||
|
||||
Widget buildGroupListLayout(bool isDesktop) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// color: Colors.white,
|
||||
// width: 3.5)),
|
||||
child: buildTableLayout(isDesktop),
|
||||
);
|
||||
}
|
||||
@ -278,7 +293,8 @@ class _ListPlansState extends State<ListPlans> {
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
@ -294,7 +310,10 @@ class _ListPlansState extends State<ListPlans> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(height: 2),
|
||||
// Divider(
|
||||
// thickness: 0.2, // how "thick" the line is
|
||||
// color: Colors.grey, // optional
|
||||
// ),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -308,16 +327,8 @@ class _ListPlansState extends State<ListPlans> {
|
||||
color: Color(0xFF212121))),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Divider(
|
||||
thickness: 0.2, // how "thick" the line is
|
||||
color: Colors.grey, // optional
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Spacer(),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.2,
|
||||
// or use Flexible
|
||||
@ -573,30 +584,33 @@ class _ListPlansState extends State<ListPlans> {
|
||||
height: 25,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: plan.statusValue ==
|
||||
"Partially Approved"
|
||||
? Colors.yellow.shade100
|
||||
: plan.statusValue == "Approved"
|
||||
? Colors.green.shade100
|
||||
: plan.statusValue == "Completed"
|
||||
? Colors.green.shade500
|
||||
: plan.statusValue == "Rejected"
|
||||
? Colors.red.shade100
|
||||
: Colors.grey.shade100,
|
||||
color: getStatusColor(plan.statusValue),
|
||||
// color: plan.statusValue ==
|
||||
// "Partially Approved"
|
||||
// ? Colors.yellow.shade100
|
||||
// : plan.statusValue == "Approved"
|
||||
// ? Colors.green.shade100
|
||||
// : plan.statusValue == "Completed"
|
||||
// ? Colors.green.shade500
|
||||
// : plan.statusValue == "Rejected"
|
||||
// ? Colors.red.shade100
|
||||
// : Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
plan.statusValue,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: (plan.statusValue ==
|
||||
"Partially Approved" ||
|
||||
plan.statusValue == "Approved" ||
|
||||
plan.statusValue == "Rejected")
|
||||
? Colors.black
|
||||
: plan.statusValue == "Completed"
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
color:
|
||||
getStatusTextColor(plan.statusValue),
|
||||
// color: (plan.statusValue ==
|
||||
// "Partially Approved" ||
|
||||
// plan.statusValue == "Approved" ||
|
||||
// plan.statusValue == "Rejected")
|
||||
// ? Colors.black
|
||||
// : plan.statusValue == "Completed"
|
||||
// ? Colors.white
|
||||
// : Colors.grey,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
@ -667,4 +681,24 @@ class _ListPlansState extends State<ListPlans> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Helper functions for colors
|
||||
Color getStatusColor(String status) {
|
||||
if (status == "Partially Approved") return Colors.yellow.shade100;
|
||||
if (status == "Approved") return Colors.green.shade100;
|
||||
if (status == "Completed") return Colors.green.shade500;
|
||||
if (status == "Rejected") return Colors.red.shade100;
|
||||
return Colors.grey.shade100;
|
||||
}
|
||||
|
||||
Color getStatusTextColor(String status) {
|
||||
if (status == "Partially Approved" ||
|
||||
status == "Approved" ||
|
||||
status == "Rejected") {
|
||||
return Colors.black;
|
||||
} else if (status == "Completed") {
|
||||
return Colors.white;
|
||||
}
|
||||
return Colors.grey;
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,26 +380,36 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Policy'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
|
||||
Expanded(child: buildData(isDesktop, context)),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// color: bodyColor,
|
||||
// child: buildPolicyLayout(isDesktop),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
Expanded(child: buildData(isDesktop, context)),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// color: bodyColor,
|
||||
// child: buildPolicyLayout(isDesktop),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Row(
|
||||
@ -440,16 +450,20 @@ class _PolicyState extends State<Policy> {
|
||||
Widget buildData(bool isDesktop, context) {
|
||||
return Container(
|
||||
// margin: const EdgeInsets.only(left: 10.0, right: 15.0, top: 10.0, bottom: 10.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFE1F5FE),
|
||||
// color: bodyColor,
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// // color: bodyColor,
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// width: 3.5)),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
// color: Color(0xFFE1F5FE),
|
||||
child: buildPolicyLayout(isDesktop),
|
||||
),
|
||||
),
|
||||
@ -473,24 +487,25 @@ class _PolicyState extends State<Policy> {
|
||||
|
||||
Widget buildPolicyLayout(bool isDesktop) {
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@ -139,14 +139,24 @@ class _PolicyListState extends State<PolicyList> {
|
||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Home'),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupList(isDesktop))
|
||||
],
|
||||
backgroundColor: Colors.white54,
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
Expanded(child: buildGroupList(isDesktop))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@ -154,36 +164,40 @@ class _PolicyListState extends State<PolicyList> {
|
||||
|
||||
Widget buildGroupList(bool isDesktop) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
color: Color(0xFFE1F5FE),
|
||||
// color: bodyColor,
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// // color: bodyColor,
|
||||
// border: Border.all(
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// color: Colors.white,
|
||||
// width: 3.5)),
|
||||
child: buildGroupListLayout(isDesktop),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildGroupListLayout(bool isDesktop) {
|
||||
return Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
padding: const EdgeInsets.all(10),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// padding: const EdgeInsets.all(10),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
|
||||
@ -663,14 +663,23 @@ class _CreateUserFormState extends State<CreateUserForm> {
|
||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||
|
||||
return Scaffold(
|
||||
appBar: isDesktop ? null : const CustomAppBar(title: 'Create User '),
|
||||
drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
body: Container(
|
||||
// color: bodyColor,
|
||||
color: Colors.white,
|
||||
backgroundColor: Colors.white,
|
||||
// appBar: isDesktop ? null : const CustomAppBar(title: 'Create User '),
|
||||
// drawer: isDesktop ? null : CustomDrawer(isDesktop: false),
|
||||
appBar: const CustomAppBar(),
|
||||
drawer: CustomDrawer(isDesktop: false),
|
||||
body: Padding(
|
||||
padding: isDesktop
|
||||
? EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width *
|
||||
0.1, // 30% of screen width as horizontal padding
|
||||
vertical: MediaQuery.of(context).size.height *
|
||||
0, // 5% of screen height as vertical padding
|
||||
)
|
||||
: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||
// const Expanded(child: Center(child: Text("User Details Content"))),
|
||||
// Expanded(
|
||||
// child: _buildUserDetails(isDesktop),
|
||||
@ -687,35 +696,39 @@ class _CreateUserFormState extends State<CreateUserForm> {
|
||||
Widget buildData(bool isDesktop, context) {
|
||||
return Container(
|
||||
// margin: const EdgeInsets.only(left: 10.0, right: 15.0, top: 10.0, bottom: 10.0),
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.amber,
|
||||
// color: bodyColor,
|
||||
color: Color(0xFFE1F5FE),
|
||||
border: Border.all(color: Color(0xFFF7F7FB), width: 3.5)),
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.amber,
|
||||
// // color: bodyColor,
|
||||
// color: Color(0xFFE1F5FE),
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// width: 3.5)),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: isDesktop
|
||||
? EdgeInsets.all(10.0)
|
||||
: EdgeInsets.only(
|
||||
left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
padding: const EdgeInsets.all(10),
|
||||
// margin: isDesktop
|
||||
// ? EdgeInsets.all(10.0)
|
||||
// : EdgeInsets.only(
|
||||
// left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||
// padding: const EdgeInsets.all(10),
|
||||
height: isDesktop
|
||||
? MediaQuery.of(context).size.height * 0.98
|
||||
: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
border: isDesktop
|
||||
? Border.all(
|
||||
width: 2,
|
||||
color: Color(0xFFF7F7FB),
|
||||
)
|
||||
: null,
|
||||
color: Colors.white,
|
||||
// color: Color(0xFFF7F7FB),
|
||||
|
||||
// color: Colors.amber,
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// border: isDesktop
|
||||
// ? Border.all(
|
||||
// width: 2,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
// )
|
||||
// : null,
|
||||
// color: Colors.white,
|
||||
// // color: Color(0xFFF7F7FB),
|
||||
//
|
||||
// // color: Colors.amber,
|
||||
// ),
|
||||
// color: bodyColor,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,361 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart'; // don't forget
|
||||
import '../services/apiService.dart';
|
||||
|
||||
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final String title;
|
||||
final List<Widget>? actions; // Optional actions (icons, buttons)
|
||||
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
||||
final String? logoUrl;
|
||||
final String? username;
|
||||
final List<Widget>? actions;
|
||||
final bool showBackButton;
|
||||
|
||||
const CustomAppBar({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.logoUrl,
|
||||
this.username,
|
||||
this.actions,
|
||||
this.showBackButton = false, // Default: No back button
|
||||
this.showBackButton = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
|
||||
@override
|
||||
_CustomAppBarState createState() => _CustomAppBarState();
|
||||
}
|
||||
|
||||
class _CustomAppBarState extends State<CustomAppBar> {
|
||||
final ApiService apiService = ApiService();
|
||||
|
||||
String? token;
|
||||
Map<String, dynamic>? userData;
|
||||
Map<String, dynamic>? fetchedUserData;
|
||||
Map<String, dynamic> userDetails = {};
|
||||
|
||||
Map<String, dynamic>? selectedOrg;
|
||||
Color? layoutColor;
|
||||
Color? bodyColor;
|
||||
|
||||
Color _myTravelRequestColor = Color(0xFF475569); // Default color
|
||||
Color _myApprovalsColor = Color(0xFF475569); // Default color
|
||||
|
||||
void initState() {
|
||||
super.initState();
|
||||
// initializeData();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
initializeData();
|
||||
getOrganizationData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> initializeData() async {
|
||||
print("initializeDatainitializeData");
|
||||
token = await getToken();
|
||||
fetchedUserData = await getUserData();
|
||||
|
||||
if (token == null || fetchedUserData == null) {
|
||||
print("Token or USerId missing");
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
userData = fetchedUserData;
|
||||
});
|
||||
}
|
||||
|
||||
Future<String?> getToken() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString("auth_token");
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>?> getUserData() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final String? userDataString = prefs.getString('user_data');
|
||||
|
||||
if (userDataString != null) {
|
||||
try {
|
||||
userDetails = jsonDecode(userDataString);
|
||||
|
||||
return {
|
||||
"user_id": userDetails["user_id"].toString(),
|
||||
"name": "${userDetails["first_name"]} ${userDetails["last_name"]}",
|
||||
"email": userDetails["email"] ?? "",
|
||||
"role": userDetails["role"] ?? "",
|
||||
};
|
||||
} catch (e) {
|
||||
print("Error decoding user data: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> getOrganizationData() async {
|
||||
try {
|
||||
print("getUpdatedServices");
|
||||
|
||||
final result = await apiService.fetchOrganization();
|
||||
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
print("UUPdatedServices - $result");
|
||||
|
||||
setState(() {
|
||||
selectedOrg = result;
|
||||
|
||||
layoutColor = selectedOrg?['layout_color'] != null
|
||||
? Color(int.parse(selectedOrg!['layout_color']))
|
||||
: Colors.white;
|
||||
|
||||
bodyColor = selectedOrg?['color'] != null
|
||||
? Color(int.parse(
|
||||
selectedOrg!['color'].toString().replaceFirst('0x', ''),
|
||||
radix: 16))
|
||||
: Colors.blue;
|
||||
|
||||
String? rawLogoPath = selectedOrg?['logo'];
|
||||
if (rawLogoPath != null && rawLogoPath.contains('/assets')) {
|
||||
const baseUrl = "https://apitest.tripapprovaltool.com";
|
||||
final assetPath = rawLogoPath.split('/assets').last;
|
||||
selectedOrg!['logo'] = "$baseUrl/assets$assetPath";
|
||||
}
|
||||
});
|
||||
|
||||
// Save to SharedPreferences
|
||||
await prefs.setString('layout_color', selectedOrg?['layout_color']);
|
||||
await prefs.setString('body_color', selectedOrg?['color']);
|
||||
await prefs.setString('body_color', selectedOrg?['plan_action']);
|
||||
|
||||
print(
|
||||
"Layout Color- ${selectedOrg?['layout_color']} - $layoutColor ---------- bodyColor - $bodyColor");
|
||||
} catch (e) {
|
||||
print("Error : $e");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
centerTitle: true,
|
||||
backgroundColor: Colors.blueAccent, // Customize color
|
||||
elevation: 4, // Shadow effect
|
||||
leading: showBackButton
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () => Navigator.pop(context), // Back navigation
|
||||
)
|
||||
: null,
|
||||
actions: actions,
|
||||
backgroundColor: Colors.white,
|
||||
surfaceTintColor: Colors.white,
|
||||
// elevation: 3,
|
||||
automaticallyImplyLeading: false,
|
||||
// leading: showBackButton
|
||||
// ? IconButton(
|
||||
// icon: const Icon(Icons.arrow_back, color: Colors.black87),
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// )
|
||||
// : null,
|
||||
titleSpacing: 0,
|
||||
title: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: selectedOrg?['logo'] != null
|
||||
? ClipRect(
|
||||
child: Image.network(
|
||||
selectedOrg!['logo'],
|
||||
width: 100,
|
||||
height: 50,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.redAccent,
|
||||
child: Icon(Icons.error, size: 10),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.add_a_photo,
|
||||
size: 10,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
print("ONTAP Custom");
|
||||
print("ONTAP Custom- $userDetails ");
|
||||
context.go(
|
||||
"/CreateUserDetails",
|
||||
extra: {
|
||||
"selectedUser": userDetails,
|
||||
"isEditProfile": true,
|
||||
"isViewMode": true
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
userData?["name"] ?? "N/A",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: "Archivo",
|
||||
// color: Color(0xFF12B24B),
|
||||
color: layoutColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
Row(
|
||||
children: [
|
||||
MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
onEnter: (_) {
|
||||
setState(() {
|
||||
_myTravelRequestColor = Colors.blue; // Change color on hover
|
||||
});
|
||||
},
|
||||
onExit: (_) {
|
||||
setState(() {
|
||||
_myTravelRequestColor =
|
||||
Color(0xFF475569); // Revert color when hover ends
|
||||
});
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
context.go('/listPlan');
|
||||
},
|
||||
child: Text(
|
||||
"My Travel Request",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
// color: Color(0xFF475569),
|
||||
color: _myTravelRequestColor,
|
||||
fontFamily: "Archivo"),
|
||||
)),
|
||||
),
|
||||
const SizedBox(width: 25),
|
||||
MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
onEnter: (_) {
|
||||
setState(() {
|
||||
_myApprovalsColor = Colors.blue; // Change color on hover
|
||||
});
|
||||
},
|
||||
onExit: (_) {
|
||||
setState(() {
|
||||
_myApprovalsColor =
|
||||
Color(0xFF475569); // Revert color when hover ends
|
||||
});
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
context.go('/ApprovalList');
|
||||
},
|
||||
child: Text(
|
||||
"My Approvals",
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: _myApprovalsColor,
|
||||
// color: Color(0xFF475569),
|
||||
fontFamily: "Archivo"),
|
||||
)),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
if (userData?["role"] != "User")
|
||||
Builder(
|
||||
builder: (context) => PopupMenuButton<String>(
|
||||
color: Colors.white,
|
||||
icon: const Icon(Icons.settings, color: Colors.black87),
|
||||
offset: const Offset(0, 50), // 👈 shift it 50 pixels down
|
||||
onSelected: (String value) {
|
||||
switch (value) {
|
||||
case '/OrganizationSetup':
|
||||
context.go('/OrganizationSetup');
|
||||
break;
|
||||
case '/listUser':
|
||||
context.go('/listUser');
|
||||
break;
|
||||
case '/group':
|
||||
context.go('/group');
|
||||
break;
|
||||
case '/PolicyList':
|
||||
context.go('/PolicyList');
|
||||
case '/CreateUserDetails':
|
||||
context.go(
|
||||
"/CreateUserDetails",
|
||||
extra: {
|
||||
"selectedUser": userDetails,
|
||||
"isEditProfile": true,
|
||||
"isViewMode": true
|
||||
},
|
||||
);
|
||||
case '/logout':
|
||||
context.go('/');
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
itemBuilder: (BuildContext context) =>
|
||||
menuItems.map(buildMenuItem).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
preferredSize: Size.fromHeight(1),
|
||||
child: Container(
|
||||
height: 1,
|
||||
color: Colors.grey.shade200, // Set the color of the bottom border
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(56); // Standard AppBar height
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
}
|
||||
|
||||
final List<Map<String, dynamic>> menuItems = [
|
||||
{
|
||||
'value': '/OrganizationSetup',
|
||||
'icon': Icons.business,
|
||||
'label': 'Organization'
|
||||
},
|
||||
{'value': '/listUser', 'icon': Icons.manage_accounts, 'label': 'Users'},
|
||||
{'value': '/group', 'icon': Icons.group, 'label': 'Group'},
|
||||
{'value': '/PolicyList', 'icon': Icons.policy, 'label': 'Policy'},
|
||||
{
|
||||
'value': '/CreateUserDetails',
|
||||
'icon': Icons.account_circle,
|
||||
'label': 'My Profile'
|
||||
},
|
||||
{'value': '/logout', 'icon': Icons.login_outlined, 'label': 'Logout'},
|
||||
];
|
||||
|
||||
PopupMenuItem<String> buildMenuItem(Map<String, dynamic> item) {
|
||||
return PopupMenuItem<String>(
|
||||
value: item['value'],
|
||||
child: ListTile(
|
||||
leading: Icon(item['icon'], size: 18),
|
||||
title: Text(item['label'], style: const TextStyle(fontSize: 13)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -357,18 +357,21 @@ class _CustomDrawerState extends State<CustomDrawer> {
|
||||
),
|
||||
);
|
||||
|
||||
if (widget.isDesktop) {
|
||||
// Sidebar for Desktop (always visible)**
|
||||
return Container(
|
||||
width: 250, // Fixed width for sidebar
|
||||
color: Colors.grey.shade50,
|
||||
child: drawerContent,
|
||||
);
|
||||
} else {
|
||||
// Drawer for Mobile & Tablet**
|
||||
return Drawer(
|
||||
child: ListView(padding: EdgeInsets.zero, children: [drawerContent]));
|
||||
}
|
||||
return Drawer(
|
||||
child: ListView(padding: EdgeInsets.zero, children: [drawerContent]));
|
||||
|
||||
// if (widget.isDesktop) {
|
||||
// // Sidebar for Desktop (always visible)**
|
||||
// return Container(
|
||||
// width: 250, // Fixed width for sidebar
|
||||
// color: Colors.grey.shade50,
|
||||
// child: drawerContent,
|
||||
// );
|
||||
// } else {
|
||||
// // Drawer for Mobile & Tablet**
|
||||
// return Drawer(
|
||||
// child: ListView(padding: EdgeInsets.zero, children: [drawerContent])) ;
|
||||
// }
|
||||
}
|
||||
|
||||
/// **Reusable Drawer Item**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user