245 lines
8.2 KiB
Dart
245 lines
8.2 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:animated_rating_stars/animated_rating_stars.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:taafee_mobile/common/extensions/widget_extension.dart';
|
|
import 'package:taafee_mobile/common/widgets/button.dart';
|
|
import 'package:taafee_mobile/common/widgets/text.dart';
|
|
import 'package:taafee_mobile/core/routing/routing_manager.dart';
|
|
import 'package:taafee_mobile/features/card/business_logic_layer/card_controller.dart';
|
|
import 'package:taafee_mobile/features/card/presentation_layer/widgets/star.dart';
|
|
import 'package:taafee_mobile/features/card/presentation_layer/widgets/view_ratings.dart';
|
|
|
|
import '../../../../common/const/const.dart';
|
|
import '../../../../common/widgets/textfiled.dart';
|
|
|
|
class RateWidget extends StatelessWidget {
|
|
final CardController cardController = Get.find<CardController>();
|
|
RateWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: Get.width * .89,
|
|
height: 150,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const RegularTextWidget("Rates"),
|
|
Container(
|
|
alignment: Alignment.center,
|
|
width: 100,
|
|
height: 25,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primeColor,
|
|
borderRadius: BorderRadius.circular(25),
|
|
),
|
|
child: RegularTextWidget(
|
|
"Rate Now".tr,
|
|
color: Colors.white,
|
|
),
|
|
).onTap(() {
|
|
RoutingManager.to(RouteName.reviewForm);
|
|
}),
|
|
],
|
|
).paddingSymmetric(horizontal: 20, vertical: 5),
|
|
const ViewRatingsWidget(),
|
|
],
|
|
),
|
|
|
|
// child: Column(
|
|
// children: [
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// Row(
|
|
// children: [
|
|
// RegularTextWidget("Number of users who rate this : ".tr),
|
|
// RegularTextWidget("10".tr),
|
|
// ],
|
|
// ),
|
|
// Container(
|
|
// alignment: Alignment.center,
|
|
// width: 100,
|
|
// height: 25,
|
|
// decoration: BoxDecoration(
|
|
// color: AppColors.primeColor,
|
|
// borderRadius: BorderRadius.circular(25),
|
|
// ),
|
|
// child: RegularTextWidget(
|
|
// "Rate Now".tr,
|
|
// color: Colors.white,
|
|
// ),
|
|
// ).onTap(() {
|
|
// dialog();
|
|
// cardController.currentIndex(0);
|
|
// })
|
|
// ],
|
|
// ),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// Column(
|
|
// children: [
|
|
// const Stack(
|
|
// alignment: Alignment.center,
|
|
// children: [
|
|
// StarWidget(maxRating: 1, starSize: 60, readOnly: true),
|
|
// RegularTextWidget(
|
|
// "2.5",
|
|
// color: Colors.black,
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// RegularTextWidget("Waiting".tr),
|
|
// ],
|
|
// ),
|
|
// Column(
|
|
// children: [
|
|
// const Stack(
|
|
// alignment: Alignment.center,
|
|
// children: [
|
|
// StarWidget(maxRating: 1, starSize: 60, readOnly: true),
|
|
// RegularTextWidget(
|
|
// "2.5",
|
|
// color: Colors.black,
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// RegularTextWidget("Performance".tr),
|
|
// ],
|
|
// ),
|
|
// Column(
|
|
// children: [
|
|
// const Stack(
|
|
// alignment: Alignment.center,
|
|
// children: [
|
|
// StarWidget(maxRating: 1, starSize: 60, readOnly: true),
|
|
// RegularTextWidget(
|
|
// "2.5",
|
|
// color: Colors.black,
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// RegularTextWidget("Price".tr),
|
|
// ],
|
|
// )
|
|
// ],
|
|
// ).paddingOnly(top: 10).paddingSymmetric(horizontal: 20),
|
|
// ],
|
|
// ).paddingSymmetric(horizontal: 10, vertical: 10),
|
|
).onTap(() {
|
|
RoutingManager.to(RouteName.feedback);
|
|
log("message");
|
|
});
|
|
}
|
|
|
|
final PageController pageController = PageController();
|
|
final List<String> rate = [
|
|
"waiting?",
|
|
"Performance?",
|
|
"Price?",
|
|
"Feedback",
|
|
];
|
|
final List<Widget> stars = [
|
|
const StarWidget(maxRating: 5, starSize: 30, readOnly: false),
|
|
const StarWidget(maxRating: 5, starSize: 30, readOnly: false),
|
|
const StarWidget(maxRating: 5, starSize: 30, readOnly: false),
|
|
|
|
Container(
|
|
alignment: Alignment.topCenter,
|
|
width: Get.width * .5,
|
|
height: 55,
|
|
child: TextFormField(
|
|
onChanged: (value) {},
|
|
maxLines: 4,
|
|
textInputAction: TextInputAction.newline,
|
|
keyboardType: TextInputType.multiline,
|
|
),
|
|
),
|
|
// TextFieldWidget(
|
|
// keyboardType: TextInputType.multiline,
|
|
// label: "",
|
|
// onChange: (value) {},
|
|
// maxLines: 5,
|
|
// textInputAction: TextInputAction.newline,
|
|
// validate: (p0) {
|
|
// return null;
|
|
// },
|
|
// ),
|
|
];
|
|
void dialog() {
|
|
Get.defaultDialog(
|
|
onWillPop: () async {
|
|
cardController.currentIndex(0);
|
|
return true;
|
|
},
|
|
confirm: Obx(() {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
RegularTextWidget(
|
|
"back".tr,
|
|
color: Colors.black,
|
|
).onTap(() {
|
|
if (cardController.currentIndex.value == 0) {
|
|
RoutingManager.back();
|
|
}
|
|
pageController.animateToPage(cardController.currentIndex.value - 1,
|
|
duration: const Duration(milliseconds: 250), curve: Curves.easeIn);
|
|
}),
|
|
ButtonWidget(
|
|
width: 80,
|
|
onTap: () {
|
|
if (cardController.currentIndex.value == 3) {
|
|
RoutingManager.back();
|
|
}
|
|
pageController.animateToPage(cardController.currentIndex.value + 1,
|
|
duration: const Duration(milliseconds: 250), curve: Curves.easeIn);
|
|
},
|
|
title: cardController.currentIndex.value == 3 ? "OK".tr : "Next".tr),
|
|
],
|
|
).paddingSymmetric(horizontal: 20);
|
|
}),
|
|
backgroundColor: Colors.white,
|
|
title: "",
|
|
middleText: "",
|
|
content: SizedBox(
|
|
width: Get.width * .5,
|
|
height: Get.height * .15,
|
|
child: PageView.builder(
|
|
physics: const BouncingScrollPhysics(),
|
|
controller: pageController,
|
|
onPageChanged: (value) {
|
|
cardController.changeCurrentIndex(value);
|
|
},
|
|
itemCount: 4,
|
|
itemBuilder: (BuildContext context, index) {
|
|
return Column(
|
|
children: [
|
|
BoldTextWidget(rate[index].tr).paddingOnly(bottom: 30),
|
|
|
|
stars[index],
|
|
// SizedBox(
|
|
// width: Get.width * .8,
|
|
// child: RegularTextWidget(
|
|
// textAlign: TextAlign.center,
|
|
// text[index].tr,
|
|
// color: Colors.black,
|
|
// ),
|
|
// )
|
|
],
|
|
);
|
|
},
|
|
),
|
|
));
|
|
}
|
|
}
|