Remove add resource for dispose + fixed sized windows + get result as function modal + fix bugs
This commit is contained in:
parent
fe6fe9edc5
commit
b4a4d21c56
@ -46,12 +46,12 @@ class _GeoPointImageListState extends State<GeoPointImageList> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
Size size = MediaQuery.of(context).size;
|
//Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0, top: 15.0),
|
padding: const EdgeInsets.only(left: 15.0, right: 15.0, bottom: 15.0, top: 15.0),
|
||||||
child: ReorderableListView(
|
child: ReorderableListView(
|
||||||
onReorder: _onReorder,
|
onReorder: _onReorder,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
@ -88,19 +88,23 @@ class _GeoPointImageListState extends State<GeoPointImageList> {
|
|||||||
bottom: 10,
|
bottom: 10,
|
||||||
right: 10,
|
right: 10,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
showSelectResourceModal(
|
var result = await showSelectResourceModal(
|
||||||
"Sélectionner une ressource",
|
"Sélectionner une ressource",
|
||||||
(ResourceDTO resource) {
|
|
||||||
setState(() {
|
|
||||||
ImageGeoPoint newImage = new ImageGeoPoint( imageResourceId: resource.id, imageSource: resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id);
|
|
||||||
imagesGeo.add(newImage);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
1,
|
1,
|
||||||
true,
|
true,
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
if (result != null) {
|
||||||
|
setState(() {
|
||||||
|
ImageGeoPoint newImage = new ImageGeoPoint(imageResourceId: result.id, imageSource: result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id);
|
||||||
|
print("REULT IMAGES = ");
|
||||||
|
print(newImage);
|
||||||
|
imagesGeo.add(newImage);
|
||||||
|
print(imagesGeo);
|
||||||
|
widget.onChanged(imagesGeo);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.width * 0.04,
|
height: MediaQuery.of(context).size.width * 0.04,
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import 'package:manager_app/Components/fetch_section_icon.dart';
|
|||||||
import 'package:manager_app/Components/image_input_container.dart';
|
import 'package:manager_app/Components/image_input_container.dart';
|
||||||
import 'package:manager_app/Components/multi_select_container.dart';
|
import 'package:manager_app/Components/multi_select_container.dart';
|
||||||
import 'package:manager_app/Components/slider_input_container.dart';
|
import 'package:manager_app/Components/slider_input_container.dart';
|
||||||
import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaFraise/manager-app/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart';
|
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:managerapi/api.dart';
|
||||||
@ -71,6 +71,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
mapDTO.iconResourceId = resource.id;
|
mapDTO.iconResourceId = resource.id;
|
||||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||||
},
|
},
|
||||||
|
isSmall: true
|
||||||
),
|
),
|
||||||
// Map Type
|
// Map Type
|
||||||
MultiSelectContainer(
|
MultiSelectContainer(
|
||||||
|
|||||||
@ -133,8 +133,10 @@ void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, A
|
|||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
textColor: kWhite,
|
textColor: kWhite,
|
||||||
press: () {
|
press: () {
|
||||||
getResult(geoPointDTO);
|
if (geoPointDTO.latitude != null && geoPointDTO.longitude != null) {
|
||||||
Navigator.of(context).pop();
|
getResult(geoPointDTO);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -71,18 +71,19 @@ class _ListViewCard extends State<ListViewCardImage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
showNewOrUpdateImageSlider(
|
var result = await showNewOrUpdateImageSlider(
|
||||||
widget.listItems[widget.index],
|
widget.listItems[widget.index],
|
||||||
(value) {
|
|
||||||
setState(() {
|
|
||||||
widget.listItems[widget.index] = value;
|
|
||||||
widget.onChanged(widget.listItems);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
widget.appContext,
|
widget.appContext,
|
||||||
context
|
context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
setState(() {
|
||||||
|
widget.listItems[widget.index] = result;
|
||||||
|
widget.onChanged(widget.listItems);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -122,7 +123,7 @@ boxDecoration(ImageDTO imageDTO, appContext) {
|
|||||||
shape: BoxShape.rectangle,
|
shape: BoxShape.rectangle,
|
||||||
border: Border.all(width: 1.5, color: kSecond),
|
border: Border.all(width: 1.5, color: kSecond),
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
image: imageDTO.title != null ? new DecorationImage(
|
image: imageDTO.title != null && imageDTO.source_ != null ? new DecorationImage(
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
image: new NetworkImage(
|
image: new NetworkImage(
|
||||||
imageDTO.source_,
|
imageDTO.source_,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import 'package:manager_app/app_context.dart';
|
|||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:managerapi/api.dart';
|
||||||
|
|
||||||
void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppContext appContext, BuildContext context) {
|
Future<ImageDTO> showNewOrUpdateImageSlider(ImageDTO inputImageDTO, AppContext appContext, BuildContext context) async {
|
||||||
ImageDTO imageDTO = new ImageDTO();
|
ImageDTO imageDTO = new ImageDTO();
|
||||||
|
|
||||||
if (inputImageDTO != null) {
|
if (inputImageDTO != null) {
|
||||||
@ -28,7 +28,7 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC
|
|||||||
}
|
}
|
||||||
|
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
showDialog(
|
var result = await showDialog(
|
||||||
builder: (BuildContext dialogContext) => AlertDialog(
|
builder: (BuildContext dialogContext) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||||
@ -49,8 +49,9 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC
|
|||||||
initialValue: imageDTO.resourceId,
|
initialValue: imageDTO.resourceId,
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
onChanged: (ResourceDTO resource) {
|
onChanged: (ResourceDTO resource) {
|
||||||
imageDTO.source_ = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
|
var result = resource;
|
||||||
imageDTO.resourceId = resource.id;
|
imageDTO.source_ = result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id;
|
||||||
|
imageDTO.resourceId = result.id;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -82,7 +83,7 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC
|
|||||||
icon: Icons.undo,
|
icon: Icons.undo,
|
||||||
color: kSecond,
|
color: kSecond,
|
||||||
press: () {
|
press: () {
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.pop(dialogContext);
|
||||||
},
|
},
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
),
|
),
|
||||||
@ -100,8 +101,7 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC
|
|||||||
textColor: kWhite,
|
textColor: kWhite,
|
||||||
press: () {
|
press: () {
|
||||||
if (imageDTO.resourceId != null) {
|
if (imageDTO.resourceId != null) {
|
||||||
getResult(imageDTO);
|
Navigator.pop(dialogContext, imageDTO);
|
||||||
Navigator.of(dialogContext).pop();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
@ -113,6 +113,8 @@ void showNewOrUpdateImageSlider(ImageDTO inputImageDTO, Function getResult, AppC
|
|||||||
],
|
],
|
||||||
), context: context
|
), context: context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTranslations(BuildContext context, AppContext appContext, ImageDTO imageDTO) {
|
getTranslations(BuildContext context, AppContext appContext, ImageDTO imageDTO) {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class _SliderConfigState extends State<SliderConfig> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
Size size = MediaQuery.of(context).size;
|
//Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
void _onReorder(int oldIndex, int newIndex) {
|
void _onReorder(int oldIndex, int newIndex) {
|
||||||
setState(
|
setState(
|
||||||
@ -97,23 +97,16 @@ class _SliderConfigState extends State<SliderConfig> {
|
|||||||
bottom: 0,
|
bottom: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
showNewOrUpdateImageSlider(
|
var result = await showNewOrUpdateImageSlider(null, appContext, context);
|
||||||
null,
|
if (result != null)
|
||||||
(ImageDTO image) {
|
{
|
||||||
print("get result bébé showNewOrUpdateImageSlider");
|
setState(() {
|
||||||
if (this.mounted) {
|
result.order = sliderDTO.images.length;
|
||||||
setState(() {
|
sliderDTO.images.add(result);
|
||||||
image.order = sliderDTO.images.length;
|
widget.onChanged(jsonEncode(sliderDTO).toString());
|
||||||
sliderDTO.images.add(image);
|
});
|
||||||
widget.onChanged(jsonEncode(sliderDTO).toString());
|
}
|
||||||
});
|
|
||||||
} else {
|
|
||||||
print("DISPOSE MEEEEERDE");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
appContext,
|
|
||||||
context);
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.width * 0.04,
|
height: MediaQuery.of(context).size.width * 0.04,
|
||||||
|
|||||||
@ -40,7 +40,18 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
future: getSection(widget.id, appContext.getContext().clientAPI),
|
future: getSection(widget.id, appContext.getContext().clientAPI),
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
return bodySection(snapshot.data, size, appContext, context);
|
return Stack(
|
||||||
|
children: [
|
||||||
|
bodySection(snapshot.data, size, appContext, context),
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.bottomCenter,
|
||||||
|
child: Container(
|
||||||
|
height: 80,
|
||||||
|
child: getButtons(sectionDTO, appContext),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
return Text("No data");
|
return Text("No data");
|
||||||
} else {
|
} else {
|
||||||
@ -57,10 +68,10 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
|
|
||||||
Widget bodySection(SectionDTO sectionDTO, Size size, AppContext appContext, BuildContext context) {
|
Widget bodySection(SectionDTO sectionDTO, Size size, AppContext appContext, BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: size.height *0.13,
|
//height: size.height *0.13,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -117,9 +128,6 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
),
|
),
|
||||||
), // TITLE
|
), // TITLE
|
||||||
Container(
|
Container(
|
||||||
/*height: size.height*0.4,
|
|
||||||
color: Colors.lightBlue,*/
|
|
||||||
//height: size.height *0.1,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -142,24 +150,8 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
sectionDTO.label = value;
|
sectionDTO.label = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ImageInputContainer(
|
|
||||||
label: "Image :",
|
|
||||||
initialValue: sectionDTO != null ? sectionDTO.imageId : "",
|
|
||||||
color: kPrimaryColor,
|
|
||||||
onChanged: (ResourceDTO resource) {
|
|
||||||
print("received value in grant older");
|
|
||||||
sectionDTO.imageId = resource.id;
|
|
||||||
sectionDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
MultiStringContainer(
|
MultiStringContainer(
|
||||||
label: "Titre :",
|
label: "Titre affiché:",
|
||||||
modalLabel: "Titre",
|
modalLabel: "Titre",
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
initialValue: sectionDTO != null ? sectionDTO.title : [],
|
initialValue: sectionDTO != null ? sectionDTO.title : [],
|
||||||
@ -172,7 +164,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
MultiStringContainer(
|
MultiStringContainer(
|
||||||
label: "Description :",
|
label: "Description affichée:",
|
||||||
modalLabel: "Description",
|
modalLabel: "Description",
|
||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
initialValue: sectionDTO != null ? sectionDTO.description : [],
|
initialValue: sectionDTO != null ? sectionDTO.description : [],
|
||||||
@ -183,6 +175,22 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ImageInputContainer(
|
||||||
|
label: "Image :",
|
||||||
|
initialValue: sectionDTO != null ? sectionDTO.imageId : "",
|
||||||
|
color: kPrimaryColor,
|
||||||
|
onChanged: (ResourceDTO resource) {
|
||||||
|
print("received value in grant older");
|
||||||
|
sectionDTO.imageId = resource.id;
|
||||||
|
sectionDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -195,8 +203,8 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
),
|
),
|
||||||
),// FIELDS SECTION
|
),// FIELDS SECTION
|
||||||
Container(
|
Container(
|
||||||
height: size.height * 0.305,
|
//height: size.height * 0.305,
|
||||||
width: size.width * 0.8,
|
//width: size.width * 0.8,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null,
|
child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null,
|
||||||
@ -206,7 +214,9 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
border: Border.all(width: 1.5, color: kSecond)
|
border: Border.all(width: 1.5, color: kSecond)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
getButtons(sectionDTO, appContext),
|
SizedBox(
|
||||||
|
height: size.height*0.1,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -285,15 +295,18 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
Future<void> save(bool isTraduction, SectionDTO sectionDTO, AppContext appContext) async {
|
Future<void> save(bool isTraduction, SectionDTO sectionDTO, AppContext appContext) async {
|
||||||
print("SAVE");
|
print("SAVE");
|
||||||
print(sectionDTO);
|
print(sectionDTO);
|
||||||
SectionDTO section = await appContext.getContext().clientAPI.sectionApi.sectionUpdate(sectionDTO);
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
|
||||||
managerAppContext.selectedSection = section;
|
|
||||||
appContext.setContext(managerAppContext);
|
|
||||||
|
|
||||||
if (isTraduction) {
|
if (sectionDTO != null) {
|
||||||
showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context);
|
SectionDTO section = await appContext.getContext().clientAPI.sectionApi.sectionUpdate(sectionDTO);
|
||||||
} else {
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context);
|
managerAppContext.selectedSection = section;
|
||||||
|
appContext.setContext(managerAppContext);
|
||||||
|
|
||||||
|
if (isTraduction) {
|
||||||
|
showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context);
|
||||||
|
} else {
|
||||||
|
showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,17 +316,15 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
return MapConfig(
|
return MapConfig(
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
print("Received info in parent");
|
|
||||||
print(data);
|
print(data);
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
|
save(false, sectionDTO, appContext);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.slider:
|
case SectionType.slider:
|
||||||
return SliderConfig(
|
return SliderConfig(
|
||||||
initialValue: sectionDTO.data,
|
initialValue: sectionDTO.data,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
print("Received info in parent");
|
|
||||||
print(data);
|
|
||||||
sectionDTO.data = data;
|
sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/loading.dart';
|
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/string_input_container.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
@ -7,10 +6,10 @@ import 'package:managerapi/api.dart';
|
|||||||
|
|
||||||
import 'dropDown_configuration.dart';
|
import 'dropDown_configuration.dart';
|
||||||
|
|
||||||
showChangeInfo (String text, DeviceDTO inputDevice, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) {
|
showChangeInfo (String text, DeviceDTO inputDevice, Function onGetResult, int maxLines, BuildContext mainContext, dynamic appContext) async {
|
||||||
Size size = MediaQuery.of(mainContext).size;
|
Size size = MediaQuery.of(mainContext).size;
|
||||||
|
|
||||||
showDialog(
|
var result = await showDialog(
|
||||||
builder: (BuildContext context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||||
|
|||||||
@ -1,24 +1,21 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:manager_app/Components/message_notification.dart';
|
||||||
import 'package:manager_app/Components/resource_tab.dart';
|
import 'package:manager_app/Components/resource_tab.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/message_notification.dart';
|
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/string_input_container.dart';
|
||||||
import 'package:manager_app/Models/managerContext.dart';
|
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:managerapi/api.dart';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
dynamic showNewResource(AppContext appContext, BuildContext context) async {
|
||||||
|
|
||||||
void showNewResource(AppContext appContext, BuildContext context) {
|
|
||||||
ResourceDetailDTO resourceDetailDTO = new ResourceDetailDTO();
|
ResourceDetailDTO resourceDetailDTO = new ResourceDetailDTO();
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
var fileName;
|
var fileName;
|
||||||
File fileToSend;
|
File fileToSend;
|
||||||
|
|
||||||
showDialog(
|
var result = await showDialog(
|
||||||
builder: (BuildContext context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||||
@ -86,7 +83,17 @@ void showNewResource(AppContext appContext, BuildContext context) {
|
|||||||
color: kPrimaryColor,
|
color: kPrimaryColor,
|
||||||
textColor: kWhite,
|
textColor: kWhite,
|
||||||
press: () {
|
press: () {
|
||||||
create(resourceDetailDTO, fileToSend, appContext, context);
|
if (resourceDetailDTO.label != null) {
|
||||||
|
if (fileToSend != null) {
|
||||||
|
Navigator.pop(context, [resourceDetailDTO, fileToSend]);
|
||||||
|
} else {
|
||||||
|
showNotification(Colors.orange, kWhite, 'Aucun fichier n\'a été chargé', context);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showNotification(Colors.orange, kWhite, 'Veuillez donner un nom à la ressource', context);
|
||||||
|
}
|
||||||
|
//Navigator.of(context).pop();
|
||||||
|
//create(resourceDetailDTO, fileToSend, appContext, context);
|
||||||
},
|
},
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
),
|
),
|
||||||
@ -97,71 +104,6 @@ void showNewResource(AppContext appContext, BuildContext context) {
|
|||||||
],
|
],
|
||||||
), context: context
|
), context: context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void create(ResourceDetailDTO resourceDetailDTO, File file, AppContext appContext, context) async {
|
|
||||||
if (resourceDetailDTO.label != null) {
|
|
||||||
switch(resourceDetailDTO.type) {
|
|
||||||
case ResourceType.image:
|
|
||||||
case ResourceType.video:
|
|
||||||
if (file != null) {
|
|
||||||
var request = http.MultipartRequest('POST', Uri.parse(appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/upload"));
|
|
||||||
request.files.add(
|
|
||||||
await http.MultipartFile(
|
|
||||||
'picture',
|
|
||||||
file.readAsBytes().asStream(),
|
|
||||||
file.lengthSync(),
|
|
||||||
filename: file.path.toString().split("/").last
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
|
||||||
request.headers["authorization"]="Bearer ${managerAppContext.token.accessToken}";
|
|
||||||
request.fields['label'] = resourceDetailDTO.label;
|
|
||||||
request.fields['type'] = ResourceType.image.toString();
|
|
||||||
|
|
||||||
var res = await request.send();
|
|
||||||
|
|
||||||
if (res.statusCode == 200) {
|
|
||||||
// To refresh only (UGLY COOOOODE)
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
|
||||||
appContext.setContext(managerAppContext);
|
|
||||||
|
|
||||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
|
||||||
} else {
|
|
||||||
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de la création de la ressource', context);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showNotification(Colors.orange, kWhite, 'Aucun fichier n\'a été chargé', context);
|
|
||||||
}
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
break;
|
|
||||||
case ResourceType.imageUrl:
|
|
||||||
case ResourceType.videoUrl:
|
|
||||||
if (resourceDetailDTO.data != null) {
|
|
||||||
// test if Correct url
|
|
||||||
bool _validURL = Uri.parse(resourceDetailDTO.data).isAbsolute;
|
|
||||||
if(_validURL) {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
ResourceDetailDTO newResource = await appContext.getContext().clientAPI.resourceApi.resourceCreate(resourceDetailDTO);
|
|
||||||
|
|
||||||
// To refresh only (UGLY COOOOODE)
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
|
||||||
appContext.setContext(managerAppContext);
|
|
||||||
|
|
||||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
|
||||||
} else {
|
|
||||||
showNotification(Colors.orange, kWhite, 'L\'url est invalide', context);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showNotification(Colors.orange, kWhite, 'Veuillez remplir le champ URL', context);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showNotification(Colors.orange, kWhite, 'Veuillez donner un nom à la ressource', context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -12,11 +12,13 @@ class ResourceBodyGrid extends StatefulWidget {
|
|||||||
final List<ResourceDTO> resources; //return ResourceDTO
|
final List<ResourceDTO> resources; //return ResourceDTO
|
||||||
final Function onSelect;
|
final Function onSelect;
|
||||||
final bool isImage;
|
final bool isImage;
|
||||||
|
final bool isAddButton;
|
||||||
const ResourceBodyGrid({
|
const ResourceBodyGrid({
|
||||||
Key key,
|
Key key,
|
||||||
this.resources,
|
this.resources,
|
||||||
this.onSelect,
|
this.onSelect,
|
||||||
this.isImage,
|
this.isImage,
|
||||||
|
this.isAddButton,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -78,35 +80,39 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
if (widget.isAddButton)
|
||||||
onTap: () {
|
InkWell(
|
||||||
widget.onSelect(ResourceDTO(id: null));
|
onTap: () {
|
||||||
},
|
widget.onSelect(ResourceDTO(id: null));
|
||||||
child: Container(
|
},
|
||||||
height: size.height *0.08,
|
child: Padding(
|
||||||
width: size.height *0.08,
|
padding: const EdgeInsets.all(8.0),
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: Colors.lightGreen,
|
height: size.height *0.08,
|
||||||
shape: BoxShape.rectangle,
|
width: size.height *0.08,
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
decoration: BoxDecoration(
|
||||||
boxShadow: [
|
color: Colors.lightGreen,
|
||||||
BoxShadow(
|
shape: BoxShape.rectangle,
|
||||||
color: kSecond,
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
spreadRadius: 0.5,
|
boxShadow: [
|
||||||
blurRadius: 5,
|
BoxShadow(
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
color: kSecond,
|
||||||
|
spreadRadius: 0.5,
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: Offset(0, 1.5), // changes position of shadow
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
child:
|
||||||
),
|
Padding(
|
||||||
child:
|
padding: const EdgeInsets.all(10.0),
|
||||||
Padding(
|
child: LayoutBuilder(builder: (context, constraint) {
|
||||||
padding: const EdgeInsets.all(10.0),
|
return new Icon(Icons.add, size: constraint.biggest.height, color: kTextLightColor);
|
||||||
child: LayoutBuilder(builder: (context, constraint) {
|
}),
|
||||||
return new Icon(Icons.add, size: constraint.biggest.height, color: kTextLightColor);
|
),
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_app/Components/fetch_resource_icon.dart';
|
|
||||||
import 'package:manager_app/Components/loading.dart';
|
import 'package:manager_app/Components/loading.dart';
|
||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/message_notification.dart';
|
||||||
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Resources/new_resource_popup.dart';
|
import 'package:manager_app/Screens/Resources/new_resource_popup.dart';
|
||||||
import 'package:manager_app/Screens/Resources/resource_body_grid.dart';
|
import 'package:manager_app/Screens/Resources/resource_body_grid.dart';
|
||||||
import 'package:manager_app/Screens/Resources/show_resource_popup.dart';
|
import 'package:manager_app/Screens/Resources/show_resource_popup.dart';
|
||||||
@ -10,14 +12,17 @@ import 'package:manager_app/app_context.dart';
|
|||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:managerapi/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class ResourcesScreen extends StatefulWidget {
|
class ResourcesScreen extends StatefulWidget {
|
||||||
final Function onGetResult; //return ResourceDTO
|
final Function onGetResult; //return ResourceDTO
|
||||||
final bool isImage;
|
final bool isImage;
|
||||||
|
final bool isAddButton;
|
||||||
const ResourcesScreen({
|
const ResourcesScreen({
|
||||||
Key key,
|
Key key,
|
||||||
this.isImage = false,
|
this.isImage = false,
|
||||||
this.onGetResult,
|
this.onGetResult,
|
||||||
|
this.isAddButton = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -26,6 +31,7 @@ class ResourcesScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ResourcesScreenState extends State<ResourcesScreen> {
|
class _ResourcesScreenState extends State<ResourcesScreen> {
|
||||||
String filter;
|
String filter;
|
||||||
|
bool isLoading;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -38,21 +44,22 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
|
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
|
||||||
// tempOutput.add(ResourceDTO(id: null));
|
// tempOutput.add(ResourceDTO(id: null));
|
||||||
return ResourceBodyGrid(resources: tempOutput, isImage: widget.isImage, onSelect: (value) {
|
return ResourceBodyGrid(resources: tempOutput, isImage: widget.isImage, isAddButton: widget.isAddButton, onSelect: (value) async {
|
||||||
if (widget.onGetResult == null) {
|
if (widget.onGetResult == null) {
|
||||||
// Main screen
|
// Main screen
|
||||||
if (value.id == null) {
|
if (value.id == null) {
|
||||||
showNewResource(appContext, context);
|
var result = await showNewResource(appContext, context);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
var newResource = await create(result[0], result[1], appContext, context);
|
||||||
|
setState(() {}); // For refresh
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showResource(value, appContext, context, size);
|
showResource(value, appContext, context, size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (value.id == null) {
|
|
||||||
showNewResource(appContext, context);
|
|
||||||
} else {
|
|
||||||
// Result for select modal
|
// Result for select modal
|
||||||
widget.onGetResult(value);
|
widget.onGetResult(value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},);//bodyGrid(tempOutput, size, appContext);
|
},);//bodyGrid(tempOutput, size, appContext);
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
@ -77,3 +84,61 @@ Future<List<ResourceDTO>> getResources(Function onGetResult, bool isImage, dynam
|
|||||||
}
|
}
|
||||||
return resources;
|
return resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<ResourceDTO> create(ResourceDetailDTO resourceDetailDTO, File file, AppContext appContext, context) async {
|
||||||
|
switch(resourceDetailDTO.type) {
|
||||||
|
case ResourceType.image:
|
||||||
|
case ResourceType.video:
|
||||||
|
var request = http.MultipartRequest('POST', Uri.parse(appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/upload"));
|
||||||
|
request.files.add(
|
||||||
|
await http.MultipartFile(
|
||||||
|
'picture',
|
||||||
|
file.readAsBytes().asStream(),
|
||||||
|
file.lengthSync(),
|
||||||
|
filename: file.path.toString().split("/").last
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
|
request.headers["authorization"]="Bearer ${managerAppContext.token.accessToken}";
|
||||||
|
request.fields['label'] = resourceDetailDTO.label;
|
||||||
|
request.fields['type'] = ResourceType.image.toString();
|
||||||
|
|
||||||
|
var res = await request.send();
|
||||||
|
final respStr = await res.stream.bytesToString();
|
||||||
|
|
||||||
|
if (res.statusCode == 200) {
|
||||||
|
var result = ResourceDTO.fromJson(jsonDecode(respStr));
|
||||||
|
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de la création de la ressource', context);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ResourceType.imageUrl:
|
||||||
|
case ResourceType.videoUrl:
|
||||||
|
if (resourceDetailDTO.data != null) {
|
||||||
|
// test if Correct url
|
||||||
|
bool _validURL = Uri.parse(resourceDetailDTO.data).isAbsolute;
|
||||||
|
if(_validURL) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
|
ResourceDTO newResource = await appContext.getContext().clientAPI.resourceApi.resourceCreate(resourceDetailDTO);
|
||||||
|
|
||||||
|
// To refresh only (UGLY COOOOODE)
|
||||||
|
/*ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
|
appContext.setContext(managerAppContext);*/
|
||||||
|
|
||||||
|
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
||||||
|
|
||||||
|
return newResource;
|
||||||
|
} else {
|
||||||
|
showNotification(Colors.orange, kWhite, 'L\'url est invalide', context);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showNotification(Colors.orange, kWhite, 'Veuillez remplir le champ URL', context);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,10 +5,10 @@ import 'package:manager_app/Screens/Resources/resources_screen.dart';
|
|||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:managerapi/api.dart';
|
import 'package:managerapi/api.dart';
|
||||||
|
|
||||||
showSelectResourceModal (String text, Function onGetResult, int maxLines, bool onlyImage, BuildContext mainContext) { /*Function onSelect,*/
|
dynamic showSelectResourceModal (String text, int maxLines, bool onlyImage, BuildContext mainContext) async { /*Function onSelect,*/
|
||||||
Size size = MediaQuery.of(mainContext).size;
|
Size size = MediaQuery.of(mainContext).size;
|
||||||
|
|
||||||
showDialog(
|
var result = await showDialog(
|
||||||
builder: (BuildContext context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||||
@ -21,10 +21,13 @@ showSelectResourceModal (String text, Function onGetResult, int maxLines, bool o
|
|||||||
width: size.width * 0.7,
|
width: size.width * 0.7,
|
||||||
height: size.height * 0.75,
|
height: size.height * 0.75,
|
||||||
child: ResourcesScreen(
|
child: ResourcesScreen(
|
||||||
|
isAddButton: false,
|
||||||
onGetResult: (ResourceDTO resource) {
|
onGetResult: (ResourceDTO resource) {
|
||||||
|
print("SELECT RESOURCE");
|
||||||
|
print(resource);
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
onGetResult(resource);
|
var result = resource;
|
||||||
Navigator.of(mainContext).pop();
|
Navigator.pop(context, result);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isImage: onlyImage,
|
isImage: onlyImage,
|
||||||
@ -55,6 +58,7 @@ showSelectResourceModal (String text, Function onGetResult, int maxLines, bool o
|
|||||||
],
|
],
|
||||||
), context: mainContext
|
), context: mainContext
|
||||||
);
|
);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
showValues(List<TranslationDTO> newValues) {
|
showValues(List<TranslationDTO> newValues) {
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Main/main_screen.dart';
|
import 'package:manager_app/Screens/Main/main_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -5,10 +7,18 @@ import 'package:provider/provider.dart';
|
|||||||
import 'Screens/login_screen.dart';
|
import 'Screens/login_screen.dart';
|
||||||
import 'app_context.dart';
|
import 'app_context.dart';
|
||||||
import 'constants.dart';
|
import 'constants.dart';
|
||||||
|
import 'package:window_size/window_size.dart';
|
||||||
|
|
||||||
void main() {
|
Future<void> main() async {
|
||||||
String initialRoute;
|
String initialRoute;
|
||||||
|
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
if (Platform.isWindows) {
|
||||||
|
setWindowTitle("My Desktop App");
|
||||||
|
setWindowMinSize(Size(1100, 900));
|
||||||
|
setWindowMaxSize(Size(3840, 2160));
|
||||||
|
}
|
||||||
|
|
||||||
initialRoute = '/welcome';
|
initialRoute = '/welcome';
|
||||||
|
|
||||||
final MyApp myApp = MyApp(
|
final MyApp myApp = MyApp(
|
||||||
|
|||||||
@ -7,9 +7,13 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <dart_vlc/dart_vlc_plugin.h>
|
#include <dart_vlc/dart_vlc_plugin.h>
|
||||||
|
#include <window_size/window_size_plugin.h>
|
||||||
|
|
||||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||||
g_autoptr(FlPluginRegistrar) dart_vlc_registrar =
|
g_autoptr(FlPluginRegistrar) dart_vlc_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DartVlcPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DartVlcPlugin");
|
||||||
dart_vlc_plugin_register_with_registrar(dart_vlc_registrar);
|
dart_vlc_plugin_register_with_registrar(dart_vlc_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) window_size_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowSizePlugin");
|
||||||
|
window_size_plugin_register_with_registrar(window_size_registrar);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dart_vlc
|
dart_vlc
|
||||||
|
window_size
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|||||||
@ -8,7 +8,9 @@ import FlutterMacOS
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import path_provider_macos
|
import path_provider_macos
|
||||||
|
import window_size
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin"))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -385,6 +385,15 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.5"
|
version: "2.0.5"
|
||||||
|
window_size:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "plugins/window_size"
|
||||||
|
ref: "927f8cbc09b35d85245c095f2db8df9b186f6618"
|
||||||
|
resolved-ref: "927f8cbc09b35d85245c095f2db8df9b186f6618"
|
||||||
|
url: "git://github.com/google/flutter-desktop-embedding.git"
|
||||||
|
source: git
|
||||||
|
version: "0.1.0"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -37,6 +37,11 @@ dependencies:
|
|||||||
dart_vlc: ^0.0.6
|
dart_vlc: ^0.0.6
|
||||||
video_player: ^2.1.1
|
video_player: ^2.1.1
|
||||||
drag_and_drop_lists: ^0.3.2
|
drag_and_drop_lists: ^0.3.2
|
||||||
|
window_size:
|
||||||
|
git:
|
||||||
|
url: git://github.com/google/flutter-desktop-embedding.git
|
||||||
|
path: plugins/window_size
|
||||||
|
ref: 927f8cbc09b35d85245c095f2db8df9b186f6618
|
||||||
managerapi:
|
managerapi:
|
||||||
path: manager_api
|
path: manager_api
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,11 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <dart_vlc/dart_vlc_plugin.h>
|
#include <dart_vlc/dart_vlc_plugin.h>
|
||||||
|
#include <window_size/window_size_plugin.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
DartVlcPluginRegisterWithRegistrar(
|
DartVlcPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("DartVlcPlugin"));
|
registry->GetRegistrarForPlugin("DartVlcPlugin"));
|
||||||
|
WindowSizePluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("WindowSizePlugin"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dart_vlc
|
dart_vlc
|
||||||
|
window_size
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user