-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add choose doctor screen after searching by symptom
- Loading branch information
1 parent
b71b02a
commit 3bffee7
Showing
15 changed files
with
444 additions
and
125 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
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,65 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:google_fonts/google_fonts.dart'; | ||
import 'package:happy_care/core/themes/colors.dart'; | ||
import 'package:happy_care/modules/home/choose_doctor/choose_doctor_controller.dart'; | ||
import 'package:happy_care/widgets/custom_card_scroll.dart'; | ||
import 'package:sizer/sizer.dart'; | ||
|
||
class ChooseDoctor extends GetView<ChooseDoctorController> { | ||
ChooseDoctor({Key? key}) : super(key: key); | ||
|
||
final specName = Get.arguments as String; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: Theme.of(context).scaffoldBackgroundColor, | ||
elevation: 0, | ||
leading: IconButton( | ||
onPressed: () => Get.back(), | ||
icon: Icon( | ||
Icons.arrow_back, | ||
color: kMainColor, | ||
size: 26, | ||
), | ||
), | ||
centerTitle: true, | ||
title: Text( | ||
specName, | ||
style: GoogleFonts.openSans( | ||
color: kMainColor, | ||
fontSize: 15.sp, | ||
fontWeight: FontWeight.bold, | ||
), | ||
), | ||
), | ||
body: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Obx( | ||
() => Stack( | ||
children: <Widget>[ | ||
CustomCardScroll( | ||
controller.currentPage.value, | ||
controller.listDoctorInSpec, | ||
), | ||
Positioned.fill( | ||
child: PageView.builder( | ||
itemCount: controller.listDoctorInSpec.length, | ||
controller: controller.pageController, | ||
reverse: true, | ||
itemBuilder: (context, index) { | ||
return SizedBox(); | ||
}, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
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,9 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:happy_care/modules/home/choose_doctor/choose_doctor_controller.dart'; | ||
|
||
class ChooseDoctorBinding extends Bindings { | ||
@override | ||
void dependencies() { | ||
Get.lazyPut(() => ChooseDoctorController()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
lib/modules/home/choose_doctor/choose_doctor_controller.dart
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,28 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:happy_care/data/models/user.dart'; | ||
import 'package:happy_care/modules/main_screen/controller/doctor_controller.dart'; | ||
|
||
enum ChooseDoctorStatus { loading, done, error } | ||
|
||
class ChooseDoctorController extends GetxController { | ||
final DoctorController doctorController = Get.find(); | ||
final listDoctorInSpec = RxList(<User>[]); | ||
late final PageController pageController; | ||
final currentPage = 0.0.obs; | ||
|
||
@override | ||
void onInit() { | ||
super.onInit(); | ||
final specName = Get.arguments as String; | ||
print("specId" + specName); | ||
listDoctorInSpec(doctorController.listDoctor | ||
.where((doctor) => doctor.specializations!.first.contains(specName)) | ||
.toList()); | ||
pageController = PageController(initialPage: listDoctorInSpec.length - 1); | ||
currentPage(listDoctorInSpec.length - 1.0); | ||
pageController.addListener(() { | ||
currentPage(pageController.page); | ||
}); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,106 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:google_fonts/google_fonts.dart'; | ||
import 'package:happy_care/core/themes/colors.dart'; | ||
import 'package:happy_care/data/models/specialization.dart'; | ||
import 'package:happy_care/routes/app_pages.dart'; | ||
import 'package:sizer/sizer.dart'; | ||
|
||
class FindingSpecScreen extends StatelessWidget { | ||
const FindingSpecScreen({ Key? key }) : super(key: key); | ||
FindingSpecScreen({Key? key}) : super(key: key); | ||
|
||
final List<Specialization> listSpecFound = | ||
Get.arguments as List<Specialization>; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
|
||
body: SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.all(5.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
IconButton( | ||
onPressed: () => Get.back(), | ||
icon: Icon( | ||
Icons.arrow_back, | ||
color: kMainColor, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16.0), | ||
child: Center( | ||
child: Text( | ||
"Kết quả tìm được từ triệu chứng của bạn", | ||
style: GoogleFonts.openSans( | ||
color: kMainColor, | ||
fontSize: 13.sp, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
), | ||
), | ||
SizedBox(height: 1.2.h), | ||
Center( | ||
child: Text( | ||
"Đã tìm thấy ${listSpecFound.length} chuyên khoa bạn cần", | ||
style: GoogleFonts.openSans( | ||
color: kMainColor, | ||
fontSize: 11.sp, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
), | ||
Divider( | ||
color: kMainColor, | ||
), | ||
Expanded( | ||
child: ListView.builder( | ||
itemCount: listSpecFound.length, | ||
itemBuilder: (context, index) { | ||
return Padding( | ||
padding: const EdgeInsets.all(5.0), | ||
child: ListTile( | ||
onTap: () => Get.toNamed( | ||
AppRoutes.rListDoctor, | ||
arguments: listSpecFound[index].name, | ||
), | ||
title: Text( | ||
listSpecFound[index].name, | ||
style: GoogleFonts.openSans( | ||
color: kMainColor, | ||
fontWeight: FontWeight.w700, | ||
), | ||
), | ||
subtitle: Text( | ||
listSpecFound[index].description!, | ||
style: GoogleFonts.openSans( | ||
color: kMainColor, | ||
), | ||
), | ||
leading: CircleAvatar( | ||
radius: 30, | ||
backgroundColor: kMainColor, | ||
child: Padding( | ||
padding: const EdgeInsets.all(2.0), | ||
child: CircleAvatar( | ||
radius: 30, | ||
backgroundColor: Colors.white, | ||
backgroundImage: | ||
Image.asset("assets/images/doctor.png").image, | ||
), | ||
), | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.