You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.0 KiB

3 years ago
import 'dart:io';
3 years ago
import 'package:aku_new_community/painters/upload_painter.dart';
import 'package:aku_new_community/widget/picker/bee_image_picker.dart';
3 years ago
import 'package:dotted_border/dotted_border.dart';
3 years ago
import 'package:flutter/material.dart';
3 years ago
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class UploadWidget extends StatelessWidget {
final String sheetTitle;
final Function(File file) onPicked;
3 years ago
3 years ago
const UploadWidget(
{Key? key, required this.sheetTitle, required this.onPicked})
3 years ago
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () async {
File? _file = await BeeImagePicker.pick(title: sheetTitle);
if (_file != null) {
onPicked(_file);
3 years ago
}
},
child: Center(
child: DottedBorder(
dashPattern: [6, 4],
child: Container(
width: 500.w,
height: 500.w,
color: Color(0x19C4C4C4),
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
87.w.heightBox,
SizedBox(
width: 200.w,
height: 200.w,
child: CustomPaint(
painter: UploadPainter(),
),
),
40.w.heightBox,
'点击上传文件'
.text
.size(32.sp)
.color(Color(0xFFADB2C4))
.bold
.make(),
40.w.heightBox,
'仅支持PDF、PNG、JPG格式的文件'
.text
.size(28.sp)
.color(Color(0xFFADB2C4))
.make(),
],
),
)),
),
);
}
}