second commit
This commit is contained in:
1001
lib/View/More/Locations/Addlocation/Addlocationview.dart
Normal file
1001
lib/View/More/Locations/Addlocation/Addlocationview.dart
Normal file
File diff suppressed because it is too large
Load Diff
844
lib/View/More/Locations/Locationview.dart
Normal file
844
lib/View/More/Locations/Locationview.dart
Normal file
@@ -0,0 +1,844 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../Controller/More/Locations/Locationcontroller.dart';
|
||||
import '../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/utility.dart';
|
||||
import '../../Home/Homeview.dart';
|
||||
import 'Addlocation/Addlocationview.dart';
|
||||
import 'Staffs/Staffdetailsview.dart';
|
||||
|
||||
class LocationView extends StatelessWidget {
|
||||
LocationView({super.key});
|
||||
LocationController locationController = Get.put(LocationController());
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: ()async{
|
||||
Get.to(()=>HomeView(selectedIndex: 3));
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0.5,
|
||||
leading: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorConstants. primaryColor,
|
||||
// radius: 20,
|
||||
backgroundImage: AssetImage(AssetConstants.NearleAppbarIcon),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
titleSpacing: 1,
|
||||
title: Text('Locations'),
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
),
|
||||
body: GetBuilder<LocationController>(
|
||||
initState: (_){
|
||||
locationController.getLocation();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 5),
|
||||
child: controller.shimmer == true
|
||||
? shimmerLocation()
|
||||
: controller.locations.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No Locations at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 16),
|
||||
),
|
||||
],
|
||||
))
|
||||
: listLocationMobile(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
height: 60,
|
||||
// width: Get.width * 0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30), color: ColorConstants.primaryColor),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print('hello');
|
||||
Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(
|
||||
builder: (context) => HomeView(
|
||||
selectedIndex: 0,
|
||||
)));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Home',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(()=>AddLocationView(editMode: false,));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.add_location_alt_sharp,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Add Location',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 60,
|
||||
width: 0.5,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(HomeView(selectedIndex: 3));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Back',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget listLocationMobile() {
|
||||
return GetBuilder<LocationController>(
|
||||
builder: (controller) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 70),
|
||||
itemCount: controller.locations.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Card(
|
||||
// color: Colors.grey[150],
|
||||
elevation: 0,
|
||||
child: Container(
|
||||
height: 120,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion.getLightColors(
|
||||
controller.locations[index].locationname?[0] ??
|
||||
'A'.toString().trimLeft())
|
||||
.withAlpha(200),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
shape: BoxShape.circle),
|
||||
child: Icon(
|
||||
Icons.storefront,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 50,
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(()=> AddLocationView(editMode: true,
|
||||
locationInfo: controller.locations[index],
|
||||
),);
|
||||
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.primaryColor,
|
||||
shape: BoxShape.circle,
|
||||
// borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6, horizontal: 6),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// SizedBox(
|
||||
// height: 3,
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color: Colors.black45,
|
||||
size: 17,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Flexible(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
"${ controller.locations[index].locationname}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone_android_sharp,
|
||||
color: Colors.black45,
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
controller.locations[index].locationcontact == null
|
||||
? "Contact No"
|
||||
: '${ controller.locations[index].locationcontact}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on_outlined,
|
||||
size: 16,
|
||||
color: Colors.black45,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
"${ controller.locations[index].locationsuburb}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: Colors.black87
|
||||
|
||||
// fontWeight: FontWeight.w600
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// ExpansionTile(
|
||||
// maintainState: true,
|
||||
//
|
||||
// backgroundColor: ColorConstants.secondaryColor,
|
||||
// tilePadding: EdgeInsets.only(left: 8, top: 2),
|
||||
// initiallyExpanded: true,
|
||||
//
|
||||
// childrenPadding: EdgeInsets.only(left: 2, right: 2, bottom: 0),
|
||||
// trailing: Padding(
|
||||
// padding: const EdgeInsets.only(top: 30.0, right: 10),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// // flex: 3,
|
||||
// child: Icon(
|
||||
// Icons.keyboard_arrow_down_sharp,
|
||||
// color: Colors.black87,
|
||||
// size: 24,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// title: Container(
|
||||
// height: 120,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: UtilityPromotion.getLightColors(
|
||||
// controller.locations[index].locationname?[0] ??
|
||||
// 'A'.toString().trimLeft())
|
||||
// .withAlpha(200),
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// ),
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Stack(
|
||||
// children: [
|
||||
// Container(
|
||||
// padding: EdgeInsets.all(12),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white70,
|
||||
// shape: BoxShape.circle),
|
||||
// child: Icon(
|
||||
// Icons.storefront,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// size: 50,
|
||||
// )),
|
||||
// Positioned(
|
||||
// bottom: 0,
|
||||
// right: 0,
|
||||
// child: GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.to(()=> AddLocationView(editMode: true,
|
||||
// locationInfo: controller.locations[index],
|
||||
// ),);
|
||||
//
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: ColorConstants.primaryColor,
|
||||
// shape: BoxShape.circle,
|
||||
// // borderRadius: BorderRadius.circular(12),
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(
|
||||
// vertical: 6, horizontal: 6),
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// color: Colors.white,
|
||||
// size: 16,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
//
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 10,
|
||||
// ),
|
||||
// Expanded(
|
||||
// flex: 4,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// // SizedBox(
|
||||
// // height: 3,
|
||||
// // ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on,
|
||||
// color: Colors.black45,
|
||||
// size: 17,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Flexible(
|
||||
// flex: 3,
|
||||
// child: Text(
|
||||
// "${ controller.locations[index].locationname}",
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: TextStyle(
|
||||
// fontSize: 18,
|
||||
// color: Colors.black54,
|
||||
// fontWeight: FontWeight.w600),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
//
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.phone_android_sharp,
|
||||
// color: Colors.black45,
|
||||
// size: 16,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Text(
|
||||
// controller.locations[index].locationcontact == null
|
||||
// ? "Contact No"
|
||||
// : '${ controller.locations[index].locationcontact}',
|
||||
// style: TextStyle(
|
||||
// fontSize: 15,
|
||||
// color: Colors.black87,
|
||||
// fontWeight: FontWeight.w400),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
//
|
||||
// Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Icon(
|
||||
// Icons.location_on_outlined,
|
||||
// size: 16,
|
||||
// color: Colors.black45,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 4,
|
||||
// ),
|
||||
// Flexible(
|
||||
// child: Text(
|
||||
// "${ controller.locations[index].locationsuburb}",
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: TextStyle(
|
||||
// fontSize: 15, color: Colors.black87
|
||||
//
|
||||
// // fontWeight: FontWeight.w600
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// children: [
|
||||
// Divider(
|
||||
// thickness: 1,
|
||||
// color: Colors.grey[300],
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 10, bottom: 0, right: 10),
|
||||
// height: 90,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// flex: 7,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// Get.to(()=> AddLocationView(editMode: true,
|
||||
// locationInfo: controller.locations[index],
|
||||
// ),);
|
||||
//
|
||||
// },
|
||||
// child: Column(children: [
|
||||
//
|
||||
// Container(
|
||||
// height: 45,
|
||||
// width: 45,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: ColorConstants.primaryColor)),
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.edit_location_alt,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// size: 30,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
// Text("Location",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14,
|
||||
// color: Colors.grey[800],
|
||||
// height: 0.8)),
|
||||
// ]),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
//
|
||||
// Get.to(()=>StaffsDetails(staffData: [], locationName:controller.locations[index].locationname??'',));
|
||||
//
|
||||
// },
|
||||
// child: Column(children: [
|
||||
//
|
||||
// Container(
|
||||
// height: 45,
|
||||
// width: 45,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// border: Border.all(
|
||||
// color: ColorConstants.primaryColor)),
|
||||
// child: Center(
|
||||
// child: Icon(
|
||||
// Icons.person,
|
||||
// color: ColorConstants.primaryColor,
|
||||
// size: 30,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
// Text("Staff's",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// fontSize: 14,
|
||||
// color: Colors.grey[800],
|
||||
// height: 0.8)),
|
||||
// ]),
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// Expanded(
|
||||
// child: Container(),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // controller.moduleId != 4?Divider(
|
||||
// // thickness: 2,
|
||||
// // color: Colors.grey[100],
|
||||
// // ):SizedBox(),
|
||||
// // controller. moduleId != 4?Expanded(
|
||||
// // flex: 8,
|
||||
// // child: Row(
|
||||
// // mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// // children: [
|
||||
// // Expanded(
|
||||
// // child: InkWell(
|
||||
// // onTap: () {
|
||||
// //
|
||||
// // },
|
||||
// // child: Column(children: [
|
||||
// // SizedBox(
|
||||
// // height: 15,
|
||||
// // ),
|
||||
// // Container(
|
||||
// // height: 45,
|
||||
// // width: 45,
|
||||
// // decoration: BoxDecoration(
|
||||
// // shape: BoxShape.circle,
|
||||
// // border: Border.all(
|
||||
// // color: primaryColor)),
|
||||
// // child: Center(
|
||||
// // child: Icon(
|
||||
// // Icons.person,
|
||||
// // color: primaryColor,
|
||||
// // size: 30,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 10,
|
||||
// // ),
|
||||
// // Text("Staff's",
|
||||
// // textAlign: TextAlign.center,
|
||||
// // style: TextStyle(
|
||||
// // fontSize: 14,
|
||||
// // color: Colors.grey[800],
|
||||
// // height: 0.8)),
|
||||
// // ]),
|
||||
// // ),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // ),
|
||||
// // Expanded(
|
||||
// // child: Container(),
|
||||
// // )
|
||||
// // ],
|
||||
// // )):SizedBox(),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
shimmerLocation(){
|
||||
return Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
|
||||
enabled: true,
|
||||
child: ListView.builder(
|
||||
itemBuilder: (_, __) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 8.0,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: ColorConstants.secondaryColor!,width: 3)),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(13.0),
|
||||
child: Container(
|
||||
height: 50,
|
||||
width: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Container(
|
||||
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:17,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
SizedBox(
|
||||
width: 6,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height:17,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
height: 12,
|
||||
width: 150,
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
itemCount: 6,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
484
lib/View/More/Locations/Staffs/Staffdetailsview.dart
Normal file
484
lib/View/More/Locations/Staffs/Staffdetailsview.dart
Normal file
@@ -0,0 +1,484 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../../Controller/More/Locations/Staffs/Staffdetailscontroller.dart';
|
||||
import '../../../../Controller/More/Staffs/Staffscontroller.dart';
|
||||
import '../../../../Helper/Constants/AssetConstants.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/utility.dart';
|
||||
import '../../../Home/Homeview.dart';
|
||||
|
||||
class StaffsDetails extends StatelessWidget {
|
||||
List staffData;
|
||||
String locationName;
|
||||
StaffDetailsController staffDetailsController = Get.put(StaffDetailsController());
|
||||
StaffsDetails({Key? key, required this.staffData, required this.locationName,}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConstants.lightColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Image(
|
||||
image: AssetImage(AssetConstants.NearleAppbarIcon),
|
||||
height: 30,
|
||||
),
|
||||
),
|
||||
title: Text('$locationName Staffs'),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: mobileUserList(),
|
||||
)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
height: 60,
|
||||
// width: Get.width * 0.8,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30), color: ColorConstants.primaryColor),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(()=>HomeView(selectedIndex: 0,));
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.home,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Home',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: 0.5,
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
Text(
|
||||
'Back',
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
addUser() {
|
||||
|
||||
// Get.to(()=>AddUser(location: true, locationId:staffData[0]['Locationid']??[],));
|
||||
}
|
||||
|
||||
mobileUserList() {
|
||||
return GetBuilder<StaffsController>(
|
||||
builder: (context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10,
|
||||
),
|
||||
child:staffData.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No users at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600], fontSize: 14),
|
||||
),
|
||||
],
|
||||
))
|
||||
: staffDetailsController.shimmer == true
|
||||
? Shimmer.fromColors(
|
||||
enabled: true,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 60),
|
||||
itemCount: 4,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.grey[400]!, width: 2),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 90,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 55,
|
||||
height: 55,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
color: ColorConstants.secondaryColor,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.secondaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
"--------------",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight:
|
||||
FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
// flex: 5,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.store,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Text(
|
||||
'-----------',
|
||||
// '',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: EdgeInsets.only(bottom: 80),
|
||||
itemCount: staffData.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: [BoxShadow(color: Colors.grey)],
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: 130,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion.getLightColors(
|
||||
'${ staffData[index]['Firstname']==null||staffData[index]['Firstname'].toString().isEmpty?'':staffData[index]['Firstname'].toString()[0]}'
|
||||
.toString())
|
||||
.withAlpha(100),
|
||||
// staffData[index]['Firstname'][0].toString()),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// width: 55,
|
||||
// height: 60,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
"${ staffData[index]['Firstname']==null||staffData[index]['Firstname'].toString().isEmpty?'':staffData[index]['Firstname'].toString()[0].toUpperCase()}",
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
locationName
|
||||
.toString()
|
||||
.length >
|
||||
9
|
||||
?locationName
|
||||
.toString()
|
||||
.substring(0, 9) +
|
||||
'...'
|
||||
: locationName
|
||||
.toString(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// '',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// SizedBox(
|
||||
// height: 4,
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"${staffData[index]['Firstname'] == null ? "" : staffData[index]['Firstname']} ${staffData[index]['Lastname'] == null ? "" : staffData[index]['Lastname']}",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
staffData[index]['Roleid']==1?Icon(Icons.admin_panel_settings_outlined,color: ColorConstants.primaryColor,size:20,):staffData[index]['Roleid']==2?Icon(Icons.phone_android,color: ColorConstants.primaryColor,size:20,):
|
||||
Icon(Icons.laptop_windows,color: ColorConstants.primaryColor,size:20,)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'91 ${staffData[index]['Contact']}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.mail,
|
||||
color: ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${staffData[index]['Email']}',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
}),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user