feat:增加common框架
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flisp_app/models/flisp.dart';
|
||||
import 'package:flisp_app/provider/flisp_provider.dart';
|
||||
import 'package:flisp_app/utils/minio_utils.dart';
|
||||
import 'package:flisp_app/widgets/flisp_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_common/utils/minio_utils.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -28,6 +28,7 @@ class FlispForm extends StatefulWidget {
|
||||
class _FlispFormState extends State<FlispForm> {
|
||||
bool _showTagOptions = false;
|
||||
final int maxContentCount = 100;
|
||||
final String bucketName = 'flisp';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -52,7 +53,7 @@ class _FlispFormState extends State<FlispForm> {
|
||||
final provider = Provider.of<FlispProvider>(context, listen: false);
|
||||
setState(() {
|
||||
provider.formItem.imageUrl =
|
||||
'${MinIOHelper().rustfsFileUrl}/${MinIOHelper().bucketName}/$fileName';
|
||||
'${MinIOHelper().fileUrl}/$bucketName/$fileName';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,18 +98,18 @@ class _FlispFormState extends State<FlispForm> {
|
||||
maxLines: 8,
|
||||
maxLength: maxContentCount,
|
||||
buildCounter: (
|
||||
context, {
|
||||
required currentLength,
|
||||
required isFocused,
|
||||
maxLength,
|
||||
}) {
|
||||
context, {
|
||||
required currentLength,
|
||||
required isFocused,
|
||||
maxLength,
|
||||
}) {
|
||||
return Text(
|
||||
'$currentLength/$maxContentCount',
|
||||
style: TextStyle(
|
||||
color:
|
||||
currentLength > maxLength!
|
||||
? Colors.red
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
currentLength > maxLength!
|
||||
? Colors.red
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -156,7 +157,10 @@ class _FlispFormState extends State<FlispForm> {
|
||||
|
||||
if (result != null) {
|
||||
PlatformFile file = result.files.first;
|
||||
final fileName = await MinIOHelper().uploadFile(file: file);
|
||||
final fileName = await MinIOHelper().uploadFile(
|
||||
bucketName: bucketName,
|
||||
file: file,
|
||||
);
|
||||
_selectImage(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user