parent
b58a09d7d0
commit
9e7bcf9a1e
@ -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<ContractPreviewPage> {
|
||||
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()),
|
||||
);
|
||||
}
|
||||
}
|
@ -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<DownLoadContractPage> {
|
||||
@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(),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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<SignNameBoard> {
|
||||
@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(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue