完成任务发布

pull/1/head
张萌 3 years ago
parent f623ea1f65
commit 7baefdc458

@ -10,6 +10,7 @@ import Flutter
// if #available(iOS 10.0, *) { // if #available(iOS 10.0, *) {
// UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate // UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
// } // }
AMapServices.shared().apiKey ="84041703f7ecb242685325796897eff4"
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }

@ -1,26 +1,26 @@
import 'dart:io'; import 'dart:io';
import 'package:aku_new_community/main_initialize.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/developer_util.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:amap_flutter_location/amap_flutter_location.dart';
// import 'package:amap_search_fluttify/amap_search_fluttify.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:amap_flutter_location/amap_flutter_location.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:aku_new_community/main_initialize.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:aku_new_community/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/utils/developer_util.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import '../tab_navigator.dart'; import '../tab_navigator.dart';
class SplashPage extends StatefulWidget { class SplashPage extends StatefulWidget {
@ -48,6 +48,7 @@ class _SplashPageState extends State<SplashPage> {
final appProvider = Provider.of<AppProvider>(context, listen: false); final appProvider = Provider.of<AppProvider>(context, listen: false);
appProvider.initApplications(); appProvider.initApplications();
appProvider.startLocation(); appProvider.startLocation();
// await AmapCore.init('84041703f7ecb242685325796897eff4');
if (HiveStore.appBox!.get('login') ?? false) { if (HiveStore.appBox!.get('login') ?? false) {
//// ////
await userProvider.setLogin(HiveStore.appBox!.get('token')); await userProvider.setLogin(HiveStore.appBox!.get('token'));

@ -0,0 +1,138 @@
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class AddAppointmentAddressPage extends StatefulWidget {
const AddAppointmentAddressPage({Key? key}) : super(key: key);
@override
_AddAppointmentAddressPageState createState() =>
_AddAppointmentAddressPageState();
}
class _AddAppointmentAddressPageState extends State<AddAppointmentAddressPage> {
TextEditingController _controller = TextEditingController();
TextEditingController _tagController = TextEditingController();
@override
void dispose() {
_controller.dispose();
_tagController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '添加预约地址',
body: SafeArea(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
children: [
Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Column(
children: [
//TODO:search api poi
// GestureDetector(
// onTap: () {},
// child: Material(
// color: Colors.transparent,
// child: Row(
// children: [
// SizedBox(
// width: 170.w,
// child: '所在地'
// .text
// .size(28.sp)
// .color(Colors.black.withOpacity(0.65))
// .make(),
// ),
// '${S.of(context)?.tempPlotName}(默认)'
// .text
// .size(28.sp)
// .color(Colors.black.withOpacity(0.65))
// .make(),
// ],
// ),
// ),
// ),
Row(
children: [
SizedBox(
width: 170.w,
child: '标志建筑'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
),
Expanded(
child: TextField(
autofocus: false,
controller: _tagController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入标志建筑',
contentPadding: EdgeInsets.zero,
isDense: true,
hintStyle: TextStyle(
color: Colors.black.withOpacity(0.45),
fontSize: 28.sp,
)),
)),
],
),
32.hb,
BeeDivider.horizontal(),
32.hb,
Row(
children: [
SizedBox(
width: 170.w,
child: '具体地址'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
),
Expanded(
child: TextField(
autofocus: false,
controller: _controller,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入具体地址',
contentPadding: EdgeInsets.zero,
isDense: true,
hintStyle: TextStyle(
color: Colors.black.withOpacity(0.45),
fontSize: 28.sp,
)),
)),
],
)
],
),
),
56.hb,
BeeLongButton(
onPressed: () {
Get.back(result: {
'address': _tagController.text,
'addressDetail': _controller.text,
});
},
text: '提交'),
],
),
),
);
}
}

