| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- import 'dart:io';
- import 'package:clean/base/base_page.dart';
- import 'package:clean/module/image_picker/image_picker_util.dart';
- import 'package:clean/module/photo_info/photo_info_controller.dart';
- import 'package:clean/utils/expand.dart';
- import 'package:clean/utils/file_utils.dart';
- import 'package:flutter/Material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:wechat_assets_picker/wechat_assets_picker.dart';
- import '../../resource/assets.gen.dart';
- import '../../utils/image_util.dart';
- import 'dart:typed_data';
- class PhotoInfoPage extends BasePage<PhotoInfoController> {
- const PhotoInfoPage({super.key});
- @override
- bool statusBarDarkFont() => false;
- @override
- bool immersive() => true;
- @override
- Widget buildBody(BuildContext context) {
- return Stack(
- children: [
- SafeArea(
- child: Stack(
- children: [
- Column(
- // mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- margin: EdgeInsets.only(left: 16.w, top: 14.h),
- child: GestureDetector(
- onTap: () {
- Get.back();
- },
- child: Assets.images.iconCommonBack
- .image(width: 28.w, height: 28.w),
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 16.w, top: 12.h),
- child: Obx(() {
- if (controller.imageList.isEmpty) {
- return SizedBox.shrink();
- }
- return Text(
- controller.imageList[controller.currentImageIndex.value]
- .dateTitle ??
- "",
- style: TextStyle(
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 24.sp,
- ),
- );
- }),
- ),
- SizedBox(
- height: 20.h,
- ),
- _buildImageCarousel(),
- ],
- ),
- Visibility(
- visible: controller.type.value == FileType.analysis,
- child: Positioned(
- left: 0,
- right: 0,
- bottom: 0,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width:double.infinity,
- decoration: BoxDecoration(
- image: DecorationImage(image:
- Assets.images.bgPhotoAnalyze.provider(),fit: BoxFit.fill),
- borderRadius: BorderRadius.circular(12.r),
- ),
- margin: EdgeInsets.only(left: 18.w),
- child: Obx(() {
- return SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "Analysis Results",
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w900,
- fontSize: 16.sp,
- ),
- ),
- Visibility(
- visible: controller.createTime.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 20.h,
- ),
- Text(
- controller.createTime.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: controller.fileName.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.fileName.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: controller.model.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.model.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible:
- controller.focalLength.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.focalLength.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: controller.size.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.size.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: controller.iso.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.iso.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- Visibility(
- visible: controller.address.value.isNotEmpty,
- child: Column(
- children: [
- SizedBox(
- height: 12.h,
- ),
- Text(
- controller.address.value,
- style: TextStyle(
- shadows: [
- Shadow(
- color: Colors.black,
- blurRadius: 5.r,
- ),
- ],
- color: Colors.white,
- fontWeight: FontWeight.w500,
- fontSize: 13.sp,
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 32.h,
- ),
- ],
- ));
- }),
- ),
- Center(
- child: GestureDetector(
- onTap: () {
- controller.deleteBtnClick(
- controller.imageList[
- controller.currentImageIndex.value],
- controller.currentImageIndex.value);
- },
- child: Container(
- width: 328.w,
- height: 48.h,
- decoration: BoxDecoration(
- color: "#0279FB".color,
- borderRadius: BorderRadius.all(
- Radius.circular(10.r),
- ),
- ),
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Assets.images.iconPrivacyPhotoDelete
- .image(width: 18.w, height: 18.h),
- SizedBox(
- width: 5.w,
- ),
- Obx(() {
- if (controller.imageList.isEmpty) {
- return SizedBox.shrink();
- }
- return Text(
- controller.formatFileSize(controller
- .imageList[controller
- .currentImageIndex.value]
- .size ??
- 0),
- style: TextStyle(
- color: Colors.white,
- fontSize: 16.sp,
- fontWeight: FontWeight.w500,
- ),
- );
- }),
- ],
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- IgnorePointer(
- child: Assets.images.bgHome.image(
- width: 360.w,
- ),
- ),
- ],
- );
- }
- // 轮播图组件
- Widget _buildImageCarousel() {
- return Obx(() {
- if (controller.imageList.isEmpty) {
- return SizedBox.shrink();
- }
- return SizedBox(
- height: 492.h,
- width: ScreenUtil().screenWidth,
- child: PageView.builder(
- controller: PageController(
- viewportFraction: 1, // 显示部分下一张图片
- initialPage: controller.currentImageIndex.value,
- ),
- onPageChanged: (index) {
- controller.currentImageIndex.value = index;
- controller.loadPhotoInfo();
- PhotoManager.clearFileCache();
- },
- itemCount: controller.imageList.length,
- itemBuilder: (context, index) {
- final asset = controller.imageList[index];
- return AnimatedPadding(
- duration: Duration(milliseconds: 300),
- padding: EdgeInsets.symmetric(
- horizontal: 0.w,
- vertical:
- controller.currentImageIndex.value == index ? 0 : 20.h,
- ),
- child: GestureDetector(
- // onTap: () => _showImageDetail(asset),
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(12.r),
- boxShadow: [
- BoxShadow(
- color: Colors.black.withOpacity(0.2),
- blurRadius: 8,
- offset: Offset(0, 4),
- ),
- ],
- ),
- child: ClipRRect(
- child: FutureBuilder<File?>(
- key: ValueKey(asset.id),
- future:
- ImageUtil.getImageFile(controller.type.value, asset),
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data != null) {
- return InteractiveViewer(
- minScale: 0.5,
- maxScale: 3.0,
- child: Image.file(
- snapshot.data!,
- fit: BoxFit.fitHeight,
- width: double.infinity,
- height: 400,
- filterQuality: FilterQuality.high,
- ),
- );
- }
- return Container(
- color: Colors.grey[800],
- child: Icon(Icons.error, color: Colors.white60),
- );
- },
- ),
- ),
- ),
- ),
- );
- },
- ),
- );
- });
- }
- }
|