添加 合同下载页面

添加 合同上传页面
使用canvas 绘制上传图标样式
hmxc
张萌 3 years ago
parent 9e7bcf9a1e
commit 033124b7cb

@ -0,0 +1,47 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class UploadPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
Paint paint = Paint()
..strokeWidth = 20.w
..color = Color(0xFFDEE1EB)
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
Path path = Path();
Rect rect = Rect.fromCircle(center: Offset(50.w, 100.w), radius: 40.w);
path.arcTo(rect, pi / 2, pi, true);
Rect rect2 = Rect.fromCircle(center: Offset(100.w, 60.w), radius: 50.w);
path.arcTo(rect2, pi, pi ,true);
Rect rect3= Rect.fromCircle(center: Offset(150.w, 100.w), radius: 40.w);
path.arcTo(rect3, 1.5 * pi, pi , true);
canvas.drawPath(path, paint);
Paint spaint = Paint()
..strokeWidth = 15.w
..color = Color(0xFFC3CCEA)
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
Path spath = Path();
spath.moveTo(100.w, 110.w);
spath.lineTo(75.w, 135.w);
spath.moveTo(100.w, 110.w);
spath.lineTo(125.w, 135.w);
spath.moveTo(100.w, 110.w);
spath.lineTo(100.w, 170.w);
canvas.drawPath(spath, spaint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
@override
bool shouldRebuildSemantics(CustomPainter oldDelegate) {
return false;
}
}

@ -1,3 +1,5 @@
import 'package:aku_community/widget/views/%20bee_download_view.dart';
import 'package:aku_community/widget/views/doc_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
@ -13,7 +15,6 @@ import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/picker/bee_image_preview.dart'; import 'package:aku_community/widget/picker/bee_image_preview.dart';
import 'package:aku_community/widget/views/%20bee_download_view.dart';
class NoticeDetailPage extends StatefulWidget { class NoticeDetailPage extends StatefulWidget {
final int? id; final int? id;
@ -31,38 +32,6 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
children: [], children: [],
); );
Widget docView(String title, String? path) {
// if (title?.isEmpty ?? true) return SizedBox();
return Container(
margin: EdgeInsets.only(right: 113.w),
alignment: Alignment.centerLeft,
child: MaterialButton(
minWidth: 606.w,
height: 154.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
title.text.size(32.sp).make().expand(),
Image.asset(
R.ASSETS_ICONS_FILE_PNG,
height: 52.w,
width: 52.w,
),
],
),
onPressed: () async {
String? result = await Get.dialog(BeeDownloadView(file: path));
if (result != null) OpenFile.open(result);
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFD4CFBE)),
),
color: Colors.white,
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -119,7 +88,16 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
44.hb, 44.hb,
model!.content!.text.size(28.sp).make(), model!.content!.text.size(28.sp).make(),
43.hb, 43.hb,
docView(model?.fileDocName ?? '', model!.fileDocUrl), DocViw(
title: model?.fileDocName ?? '',
onPressed: () async {
String? result = await Get.dialog(BeeDownloadView(
file: model!.fileDocUrl,
));
if (result != null) OpenFile.open(result);
},
),
], ],
), ),
).material(color: Colors.white), ).material(color: Colors.white),

@ -1,8 +1,10 @@
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/profile/house/upload_contracts_page.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/others/finish_result_image.dart'; import 'package:aku_community/widget/others/finish_result_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class DownLoadContractPage extends StatefulWidget { class DownLoadContractPage extends StatefulWidget {
@ -33,25 +35,38 @@ class _DownLoadContractPageState extends State<DownLoadContractPage> {
'请下载合同'.text.size(26.sp).color(ktextSubColor).make(), '请下载合同'.text.size(26.sp).color(ktextSubColor).make(),
'完善信息并盖章后再上传合同'.text.size(26.sp).color(ktextSubColor).make(), '完善信息并盖章后再上传合同'.text.size(26.sp).color(ktextSubColor).make(),
126.w.heightBox, 126.w.heightBox,
Row( Padding(
children: [ padding: EdgeInsets.symmetric(horizontal: 32.w),
MaterialButton( child: Row(
color: Colors.white, mainAxisAlignment: MainAxisAlignment.center,
elevation: 0, children: [
padding: EdgeInsets.symmetric(vertical:16.w ,horizontal: 78.w), MaterialButton(
onPressed: () {}, color: Colors.white,
child: elevation: 0,
'下载合同'.text.size(32.sp).bold.color(ktextPrimary).make(), minWidth: 280.w,
).expand(), shape: RoundedRectangleBorder(
MaterialButton( side: BorderSide(color: Color(0xFF666666), width: 1.w)),
padding: EdgeInsets.symmetric(vertical:16.w ,horizontal: 78.w), padding:
elevation: 0, EdgeInsets.symmetric(vertical: 16.w, horizontal: 78.w),
color: kPrimaryColor, onPressed: () {},
onPressed: () {}, child:
child: '下载合同'.text.size(32.sp).bold.color(ktextPrimary).make(),
'上传文件'.text.size(32.sp).bold.color(ktextPrimary).make(), ),
) 62.w.widthBox,
], MaterialButton(
minWidth: 280.w,
padding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 78.w),
elevation: 0,
color: kPrimaryColor,
onPressed: () {
Get.to(() => UploadContractsPage());
},
child:
'上传文件'.text.size(32.sp).bold.color(ktextPrimary).make(),
)
],
),
), ),
], ],
), ),