@ -0,0 +1,75 @@
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/bee_search_text_field.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
// import 'package:amap_search_fluttify/amap_search_fluttify.dart' as search;
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
class LocationView extends StatefulWidget {
const LocationView({Key? key}) : super(key: key);
@override
_LocationViewState createState() => _LocationViewState();
}
class _LocationViewState extends State<LocationView> {
AMapController? _mapController;
var poiList = [];
LatLng? _target;
@override
void initState() {
Future.delayed(Duration(seconds: 0), () async {
var location = await Permission.locationWhenInUse.isGranted;
if (!location) {
await Permission.locationWhenInUse.request();
}
_target = LatLng(
(UserTool.appProveider.location?['latitude'] ?? 0) as double,
(UserTool.appProveider.location?['longitude'] ?? 0) as double,
);
// poiList = await search.AmapSearch.instance.searchAround(search.LatLng(
// (UserTool.appProveider.location?['latitude'] ?? 0) as double,
// (UserTool.appProveider.location?['longitude'] ?? 0) as double,
// ));
// print(poiList.length);
});
super.initState();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: BeeSearchTextField(),
body: Stack(
children: [
AMapWidget(
privacyStatement: AMapPrivacyStatement(
hasContains: true, hasShow: true, hasAgree: true),
onMapCreated: (controller) {
// final appProvider =
// Provider.of<AppProvider>(context, listen: false);
// LatLng _target = LatLng(
// (appProvider.location?['latitude'] ?? 0) as double,
// (appProvider.location?['longitude'] ?? 0) as double,
// );
_mapController = controller;
_mapController!.moveCamera(
CameraUpdate.newCameraPosition(
CameraPosition(target: _target!, zoom: 18),
),
);
},
myLocationStyleOptions: MyLocationStyleOptions(
true,
circleFillColor: Theme.of(context).primaryColor.withOpacity(0.2),
circleStrokeColor: Theme.of(context).primaryColor,
),
),
],
),
);
}
}

