棉花app新增页面
This commit is contained in:
77
lib/component/img/img_default_widget.dart
Normal file
77
lib/component/img/img_default_widget.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../controller/mh/apply_repair_controller.dart';
|
||||
|
||||
|
||||
class ImgPreviewDefaultWidget extends GetView {
|
||||
ApplyRepairController applyRepairController;
|
||||
|
||||
ImgPreviewDefaultWidget({required this.applyRepairController}) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
// onTap: applyRepairController.uploadImg,
|
||||
onTap: ()async{},
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.25,
|
||||
height: MediaQuery.sizeOf(context).height * 0.15,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 152,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.116,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 152,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF3F5F6),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Container(
|
||||
width: 35,
|
||||
height: 35,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: Image.asset(
|
||||
'assets/images/camera.png',
|
||||
).image,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 8, 0, 13),
|
||||
child: Text(
|
||||
' ',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: 11,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
23
lib/component/img/img_preview_controller.dart
Normal file
23
lib/component/img/img_preview_controller.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'img_preview_controller.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class ImgPreviewModel {
|
||||
//版本id
|
||||
String? url; //图片地址
|
||||
|
||||
|
||||
ImgPreviewModel();
|
||||
|
||||
static ImgPreviewModel fromJson(Map<String, dynamic> json) =>
|
||||
_$ImgPreviewModelFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ImgPreviewModelToJson(this);
|
||||
}
|
||||
|
||||
class ImgPreviewController extends GetControllerEx<ImgPreviewModel> {
|
||||
ImgPreviewController() {
|
||||
attr = GetModel(ImgPreviewModel()).obs;
|
||||
}
|
||||
}
|
||||
15
lib/component/img/img_preview_controller.g.dart
Normal file
15
lib/component/img/img_preview_controller.g.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'img_preview_controller.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ImgPreviewModel _$ImgPreviewModelFromJson(Map<String, dynamic> json) =>
|
||||
ImgPreviewModel()..url = json['url'] as String?;
|
||||
|
||||
Map<String, dynamic> _$ImgPreviewModelToJson(ImgPreviewModel instance) =>
|
||||
<String, dynamic>{
|
||||
'url': instance.url,
|
||||
};
|
||||
80
lib/component/img/img_preview_widget.dart
Normal file
80
lib/component/img/img_preview_widget.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../common/color/appFontsize.dart';
|
||||
import '../../controller/mh/apply_repair_controller.dart';
|
||||
|
||||
class ImgPreviewWidget extends GetView {
|
||||
String imgUrl;
|
||||
int index;
|
||||
ApplyRepairController applyRepairController;
|
||||
bool isDel;
|
||||
|
||||
ImgPreviewWidget(
|
||||
{required this.imgUrl,
|
||||
required this.index,
|
||||
required this.applyRepairController,
|
||||
required this.isDel}) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.25,
|
||||
height: MediaQuery.sizeOf(context).height * 0.15,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 140,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.116,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF3F5F6),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Image.network(
|
||||
'https://picsum.photos/seed/73/600',
|
||||
// applyRepairController.getPublicUrl(imgUrl),
|
||||
|
||||
width: 300,
|
||||
height: 200,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: isDel,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 8, 0, 13),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
applyRepairController.model.issue_img!.removeAt(index);
|
||||
applyRepairController.updateAll();
|
||||
},
|
||||
child: Text(
|
||||
'删除',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: AppFontsize.small_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
)),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user