@ -0,0 +1,141 @@
import 'dart:io';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/painters/upload_painter.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/picker/bee_image_picker.dart';
import 'package:aku_community/widget/views/doc_view.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
class UploadContractsPage extends StatefulWidget {
UploadContractsPage({Key? key}) : super(key: key);
@override
_UploadContractsPageState createState() => _UploadContractsPageState();
}
class _UploadContractsPageState extends State<UploadContractsPage> {
List<File> _files = [];
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '上传文件',
body: ListView(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
children: [
100.w.heightBox,
_uploadWidget(),
64.w.heightBox,
Padding(
padding: EdgeInsets.symmetric(horizontal: 60.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
..._files
.map(
(e) => DocViw(
title: e.path.split('/').last,
margin: EdgeInsets.zero,
onLongPress: () async {
var deleteSheet = CupertinoActionSheet(
title: '删除文件'
.text
.size(28.sp)
.bold
.isIntrinsic
.color(ktextPrimary)
.make(),
actions: [
CupertinoActionSheetAction(
onPressed: () {
_files.remove(e);
Get.back();
setState(() {});
},
child: '删除'
.text
.size(32.sp)
.isIntrinsic
.bold
.color(kDangerColor)
.make())
],
);
await Get.bottomSheet(
deleteSheet,
);
},
onPressed: () async {
await OpenFile.open(e.path);
},
),
)
.toList()
].sepWidget(separate: 12.w.heightBox),
),
)
],
),
bottomNavi: BottomButton(
onPressed: () {},
child: '提交审核'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}
Widget _uploadWidget() {
return GestureDetector(
onTap: () async {
File? _file = await BeeImagePicker.pick(title: '选择合同照片');
if (_file != null) {
_files.add(_file);
setState(() {});
}
},
child: Center(
child: DottedBorder(
dashPattern: [6, 4],
child: Container(
width: 500.w,
height: 500.w,
color: Color(0x19C4C4C4),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
87.w.heightBox,
SizedBox(
width: 200.w,
height: 200.w,
child: CustomPaint(
painter: UploadPainter(),
),
),
43.w.heightBox,
'点击上传文件'
.text
.size(32.sp)
.color(Color(0xFFADB2C4))
.bold
.make(),
43.w.heightBox,
'仅支持PDF、PNG、JPG格式的文件'
.text
.size(28.sp)
.color(Color(0x999999))
.make(),
],
),
)),
),
);
}
}

@ -1,3 +1,5 @@
import 'package:aku_community/pages/tab_navigator.dart';
import 'package:aku_community/utils/developer_util.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -25,6 +27,13 @@ class FireDialog {
child: Text('确认'), child: Text('确认'),
onPressed: () => Get.back(), onPressed: () => Get.back(),
), ),
if (DeveloperUtil.dev)
CupertinoDialogAction(
child: Text('清除所有弹窗'),
onPressed: () => Get.offAll(
() => TabNavigator(),
),
),
], ],
), ),
barrierDismissible: false, barrierDismissible: false,

@ -25,7 +25,8 @@ class FinishResultImage extends StatelessWidget {
this.status! this.status!
? CupertinoIcons.checkmark ? CupertinoIcons.checkmark
: CupertinoIcons.multiply, : CupertinoIcons.multiply,
size: 100.w, size: 70.w,
color: Colors.white,
), ),
); );
} }

@ -0,0 +1,50 @@
import 'package:aku_community/const/resource.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class DocViw extends StatelessWidget {
const DocViw({
Key? key,
required this.title,
required this.onPressed,
this.margin, this.onLongPress,
}) : super(key: key);
final String title;
final VoidCallback onPressed;
final EdgeInsetsGeometry? margin;
final VoidCallback? onLongPress;
@override
Widget build(BuildContext context) {
// if (title?.isEmpty ?? true) return SizedBox();
return GestureDetector(
onLongPress: onLongPress,
child: Container(
margin: margin ?? EdgeInsets.only(right: 113.w),
alignment: Alignment.centerLeft,
child: MaterialButton(
minWidth: 606.w,
height: 154.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
title.text.size(32.sp).make().expand(),
Image.asset(
R.ASSETS_ICONS_FILE_PNG,
height: 52.w,
width: 52.w,
),
],
),
onPressed: onPressed,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFD4CFBE)),
),
color: Colors.white,
),
),
);
}
}
Loading…
Cancel
Save