mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-25 02:28:35 +00:00
@@ -7,7 +7,6 @@ import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
class CreateVoteController extends GetxController {
|
||||
CreateVoteController(this.voteId);
|
||||
@@ -109,9 +108,9 @@ class CreateVoteController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onUpload(int index, XFile pickedFile) async {
|
||||
Future<void> onUpload(int index, String path) async {
|
||||
var res = await MsgHttp.uploadBfs(
|
||||
path: pickedFile.path,
|
||||
path: path,
|
||||
category: 'daily',
|
||||
biz: 'vote',
|
||||
);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'dart:io' show File;
|
||||
|
||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/dynamics/vote_model.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_create_vote/controller.dart';
|
||||
import 'package:PiliPlus/utils/date_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -414,7 +417,12 @@ class _CreateVotePageState extends State<CreateVotePage> {
|
||||
source: ImageSource.gallery,
|
||||
);
|
||||
if (pickedFile != null) {
|
||||
_controller.onUpload(index, pickedFile);
|
||||
final path = pickedFile.path;
|
||||
_controller.onUpload(index, path).whenComplete(() {
|
||||
if (Utils.isMobile) {
|
||||
File(path).tryDel();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
SmartDialog.showToast(e.toString());
|
||||
|
||||
Reference in New Issue
Block a user