@ -1,13 +1,17 @@
import 'dart:io'; import 'dart:io';
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/ui/service/add_appointment_address_page.dart';
import 'package:aku_new_community/ui/service/task_func.dart'; import 'package:aku_new_community/ui/service/task_func.dart';
import 'package:aku_new_community/ui/service/task_remark_page.dart'; import 'package:aku_new_community/ui/service/task_remark_page.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_record_voice_widget.dart'; import 'package:aku_new_community/widget/bee_record_voice_widget.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.dart'; import 'package:aku_new_community/widget/picker/bee_date_picker.dart';
import 'package:aku_new_community/widget/picker/bee_pick_image_widget.dart'; import 'package:aku_new_community/widget/picker/bee_pick_image_widget.dart';
import 'package:aku_new_community/widget/picker/bee_picker_box.dart'; import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
@ -29,28 +33,38 @@ class PublishTaskPage extends StatefulWidget {
class _PublishTaskPageState extends State<PublishTaskPage> { class _PublishTaskPageState extends State<PublishTaskPage> {
List<String> _types = ['跑腿', '代驾', '装修', '陪玩', '家政', '维修', '搬家', '家教', '其他']; List<String> _types = ['跑腿', '代驾', '装修', '陪玩', '家政', '维修', '搬家', '家教', '其他'];
//
int _type = 0; int _type = 0;
List<String> _sexStr = ['', '', '不限']; List<String> _sexStr = ['', '', '不限'];
int _sex = 0; int _sex = 0;
//
int _service = 0; int _service = 0;
List<String> _serviceObject = ['住户', '物业', '不限']; List<String> _serviceObject = ['住户', '物业', '不限'];
List<String> _rewardTypes = ['赏金', '积分']; List<String> _rewardTypes = ['赏金', '积分'];
//
int _rewardType = 0; int _rewardType = 0;
DateTime? _appointDate = DateTime.now(); DateTime? _appointDate;
TextEditingController _titleController = TextEditingController();
TextEditingController _addressController = TextEditingController(); DateTime? _appointEndDate;
TextEditingController _rewardController = TextEditingController(); TextEditingController _rewardController = TextEditingController();
TextEditingController _nameController = TextEditingController(); TextEditingController _nameController = TextEditingController();
TextEditingController _telController = TextEditingController(); TextEditingController _telController = TextEditingController();
String? _content; String? _content;
List<File> _photos = []; List<File> _photos = [];
String? _voiceUri; String? _voiceUri;
String? _accessAddress;
String? _accessAddressDetail;
String? _serviceAddress;
String? _serviceAddressDetail;
@override @override
void dispose() { void dispose() {
_titleController.dispose();
_addressController.dispose();
_rewardController.dispose(); _rewardController.dispose();
_nameController.dispose();
_telController.dispose();
super.dispose(); super.dispose();
} }
@ -88,27 +102,45 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
), ),
bottomNavi: Padding( bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: MaterialButton( child: BeeLongButton(
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: !canTap onPressed: !canTap
? null ? null
: () async { : () async {
var cancel = BotToast.showLoading(); var cancel = BotToast.showLoading();
var _voiceUrl;
if (_voiceUri != null) {
try {
_voiceUrl = await NetUtil().upload(
SARSAPI.uploadFile.uploadImg,
File.fromUri(Uri(path: _voiceUri)));
} catch (e) {
print(e.toString());
}
}
var imgs;
if (_photos.isNotEmpty) {
try {
imgs = await NetUtil()
.uploadFiles(_photos, SARSAPI.uploadFile.uploadImg);
} catch (e) {
print(e.toString());
}
}
var re = await TaskFunc.publish( var re = await TaskFunc.publish(
title: _titleController.text, type: _type,
taskType: _type, sex: _sex,
taskSex: _sex, servicePersonnel: _service,
serviceObject: _service, readyStartTime: _appointDate.toString(),
taskContent: _content ?? '', readyEndTime: _appointEndDate.toString(),
taskDate: _appointDate.toString(), contact: _nameController.text,
taskAddress: _addressController.text, tel: _telController.text,
accessAddress: _accessAddress!,
accessAddressDetail: _accessAddressDetail!,
serviceAddress: _serviceAddress,
serviceAddressDetail: _serviceAddressDetail,
remarks: _content,
voiceUrl: _voiceUrl,
imgUrls: imgs,
rewardType: _rewardType, rewardType: _rewardType,
reward: _rewardController.text); reward: _rewardController.text);
if (re) { if (re) {
@ -116,7 +148,7 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
} }
cancel(); cancel();
}, },
child: '确认发布'.text.size(32.sp).bold.make(), text: '确认发布',
), ),
), ),
); );
@ -363,35 +395,57 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
} }
Container _dateAndAddress() { Container _dateAndAddress() {
var date = GestureDetector( var date = Row(
onTap: () async { children: [
_appointDate = await BeeDatePicker.timePicker(DateTime.now()); SizedBox(
}, width: 170.w,
child: Material( child: '预计时间'
color: Colors.transparent, .text
child: Row( .size(28.sp)
children: [ .color(Colors.black.withOpacity(0.45))
SizedBox( .make(),
width: 170.w, ),
child: '预计时间' Expanded(
.text child: GestureDetector(
.size(28.sp) onTap: () async {
.color(Colors.black.withOpacity(0.45)) _appointDate = await BeeDatePicker.timePicker(DateTime.now());
.make(), setState(() {});
},
child: Material(
color: Colors.transparent,
child:
'${DateUtil.formatDate(_appointDate, format: DateFormats.zh_mo_d_h_m)}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
), ),
'${DateUtil.formatDate(_appointDate)}' ),
.text ),
.size(28.sp) '-'.text.size(28.sp).color(Colors.black.withOpacity(0.85)).make(),
.color(Colors.black.withOpacity(_type == 0 ? 0.25 : 0.85)) Expanded(
.make(), child: GestureDetector(
Spacer(), onTap: () async {
Icon( _appointEndDate = await BeeDatePicker.timePicker(DateTime.now());
CupertinoIcons.chevron_right, setState(() {});
size: 24.w, },
child: Material(
color: Colors.transparent,
child:
'${DateUtil.formatDate(_appointEndDate, format: DateFormats.zh_mo_d_h_m)}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(_type == 0 ? 0.25 : 0.85))
.make(),
), ),
], ),
), ),
), Spacer(),
Icon(
CupertinoIcons.chevron_right,
size: 24.w,
),
],
); );
var contact = Row( var contact = Row(
children: [ children: [
@ -476,7 +530,14 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
BeeDivider.horizontal(), BeeDivider.horizontal(),
32.w.heightBox, 32.w.heightBox,
GestureDetector( GestureDetector(
onTap: () {}, onTap: () async {
var re = await Get.to(() => AddAppointmentAddressPage());
if (re != null) {
_accessAddress = re['address'];
_accessAddressDetail = re['addressDetail'];
setState(() {});
}
},
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
@ -508,7 +569,7 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
children: [ children: [
'鲍汁牛肉饭'.text.size(32.sp).black.bold.make(), '鲍汁牛肉饭'.text.size(32.sp).black.bold.make(),
12.w.heightBox, 12.w.heightBox,
'江西省萍乡市莲花县良坊镇 19 幢 252 室daidjwoajdiowajdoiwa' '${_accessAddress ?? ''}'
.text .text
.maxLines(1) .maxLines(1)
.overflow(TextOverflow.ellipsis) .overflow(TextOverflow.ellipsis)
@ -545,7 +606,14 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
], ],
), ),
GestureDetector( GestureDetector(
onTap: () {}, onTap: () async {
var re = await Get.to(() => AddAppointmentAddressPage());
if (re != null) {
_serviceAddress = re['address'];
_serviceAddressDetail = re['addressDetail'];
setState(() {});
}
},
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
@ -583,7 +651,7 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
.bold .bold
.make(), .make(),
12.w.heightBox, 12.w.heightBox,
'江西省萍乡市莲花县良坊镇 19 幢 252 室daidjwoajdiowajdoiwa' '${_serviceAddress ?? ''}'
.text .text
.maxLines(1) .maxLines(1)
.overflow(TextOverflow.ellipsis) .overflow(TextOverflow.ellipsis)
@ -628,6 +696,7 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
_content = await Get.to(() => TaskRemarkPage()); _content = await Get.to(() => TaskRemarkPage());
setState(() {});
}, },
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
@ -641,13 +710,15 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
), ),
'${_content == null ? '请输入任务备注' : _content}' Expanded(
.text child: '${_content == null ? '请输入任务备注' : _content}'
.size(28.sp) .text
.color(Colors.black .size(28.sp)
.withOpacity(_rewardType == 0 ? 0.25 : 0.85)) .color(Colors.black
.make(), .withOpacity(_rewardType == 0 ? 0.25 : 0.85))
Spacer(), .make(),
),
20.wb,
Icon( Icon(
CupertinoIcons.chevron_right, CupertinoIcons.chevron_right,
size: 24.w, size: 24.w,
@ -861,10 +932,10 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
} }
bool get canTap { bool get canTap {
if (_titleController.text.isEmpty) { if (_type == 0) {
return false; return false;
} }
if (_type == 0) { if (_service == 0) {
return false; return false;
} }
if (_rewardType == 0) { if (_rewardType == 0) {
@ -876,15 +947,24 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
if (_appointDate == null) { if (_appointDate == null) {
return false; return false;
} }
if (_content == null) { if (_appointEndDate == null) {
return false;
}
if (_accessAddress == null) {
return false; return false;
} }
if (_addressController.text.isEmpty) { if (_accessAddressDetail == null) {
return false; return false;
} }
if (_rewardController.text.isEmpty) { if (_rewardController.text.isEmpty) {
return false; return false;
} }
if (_nameController.text.isEmpty) {
return false;
}
if (_telController.text.isEmpty) {
return false;
}
return true; return true;
} }

@ -4,26 +4,41 @@ import 'package:aku_new_community/utils/network/net_util.dart';
class TaskFunc { class TaskFunc {
/// ///
static Future<bool> publish( static Future<bool> publish({
{required String title, required int type,
required int taskType, required int sex,
required int taskSex, required int servicePersonnel,
required int serviceObject, required String readyStartTime,
required String taskContent, required String readyEndTime,
required String taskDate, required String contact,
required String taskAddress, required String tel,
required int rewardType, required String accessAddress,
required String reward}) async { required String accessAddressDetail,
required String? serviceAddress,
required String? serviceAddressDetail,
required String? remarks,
required String voiceUrl,
required List<String> imgUrls,
required int rewardType,
required String reward,
}) async {
var base = await NetUtil().post(API.manager.task.publish, params: { var base = await NetUtil().post(API.manager.task.publish, params: {
'title': title, 'type': type,
'taskType': taskType, 'sex': sex,
'taskSex': taskSex, 'servicePersonnel': servicePersonnel,
'serviceObject': serviceObject, 'readyStartTime': readyStartTime,
'taskContent': taskContent, 'readyEndTime': readyEndTime,
'taskDate': taskDate, 'contact': contact,
'taskAddress': taskAddress, 'tel': tel,
'accessAddress': accessAddress,
'accessAddressDetail': accessAddressDetail,
'serviceAddress': serviceAddress,
'serviceAddressDetail': serviceAddressDetail,
'remarks': remarks,
'voiceUrl': voiceUrl,
'imgUrls': imgUrls,
'rewardType': rewardType, 'rewardType': rewardType,
'reward': int.parse(reward), 'reward': reward,
}); });
return base.success; return base.success;
} }

@ -1,10 +1,11 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:flutter/cupertino.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:get/get.dart';
import 'package:velocity_x/src/extensions/num_ext.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class TaskRemarkPage extends StatefulWidget { class TaskRemarkPage extends StatefulWidget {
const TaskRemarkPage({Key? key}) : super(key: key); const TaskRemarkPage({Key? key}) : super(key: key);
@ -15,6 +16,14 @@ class TaskRemarkPage extends StatefulWidget {
class _TaskRemarkPageState extends State<TaskRemarkPage> { class _TaskRemarkPageState extends State<TaskRemarkPage> {
TextEditingController _contentController = TextEditingController(); TextEditingController _contentController = TextEditingController();
List<String> _shortcutLabel = [];
bool _edit = false;
@override
void initState() {
_shortcutLabel = HiveStore.shortcutBox!.values.cast<String>().toList();
super.initState();
}
@override @override
void dispose() { void dispose() {
@ -29,54 +38,152 @@ class _TaskRemarkPageState extends State<TaskRemarkPage> {
body: ListView( body: ListView(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
children: [ children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
'任务内容'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
32.w.heightBox,
Container( Container(
width: double.infinity, padding: EdgeInsets.all(32.w),
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06), color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
borderRadius: BorderRadius.circular(16.w)), child: Column(
child: TextField( children: [
controller: _contentController, Row(
autofocus: false, mainAxisAlignment: MainAxisAlignment.start,
onChanged: (text) => setState(() {}), children: [
minLines: 5, '任务内容'
maxLength: 200, .text
maxLines: 20, .size(28.sp)
decoration: InputDecoration( .color(Colors.black.withOpacity(0.45))
border: InputBorder.none, .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,
),
),
),
32.w.heightBox,
Row(
children: [
'快捷标签'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
GestureDetector(
onTap: () {
_edit = !_edit;
setState(() {});
},
child: Material(
color: Colors.transparent,
child: Row(
children: [
'${_edit ? '保存' : '编辑'}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
),
),
],
),
32.w.heightBox,
Wrap(
spacing: 12.w,
runSpacing: 12.w,
children: _shortcutLabel
.mapIndexed((currentValue, index) =>
label(currentValue, _edit, index))
.toList(),
),
],
), ),
) ),
], ],
), ),
bottomNavi: Padding( bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: MaterialButton( child: BeeLongButton(
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 { onPressed: () async {
var inBox = _shortcutLabel.contains(_contentController.text);
if (!inBox&&_contentController.text.isNotEmpty) {
await HiveStore.shortcutBox!.add(_contentController.text);
}
Get.back(result: _contentController.text); Get.back(result: _contentController.text);
}, },
child: '完成'.text.size(32.sp).bold.make(), text: '完成',
), ),
), ),
); );
} }
Widget label(String text, bool edit, int index) {
var textHandled = '';
if (text.length > 10) {
textHandled = text.replaceRange(10, null, '');
} else {
textHandled = text;
}
return Stack(
clipBehavior: Clip.none,
children: [
GestureDetector(
onTap: () {
_contentController.text = text;
setState(() {});
},
child: Material(
color: Colors.transparent,
child: FittedBox(
child: Container(
height: 60.w,
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 8.w),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Colors.black.withOpacity(0.25)),
borderRadius: BorderRadius.circular(8.w)),
child: textHandled.text
.size(22.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
),
),
),
if (edit)
Positioned(
top: -10.w,
right: -10.w,
child: GestureDetector(
onTap: () {
_shortcutLabel.removeAt(index);
HiveStore.shortcutBox!.deleteAt(index);
setState(() {});
},
child: Material(
child: Icon(
CupertinoIcons.xmark_circle_fill,
size: 40.w,
color: Colors.black.withOpacity(0.45),
),
),
))
],
);
}
} }

@ -1,21 +1,24 @@
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
import 'package:aku_new_community/model/user/province_model.dart'; import 'package:aku_new_community/model/user/province_model.dart';
import 'package:aku_new_community/models/login/china_region_model.dart'; import 'package:aku_new_community/models/login/china_region_model.dart';
import 'package:aku_new_community/models/login/history_login_model.dart'; import 'package:aku_new_community/models/login/history_login_model.dart';
import 'package:aku_new_community/models/user/user_config_model.dart'; import 'package:aku_new_community/models/user/user_config_model.dart';
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
class HiveStore { class HiveStore {
static Box? _appBox; static Box? _appBox;
static Box? get appBox => _appBox; static Box? get appBox => _appBox;
static Box? _userBox; static Box? _userBox;
static Box? get userBox => _userBox; static Box? get userBox => _userBox;
static Box? _dataBox; static Box? _dataBox;
static Box? get dataBox => _dataBox; static Box? get dataBox => _dataBox;
static Box? _shortcutBox;
static Box? get shortcutBox => _dataBox;
static Future init() async { static Future init() async {
if (!kIsWeb) { if (!kIsWeb) {
@ -30,6 +33,7 @@ class HiveStore {
_appBox = await Hive.openBox('app'); _appBox = await Hive.openBox('app');
_userBox = await Hive.openBox('userBox'); _userBox = await Hive.openBox('userBox');
_dataBox = await Hive.openBox('dataBox'); _dataBox = await Hive.openBox('dataBox');
_shortcutBox = await Hive.openBox('shortcut');
} }
} }
} }

@ -0,0 +1,26 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class BeeLongButton extends StatelessWidget {
final VoidCallback? onPressed;
final String text;
const BeeLongButton({Key? key, required this.onPressed, required this.text})
: super(key: key);
@override
Widget build(BuildContext context) {
return 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: onPressed,
child: text.text.size(32.sp).bold.make(),
);
}
}

@ -124,7 +124,8 @@ class _VoicePlayerState extends State<VoicePlayer>
@override @override
void dispose() { void dispose() {
stopPlay(); _timer?.cancel();
_timer = null;
player.dispose(); player.dispose();
controller.dispose(); controller.dispose();
animation.removeListener(() {}); animation.removeListener(() {});

@ -86,6 +86,7 @@ dependencies:
amap_flutter_map: ^3.0.0 amap_flutter_map: ^3.0.0
amap_flutter_location: ^3.0.0 amap_flutter_location: ^3.0.0
amap_flutter_base: ^3.0.0 amap_flutter_base: ^3.0.0
# amap_search_fluttify: 0.17.0-dev.0
#动态文字 #动态文字
animated_text_kit: ^4.2.1 animated_text_kit: ^4.2.1
#分享功能 #分享功能

Loading…
Cancel
Save