From 61b197347eb165a89c8eba8a75c13c5e4c945299 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Mon, 28 Jun 2021 14:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=90=8D=E7=89=88=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E6=A8=AA=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/house/contract_preview_page.dart | 2 +- .../house/house_information_check_page.dart | 5 ++ lib/ui/profile/house/user_identify_page.dart | 6 +- lib/widget/others/sign_name_board.dart | 80 ++++++++++++++----- 4 files changed, 70 insertions(+), 23 deletions(-) diff --git a/lib/ui/profile/house/contract_preview_page.dart b/lib/ui/profile/house/contract_preview_page.dart index 245a6ddd..3f715585 100644 --- a/lib/ui/profile/house/contract_preview_page.dart +++ b/lib/ui/profile/house/contract_preview_page.dart @@ -36,7 +36,7 @@ class _ContractPreviewPageState extends State { child: Container( alignment: Alignment.center, width: 300.w, - height: 300.w, + height: 200.w, color: Colors.white, child: _signName != null ? Image.memory( diff --git a/lib/ui/profile/house/house_information_check_page.dart b/lib/ui/profile/house/house_information_check_page.dart index 4534156e..50b2cb44 100644 --- a/lib/ui/profile/house/house_information_check_page.dart +++ b/lib/ui/profile/house/house_information_check_page.dart @@ -69,6 +69,11 @@ class _HouseInformationCheckPageState extends State { id: widget.detailModel.id, url: result, )); + } else { + Get.off(() => ContractPreviewPage( + id: widget.detailModel.id, + url: '', + )); } } catch (e) { LoggerData.addData(e); diff --git a/lib/ui/profile/house/user_identify_page.dart b/lib/ui/profile/house/user_identify_page.dart index b65d9e58..5fbe5959 100644 --- a/lib/ui/profile/house/user_identify_page.dart +++ b/lib/ui/profile/house/user_identify_page.dart @@ -224,10 +224,8 @@ class _UserIdentifyPageState extends State { '返回'.text.size(34.sp).isIntrinsic.color(ktextPrimary).make()), CupertinoDialogAction( onPressed: () { - // Get.back(); - // Get.back(); - //TODO: 开发用 ,模块开发完成后删掉 - Get.to(() => TenantHouseListPage()); + Get.back(); + Get.back(); }, child: '回到首页' .text diff --git a/lib/widget/others/sign_name_board.dart b/lib/widget/others/sign_name_board.dart index cad75936..2bb1b879 100644 --- a/lib/widget/others/sign_name_board.dart +++ b/lib/widget/others/sign_name_board.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:signature/signature.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -20,6 +21,8 @@ class SignNameBoard extends StatefulWidget { return FadeTransition( opacity: animation, child: SignNameBoard( + width: 600.w, + height: double.infinity, signatureController: _signatureController, ), ); @@ -29,8 +32,14 @@ class SignNameBoard extends StatefulWidget { } final SignatureController signatureController; - - SignNameBoard({Key? key, required this.signatureController}) + final bool forceToHorizontal; + final double width; + final double height; + SignNameBoard( + {Key? key, + required this.signatureController, + this.forceToHorizontal = true, + required this.width, required this.height}) : super(key: key); @override @@ -38,9 +47,26 @@ class SignNameBoard extends StatefulWidget { } class _SignNameBoardState extends State { + @override + void initState() { + super.initState(); + if (widget.forceToHorizontal) { + WidgetsFlutterBinding.ensureInitialized(); + SystemChrome.setPreferredOrientations([ + DeviceOrientation.landscapeLeft, + DeviceOrientation.landscapeRight, + ]); + } + } + @override void dispose() { widget.signatureController.dispose(); + WidgetsFlutterBinding.ensureInitialized(); + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); super.dispose(); } @@ -49,43 +75,61 @@ class _SignNameBoardState extends State { Signature signature = Signature( backgroundColor: Colors.white, controller: widget.signatureController, - width: double.infinity, - height: 1000.w, + width: widget.width, + height:widget.height, ); IconButton finishButton = IconButton( + iconSize: 50.w, onPressed: () { Get.back(result: widget.signatureController.toPngBytes()); }, icon: Icon( CupertinoIcons.checkmark_alt_circle, - size: 100.w, + color: Colors.blue, + // size: 100.w, ), ); IconButton clearButton = IconButton( + iconSize: 50.w, onPressed: () { widget.signatureController.clear(); setState(() {}); }, icon: Icon( CupertinoIcons.clear_circled, - size: 100.w, + color: Colors.red, + // size: 100.w, ), ); - return Center( - child: Column( - children: [ - signature, - 200.w.heightBox, - Material( - child: Row( + return Scaffold( + body: widget.forceToHorizontal + ? Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - finishButton.expand(), - clearButton.expand(), + signature, + Material( + child: Column( + children: [ + finishButton.expand(), + clearButton.expand(), + ], + ), + ).expand() + ], + ) + : Column( + children: [ + signature, + Material( + child: Row( + children: [ + finishButton.expand(), + clearButton.expand(), + ], + ), + ).expand(), ], ), - ), - ], - ), ); } }