Add function to send back uploaded image to sent service method
This commit is contained in:
parent
a116508dd5
commit
d0a6b796ae
@ -1,16 +1,17 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/rounded_input_field.dart';
|
||||
import 'package:manager_app/Components/upload_online_resources_container.dart';
|
||||
import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Components/upload_image_container.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
class ResourceTab extends StatefulWidget {
|
||||
final ResourceDetailDTO resourceDetailDTO;
|
||||
final Function onFileUpload;
|
||||
const ResourceTab({
|
||||
Key key,
|
||||
this.resourceDetailDTO,
|
||||
this.onFileUpload,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -50,7 +51,7 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: getContent(widget.resourceDetailDTO),
|
||||
children: getContent(widget.resourceDetailDTO, widget.onFileUpload),
|
||||
controller: _tabController,
|
||||
),
|
||||
),
|
||||
@ -86,7 +87,7 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
||||
}
|
||||
}
|
||||
|
||||
getContent(ResourceDetailDTO resourceDetailDTO) {
|
||||
getContent(ResourceDetailDTO resourceDetailDTO, Function onFileUpload) {
|
||||
List<Widget> tabsToShow = new List<Widget>();
|
||||
|
||||
print("getContent");
|
||||
@ -101,6 +102,7 @@ getContent(ResourceDetailDTO resourceDetailDTO) {
|
||||
print("ONCHANGED image");
|
||||
print(file.path);
|
||||
//fileToSend = file;
|
||||
onFileUpload(file);
|
||||
resourceDetailDTO.type = ResourceType.image;
|
||||
}
|
||||
),
|
||||
@ -114,7 +116,6 @@ getContent(ResourceDetailDTO resourceDetailDTO) {
|
||||
child: UploadOnlineResourceContainer(
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
onChanged: (ResourceDetailDTO value) {
|
||||
print("ONcHanged UploadOnlineResourceContainer parent");
|
||||
resourceDetailDTO = value;
|
||||
},
|
||||
),
|
||||
|
||||
@ -44,7 +44,11 @@ void showNewResource(AppContext appContext, BuildContext context) {
|
||||
width: size.width *0.5,
|
||||
height: size.height *0.5,
|
||||
child: ResourceTab(
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
onFileUpload: (File file) {
|
||||
print("Received onFileUpload - nEW RESSOURCE");
|
||||
fileToSend = file;
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user