签名版强制横屏

hmxc
张萌 3 years ago
parent 86700747fb
commit 61b197347e

@ -36,7 +36,7 @@ class _ContractPreviewPageState extends State<ContractPreviewPage> {
child: Container(
alignment: Alignment.center,
width: 300.w,
height: 300.w,
height: 200.w,
color: Colors.white,
child: _signName != null
? Image.memory(

@ -69,6 +69,11 @@ class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
id: widget.detailModel.id,
url: result,
));
} else {
Get.off(() => ContractPreviewPage(
id: widget.detailModel.id,
url: '',
));
}
} catch (e) {
LoggerData.addData(e);

@ -224,10 +224,8 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
'返回'.text.size(34.sp).isIntrinsic.color(ktextPrimary).make()),
CupertinoDialogAction(
onPressed: () {
// Get.back();
// Get.back();
//TODO:
Get.to(() => TenantHouseListPage());
Get.back();
Get.back();
},
child: '回到首页'
.text

@ -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<SignNameBoard> {
@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,33 +75,51 @@ class _SignNameBoardState extends State<SignNameBoard> {
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(
return Scaffold(
body: widget.forceToHorizontal
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
signature,
Material(
child: Column(
children: [
finishButton.expand(),
clearButton.expand(),
],
),
).expand()
],
)
: Column(
children: [
signature,
200.w.heightBox,
Material(
child: Row(
children: [
@ -83,7 +127,7 @@ class _SignNameBoardState extends State<SignNameBoard> {
clearButton.expand(),
],
),
),
).expand(),
],
),
);

Loading…
Cancel
Save