laser clinic design (cont.)
parent
d2223da3c2
commit
cd81f05a8d
@ -0,0 +1,64 @@
|
||||
class LaserBodyPart {
|
||||
int id;
|
||||
int category;
|
||||
String bodyPart;
|
||||
bool fullBoadyPart;
|
||||
bool isRetouch;
|
||||
String timeDuration;
|
||||
String bodyPartN;
|
||||
bool isActive;
|
||||
String mappingCode;
|
||||
int procedureID;
|
||||
int orderNum;
|
||||
String categoryName;
|
||||
String categoryNameN;
|
||||
|
||||
LaserBodyPart(
|
||||
{this.id,
|
||||
this.category,
|
||||
this.bodyPart,
|
||||
this.fullBoadyPart,
|
||||
this.isRetouch,
|
||||
this.timeDuration,
|
||||
this.bodyPartN,
|
||||
this.isActive,
|
||||
this.mappingCode,
|
||||
this.procedureID,
|
||||
this.orderNum,
|
||||
this.categoryName,
|
||||
this.categoryNameN});
|
||||
|
||||
LaserBodyPart.fromJson(Map<String, dynamic> json) {
|
||||
id = json['Id'];
|
||||
category = json['Category'];
|
||||
bodyPart = json['BodyPart'];
|
||||
fullBoadyPart = json['FullBoadyPart'];
|
||||
isRetouch = json['IsRetouch'];
|
||||
timeDuration = json['TimeDuration'];
|
||||
bodyPartN = json['BodyPartN'];
|
||||
isActive = json['IsActive'];
|
||||
mappingCode = json['MappingCode'];
|
||||
procedureID = json['ProcedureID'];
|
||||
orderNum = json['OrderNum'];
|
||||
categoryName = json['CategoryName'];
|
||||
categoryNameN = json['CategoryNameN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Id'] = this.id;
|
||||
data['Category'] = this.category;
|
||||
data['BodyPart'] = this.bodyPart;
|
||||
data['FullBoadyPart'] = this.fullBoadyPart;
|
||||
data['IsRetouch'] = this.isRetouch;
|
||||
data['TimeDuration'] = this.timeDuration;
|
||||
data['BodyPartN'] = this.bodyPartN;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['MappingCode'] = this.mappingCode;
|
||||
data['ProcedureID'] = this.procedureID;
|
||||
data['OrderNum'] = this.orderNum;
|
||||
data['CategoryName'] = this.categoryName;
|
||||
data['CategoryNameN'] = this.categoryNameN;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart';
|
||||
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../svg_tester.dart';
|
||||
|
||||
class LaserClinic extends StatefulWidget {
|
||||
LaserClinic({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LaserClinicState createState() {
|
||||
return _LaserClinicState();
|
||||
}
|
||||
}
|
||||
|
||||
class _LaserClinicState extends State<LaserClinic> {
|
||||
List<int> _laserCategoryList = [0, 2, 11];
|
||||
List<String> _selectedBodyPartList = [];
|
||||
bool _isFullBody = false;
|
||||
int _selectedCategoryIndex = 0;
|
||||
List<LaserBodyPart> laserBodyPartsList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Future.delayed(Duration.zero, () {
|
||||
callLaserBodyPartsAPI();
|
||||
});
|
||||
}
|
||||
|
||||
callLaserBodyPartsAPI() async {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
|
||||
DoctorsListService service = new DoctorsListService();
|
||||
service.getLaserBodyPartsList(_selectedCategoryIndex).then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
if (res['MessageStatus'] == 1) {
|
||||
setState(() {
|
||||
if (res['Laser_GetBodyPartsByCategoryList'].length != 0) {
|
||||
laserBodyPartsList = [];
|
||||
res['Laser_GetBodyPartsByCategoryList'].forEach((v) {
|
||||
laserBodyPartsList.add(LaserBodyPart.fromJson(v));
|
||||
});
|
||||
} else {}
|
||||
});
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||
}
|
||||
}).catchError((err) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(err);
|
||||
AppToast.showErrorToast(message: err);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).clinic,
|
||||
showNewAppBar: true,
|
||||
showNewAppBarTitle: true,
|
||||
isShowDecPage: false,
|
||||
backgroundColor: Color(0xfff7f7f7),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(21),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
for (var index in _laserCategoryList)
|
||||
InkWell(
|
||||
onTap: () {
|
||||
_selectedCategoryIndex = index;
|
||||
setState(() {});
|
||||
callLaserBodyPartsAPI();
|
||||
},
|
||||
child: Container(
|
||||
width: 75,
|
||||
height: 75,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(left: 4, right: 4),
|
||||
decoration: BoxDecoration(shape: BoxShape.circle, color: _selectedCategoryIndex == index ? Colors.redAccent : Color(0xff2E303A)),
|
||||
child: Text(
|
||||
index == 0 ? "Body" : (index == 2 ? "Face" : "Retouch"),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
//shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (cxt, index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (_selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart)) {
|
||||
_selectedBodyPartList.remove(laserBodyPartsList[index].bodyPart);
|
||||
} else {
|
||||
_selectedBodyPartList.add(laserBodyPartsList[index].bodyPart);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
decoration:
|
||||
BoxDecoration(shape: BoxShape.circle, color: _selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart) ? Color(0xff2E303A) : Colors.transparent),
|
||||
child: Icon(Icons.done, color: _selectedBodyPartList.contains(laserBodyPartsList[index].bodyPart) ? Colors.white : Color(0xff2E303A))),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
laserBodyPartsList[index].bodyPart,
|
||||
style: TextStyle(
|
||||
color: Color(0xff2E303A),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (cxt, index) => Divider(
|
||||
height: 1,
|
||||
thickness: 1,
|
||||
color: Color(0xff2E303A),
|
||||
),
|
||||
itemCount: laserBodyPartsList.length),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
"Minutes",
|
||||
style: TextStyle(color: Color(0xff2E303A)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: BodyPartMapper(
|
||||
dataList: _selectedBodyPartList,
|
||||
))
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
DefaultButton("Continue", () {}).insideContainer,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue