|
|
@@ -0,0 +1,262 @@
|
|
|
+import 'package:electronic_assistant/base/base_page.dart';
|
|
|
+import 'package:electronic_assistant/data/consts/Constants.dart';
|
|
|
+import 'package:electronic_assistant/module/browser/view.dart';
|
|
|
+import 'package:electronic_assistant/utils/expand.dart';
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:get/get.dart';
|
|
|
+import '../../../data/repositories/account_repository.dart';
|
|
|
+import '../../../resource/assets.gen.dart';
|
|
|
+import '../../../resource/colors.gen.dart';
|
|
|
+import '../../../resource/string.gen.dart';
|
|
|
+import '../../chat/start/view.dart';
|
|
|
+import 'controller.dart';
|
|
|
+
|
|
|
+class MainDrawerView extends BasePage<MainDrawerController> {
|
|
|
+ const MainDrawerView({super.key});
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget buildBody(BuildContext context) {
|
|
|
+ return SafeArea(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 12.h),
|
|
|
+ buildUserInfoView(),
|
|
|
+ SizedBox(height: 12.h),
|
|
|
+ Container(
|
|
|
+ height: 72.w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.circular(12.w),
|
|
|
+ border: Border.all(color: ColorName.white20, width: 2.w),
|
|
|
+ gradient: LinearGradient(
|
|
|
+ colors: ['#5B618D'.toColor(), '#283B58'.toColor()],
|
|
|
+ begin: Alignment.centerLeft,
|
|
|
+ end: Alignment.centerRight,
|
|
|
+ transform: const GradientRotation(-1.64061),
|
|
|
+ stops: const [0, 1.0],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 16.w),
|
|
|
+ IntrinsicHeight(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ height: 18.h,
|
|
|
+ child: Assets.images.iconChargeCenterTxt.image()),
|
|
|
+ SizedBox(height: 4.h),
|
|
|
+ Text(controller.electricityTxt,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.white))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ const Spacer(),
|
|
|
+ DecoratedBox(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.circular(12.w),
|
|
|
+ ),
|
|
|
+ child: Padding(
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ vertical: 4, horizontal: 11)
|
|
|
+ .w,
|
|
|
+ child: Text(
|
|
|
+ StringName.mainGoCharge.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp,
|
|
|
+ color: '#374668'.toColor(),
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 18.w),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 12.h),
|
|
|
+ _buildContent1(),
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ _buildContent2(),
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ _buildLogOut(),
|
|
|
+ const Spacer(),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.only(bottom: 22).h,
|
|
|
+ child: Text(StringName.mainDrawerRecordNumber.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.tertiaryTextColor)),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ GestureDetector _buildLogOut() {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ accountRepository.logout();
|
|
|
+ Get.back();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ height: 44.h,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(8.w),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ StringName.mainDrawerLogout.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ color: "#25262A".toColor(),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Container _buildContent2() {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 8.h),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(12.w),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ buildOperationItem(
|
|
|
+ Assets.images.iconDrawerPrivacyPolicy.image(),
|
|
|
+ StringName.privacyPolicy.tr,
|
|
|
+ () {
|
|
|
+ BrowserPage.start(Constants.privacyPolicy);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ buildOperationItem(
|
|
|
+ Assets.images.iconDrawerUserAgreement.image(),
|
|
|
+ StringName.userAgreement.tr,
|
|
|
+ () {
|
|
|
+ BrowserPage.start(Constants.userAgreement);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ buildOperationItem(
|
|
|
+ Assets.images.iconDrawerCheckUpdates.image(),
|
|
|
+ StringName.mainDrawerCheckUpdates.tr,
|
|
|
+ () {},
|
|
|
+ rightView: Text(
|
|
|
+ controller.versionName,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.tertiaryTextColor),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ buildOperationItem(
|
|
|
+ Assets.images.iconComplaintAndReport.image(),
|
|
|
+ StringName.mainDrawerComplaintAndReport.tr,
|
|
|
+ () {},
|
|
|
+ ),
|
|
|
+ buildOperationItem(
|
|
|
+ Assets.images.iconLogoff.image(),
|
|
|
+ StringName.mainDrawerLogoff.tr,
|
|
|
+ () {},
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Container _buildContent1() {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 8.h),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(12.w),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // buildOperationItem(
|
|
|
+ // Assets.images.iconTempManagement.image(),
|
|
|
+ // StringName.mainDrawerTemplateManagement.tr,
|
|
|
+ // () {},
|
|
|
+ // ),
|
|
|
+ Builder(builder: (context) {
|
|
|
+ return buildOperationItem(
|
|
|
+ Assets.images.iconIndustryChange.image(),
|
|
|
+ StringName.mainDrawerIndustryPositionChange.tr,
|
|
|
+ () {
|
|
|
+ showStartSheet(context);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildUserInfoView() {
|
|
|
+ return Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: 44.w,
|
|
|
+ height: 44.w,
|
|
|
+ child: Assets.images.iconHomeLogged.image()),
|
|
|
+ SizedBox(width: 10.w),
|
|
|
+ Text(controller.loginTxt,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20.sp,
|
|
|
+ color: ColorName.primaryTextColor,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildOperationItem(Image icon, String title, Function onTap,
|
|
|
+ {Widget? rightView = const SizedBox.shrink()}) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ onTap();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 12).h,
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 16.w),
|
|
|
+ SizedBox(width: 20.w, height: 20.w, child: icon),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Expanded(
|
|
|
+ child: Text(title,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp, color: ColorName.primaryTextColor)),
|
|
|
+ ),
|
|
|
+ const Spacer(),
|
|
|
+ rightView ?? const SizedBox.shrink(),
|
|
|
+ SizedBox(width: 16.w)
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ void showStartSheet(BuildContext context) {
|
|
|
+ showModalBottomSheet(
|
|
|
+ context: context,
|
|
|
+ isScrollControlled: true,
|
|
|
+ barrierColor: ColorName.black55,
|
|
|
+ backgroundColor: ColorName.transparent,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return const ChatStartPage();
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Color backgroundColor() {
|
|
|
+ return '#F6F5F8'.toColor();
|
|
|
+ }
|
|
|
+}
|