|
|
@@ -1,59 +1,176 @@
|
|
|
+import 'package:electronic_assistant/base/base_controller.dart';
|
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
|
import 'package:electronic_assistant/data/bean/store_item.dart';
|
|
|
import 'package:electronic_assistant/dialog/add_agenda_dialog.dart';
|
|
|
+import 'package:electronic_assistant/resource/assets.gen.dart';
|
|
|
+import 'package:electronic_assistant/resource/string.gen.dart';
|
|
|
import 'package:electronic_assistant/utils/expand.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/src/widgets/framework.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:get/get.dart';
|
|
|
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
|
|
import 'package:photo_manager/photo_manager.dart';
|
|
|
|
|
|
+import '../../resource/colors.gen.dart';
|
|
|
+import '../../utils/common_style.dart';
|
|
|
import 'controller.dart';
|
|
|
|
|
|
class AudioPickerPage extends BasePage<AudioPickerController> {
|
|
|
const AudioPickerPage({super.key});
|
|
|
|
|
|
@override
|
|
|
+ Color backgroundColor() {
|
|
|
+ return ColorName.transparent;
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: "#F6F5F8".toColor(),
|
|
|
+ borderRadius: const BorderRadius.only(
|
|
|
+ topLeft: Radius.circular(16),
|
|
|
+ topRight: Radius.circular(16),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
height: ScreenUtil().screenHeight - 70.h,
|
|
|
child: Column(
|
|
|
children: [
|
|
|
- Text('AudioPickerPage'),
|
|
|
+ _buildTitleView(),
|
|
|
Expanded(child: Obx(() {
|
|
|
return ListView.builder(
|
|
|
itemBuilder: _buildItem,
|
|
|
itemCount: controller.audioList.length,
|
|
|
);
|
|
|
- }))
|
|
|
+ })),
|
|
|
+ _buildImportBtnView()
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildTitleView() {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 18.h),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Center(
|
|
|
+ child: Text(
|
|
|
+ StringName.importLocalAudio.tr,
|
|
|
+ style:
|
|
|
+ TextStyle(fontSize: 17.sp, color: ColorName.primaryTextColor),
|
|
|
+ )),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(right: 16.w),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ Get.back();
|
|
|
+ },
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.centerRight,
|
|
|
+ child: Text(
|
|
|
+ StringName.cancel.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp, color: ColorName.secondaryTextColor),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _buildImportBtnView() {
|
|
|
+ return Container(
|
|
|
+ color: ColorName.white,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 6.h),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.onImportClick();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ height: 48.h,
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
|
+ width: double.infinity,
|
|
|
+ decoration: getCommonDecoration(8.w),
|
|
|
+ child: Center(
|
|
|
+ child: Text(
|
|
|
+ StringName.selectAndImport.tr,
|
|
|
+ style: TextStyle(fontSize: 16.sp, color: ColorName.white),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Widget _buildItem(BuildContext context, int index) {
|
|
|
AssetEntity entity = controller.audioList[index];
|
|
|
return GestureDetector(
|
|
|
onTap: () {
|
|
|
controller.onItemClick(entity);
|
|
|
},
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.only(bottom: 10),
|
|
|
- padding: EdgeInsets.all(10),
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text(entity.title ?? ''),
|
|
|
- Text(
|
|
|
- '创建时间:${entity.createDateSecond?.toFormattedDate('yyyy-MM-dd HH:mm:ss')}'),
|
|
|
- Text('时长:${entity.duration}'),
|
|
|
- ],
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
+ child: Obx(() {
|
|
|
+ return Container(
|
|
|
+ decoration: controller.currentEntity?.id == entity.id
|
|
|
+ ? BoxDecoration(
|
|
|
+ border: Border.all(color: '#6177F2'.toColor(), width: 2.w),
|
|
|
+ color: '#E7E9F6'.toColor(),
|
|
|
+ borderRadius: BorderRadius.circular(8.w),
|
|
|
+ )
|
|
|
+ : BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(8.w),
|
|
|
+ ),
|
|
|
+ margin: EdgeInsets.only(bottom: 8.h, left: 16.w, right: 16.w),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 14.h),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ Assets.images.iconFilesFile.image(width: 32.w, height: 32.w),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ maxLines: 2,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ entity.title ?? '',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp,
|
|
|
+ color: ColorName.primaryTextColor,
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text(entity.duration.toDouble().toFormattedDuration(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor)),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Container(
|
|
|
+ width: 1,
|
|
|
+ height: 9,
|
|
|
+ color: ColorName.tertiaryTextColor),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Text(
|
|
|
+ entity.createDateSecond
|
|
|
+ ?.toFormattedDate('yyyy-MM-dd HH:mm') ??
|
|
|
+ '',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
}
|