diff --git a/lib/ui/profile/house/contract_preview_page.dart b/lib/ui/profile/house/contract_preview_page.dart new file mode 100644 index 00000000..913e2a37 --- /dev/null +++ b/lib/ui/profile/house/contract_preview_page.dart @@ -0,0 +1,76 @@ +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/ui/profile/house/download_contract_page.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; +import 'package:aku_community/widget/others/sign_name_board.dart'; +import 'package:dotted_border/dotted_border.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class ContractPreviewPage extends StatefulWidget { + ContractPreviewPage({Key? key}) : super(key: key); + + @override + _ContractPreviewPageState createState() => _ContractPreviewPageState(); +} + +class _ContractPreviewPageState extends State { + Uint8List? _signName; + File? _signFile; + @override + Widget build(BuildContext context) { + var signName = GestureDetector( + child: DottedBorder( + child: Container( + alignment: Alignment.center, + width: 300.w, + height: 300.w, + color: Colors.white, + child: _signName != null + ? Image.memory( + _signName!, + fit: BoxFit.fitWidth, + ) + : '签字区'.text.size(28.sp).bold.color(ktextPrimary).make(), + ), + ), + onTap: () async { + _signName = await SignNameBoard.defalutBoard(); + if (_signName != null) { + _signFile = File.fromRawPath(_signName!); + } + setState(() {}); + }, + ); + return BeeScaffold( + title: '合同预览', + body: ListView( + children: [ + Stack( + children: [ + FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: 'image'), + Positioned( + right: 70.w, + bottom: 200.w, + child: signName, + ), + ], + ), + ], + ), + bottomNavi: BottomButton( + onPressed: () { + Get.to(() => DownLoadContractPage(firstRoute: true)); + }, + child: '生成合同'.text.size(32.sp).color(ktextPrimary).make()), + ); + } +} diff --git a/lib/ui/profile/house/download_contract_page.dart b/lib/ui/profile/house/download_contract_page.dart new file mode 100644 index 00000000..39dac93c --- /dev/null +++ b/lib/ui/profile/house/download_contract_page.dart @@ -0,0 +1,61 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/others/finish_result_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class DownLoadContractPage extends StatefulWidget { + final bool firstRoute; + DownLoadContractPage({Key? key, required this.firstRoute}) : super(key: key); + + @override + _DownLoadContractPageState createState() => _DownLoadContractPageState(); +} + +class _DownLoadContractPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '合同信息', + body: Center( + child: Column( + children: [ + 80.w.heightBox, + FinishResultImage(status: true), + 48.w.heightBox, + '${widget.firstRoute ? '生成成功' : '合同已生成'}' + .text + .size(36.sp) + .color(ktextPrimary) + .make(), + 24.w.heightBox, + '请下载合同'.text.size(26.sp).color(ktextSubColor).make(), + '完善信息并盖章后再上传合同'.text.size(26.sp).color(ktextSubColor).make(), + 126.w.heightBox, + Row( + children: [ + MaterialButton( + color: Colors.white, + elevation: 0, + padding: EdgeInsets.symmetric(vertical:16.w ,horizontal: 78.w), + onPressed: () {}, + child: + '下载合同'.text.size(32.sp).bold.color(ktextPrimary).make(), + ).expand(), + MaterialButton( + padding: EdgeInsets.symmetric(vertical:16.w ,horizontal: 78.w), + elevation: 0, + color: kPrimaryColor, + onPressed: () {}, + child: + '上传文件'.text.size(32.sp).bold.color(ktextPrimary).make(), + ) + ], + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui/profile/house/house_information_check_page.dart b/lib/ui/profile/house/house_information_check_page.dart index bed52734..ce833d3a 100644 --- a/lib/ui/profile/house/house_information_check_page.dart +++ b/lib/ui/profile/house/house_information_check_page.dart @@ -1,11 +1,13 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/ui/profile/house/contract_preview_page.dart'; import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/widget/bee_divider.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; class HouseInformationCheckPage extends StatefulWidget { @@ -23,7 +25,7 @@ class _HouseInformationCheckPageState extends State { title: '房屋信息核对', bodyColor: Colors.white, body: ListView( - padding: EdgeInsets.only(bottom: 24.w, left: 32.w,right: 32.w), + padding: EdgeInsets.only(bottom: 24.w, left: 32.w, right: 32.w), children: [ _houseHead(), _textTile('认定人才类型', '二类人才'), @@ -35,7 +37,9 @@ class _HouseInformationCheckPageState extends State { ].sepWidget(separate: 24.w.heightBox), ), bottomNavi: BottomButton( - onPressed: () {}, + onPressed: () { + Get.to(()=>ContractPreviewPage()); + }, child: '确认'.text.size(32.sp).bold.color(ktextPrimary).make(), ), ); diff --git a/lib/widget/others/finish_result_image.dart b/lib/widget/others/finish_result_image.dart new file mode 100644 index 00000000..6765b989 --- /dev/null +++ b/lib/widget/others/finish_result_image.dart @@ -0,0 +1,32 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class FinishResultImage extends StatelessWidget { + const FinishResultImage({ + Key? key, + required this.status, + }) : super(key: key); + + final bool? status; + + @override + Widget build(BuildContext context) { + return Container( + alignment: Alignment.center, + width: 110.w, + height: 110.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(55.w), + color: this.status! ? kPrimaryColor : kDangerColor, + ), + child: Icon( + this.status! + ? CupertinoIcons.checkmark + : CupertinoIcons.multiply, + size: 100.w, + ), + ); + } +} \ No newline at end of file diff --git a/lib/widget/others/sign_name_board.dart b/lib/widget/others/sign_name_board.dart new file mode 100644 index 00000000..e04daaba --- /dev/null +++ b/lib/widget/others/sign_name_board.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:signature/signature.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class SignNameBoard extends StatefulWidget { + static Future defalutBoard() async { + SignatureController _signatureController = SignatureController( + penColor: Colors.black, + penStrokeWidth: 5.w, + exportBackgroundColor: Colors.white, + ); + return await navigator!.push( + PageRouteBuilder( + fullscreenDialog: true, + opaque: false, + pageBuilder: (context, animation, sAnimation) { + return FadeTransition( + opacity: animation, + child: SignNameBoard( + signatureController: _signatureController, + ), + ); + }, + ), + ); + } + + final SignatureController signatureController; + + SignNameBoard({Key? key, required this.signatureController}) + : super(key: key); + + @override + _SignNameBoardState createState() => _SignNameBoardState(); +} + +class _SignNameBoardState extends State { + @override + void dispose() { + widget.signatureController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + Signature signature = Signature( + backgroundColor: Colors.white, + controller: widget.signatureController, + width: double.infinity, + height: 1000.w, + ); + IconButton finishButton = IconButton( + onPressed: () { + Get.back(result: widget.signatureController.toPngBytes()); + }, + icon: Icon( + CupertinoIcons.checkmark_alt_circle, + size: 100.w, + ), + ); + IconButton clearButton = IconButton( + onPressed: () { + widget.signatureController.clear(); + setState(() {}); + }, + icon: Icon( + CupertinoIcons.clear_circled, + size: 100.w, + ), + ); + return Center( + child: Column( + children: [ + signature, + 200.w.heightBox, + Material( + child: Row( + children: [ + finishButton.expand(), + clearButton.expand(), + ], + ), + ), + ], + ), + ); + } +}