parent
b5bcee3842
commit
fc22339a6e
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 531 B |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,82 @@
|
||||
import 'package:aku_new_community/base/base_style.dart';
|
||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/src/extensions/num_ext.dart';
|
||||
import 'package:velocity_x/src/extensions/string_ext.dart';
|
||||
|
||||
class TaskRemarkPage extends StatefulWidget {
|
||||
const TaskRemarkPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TaskRemarkPageState createState() => _TaskRemarkPageState();
|
||||
}
|
||||
|
||||
class _TaskRemarkPageState extends State<TaskRemarkPage> {
|
||||
TextEditingController _contentController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_contentController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '添加备注',
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
'任务内容'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
32.w.heightBox,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.06),
|
||||
borderRadius: BorderRadius.circular(16.w)),
|
||||
child: TextField(
|
||||
controller: _contentController,
|
||||
autofocus: false,
|
||||
onChanged: (text) => setState(() {}),
|
||||
minLines: 5,
|
||||
maxLength: 200,
|
||||
maxLines: 20,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomNavi: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
|
||||
child: MaterialButton(
|
||||
elevation: 0,
|
||||
height: 93.w,
|
||||
disabledColor: Colors.black.withOpacity(0.06),
|
||||
disabledTextColor: Colors.black.withOpacity(0.25),
|
||||
textColor: Colors.black.withOpacity(0.85),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(65.w)),
|
||||
color: kPrimaryColor,
|
||||
onPressed: () async {
|
||||
Get.back(result: _contentController.text);
|
||||
},
|
||||
child: '完成'.text.size(32.sp).bold.make(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
// Dart imports:
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:aku_new_community/extensions/widget_list_ext.dart';
|
||||
import 'package:aku_new_community/gen/assets.gen.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_image_picker.dart';
|
||||
// Package imports:
|
||||
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:velocity_x/velocity_x.dart';
|
||||
|
||||
class BeePickImageWidget extends StatefulWidget {
|
||||
final double? size;
|
||||
final Function(List<File> files) onChanged;
|
||||
final String description;
|
||||
|
||||
BeePickImageWidget(
|
||||
{Key? key, this.size, required this.onChanged, this.description = '上传照片'})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_BeePickImageWidgetState createState() => _BeePickImageWidgetState();
|
||||
}
|
||||
|
||||
class _BeePickImageWidgetState extends State<BeePickImageWidget> {
|
||||
List<File> _files = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
..._files.map((e) => showImage(e)).toList(),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await BeeImagePicker.pick(title: '选择图片').then(
|
||||
(value) {
|
||||
if (value != null) {
|
||||
_files.add(
|
||||
File(value.path),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
widget.onChanged(_files);
|
||||
setState(() {});
|
||||
},
|
||||
child: DottedBorder(
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
borderType: BorderType.RRect,
|
||||
strokeWidth: 2.w,
|
||||
dashPattern: [6, 3],
|
||||
radius: Radius.circular(8.w),
|
||||
child: Container(
|
||||
width: widget.size ?? 160.w,
|
||||
height: widget.size ?? 160.w,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
Assets.icons.camera.path,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
4.w.heightBox,
|
||||
widget.description.text
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.size(22.sp)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
),
|
||||
).material(color: Colors.transparent),
|
||||
)
|
||||
].sepWidget(separate: 10.w.widthBox),
|
||||
);
|
||||
}
|
||||
|
||||
Widget showImage(File file) {
|
||||
return Stack(children: [
|
||||
Container(
|
||||
width: widget.size ?? 160.w,
|
||||
height: widget.size ?? 160.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
color: Colors.black.withOpacity(0.03)),
|
||||
child: Image.file(file),
|
||||
),
|
||||
Positioned(
|
||||
top: 8.w,
|
||||
right: 8.w,
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
child: Icon(
|
||||
CupertinoIcons.xmark,
|
||||
size: 20.w,
|
||||
color: Colors.white,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.w),
|
||||
color: Color(0xFF000000),
|
||||
),
|
||||
).onTap(() {
|
||||
_files.remove(file);
|
||||
widget.onChanged(_files);
|
||||
setState(() {});
|
||||
}),
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue