Update tarif to title (more char) + add image geopoint
This commit is contained in:
parent
c880d43a35
commit
e5a2d4f06a
@ -71,7 +71,10 @@ class _AudioInputContainerState extends State<AudioInputContainer> {
|
|||||||
"Sélectionner une ressource",
|
"Sélectionner une ressource",
|
||||||
1,
|
1,
|
||||||
[ResourceType.Audio],
|
[ResourceType.Audio],
|
||||||
context
|
context,
|
||||||
|
true, // IS SELECT
|
||||||
|
false, // IS ADD FALSE only for geopoint for now
|
||||||
|
true // IS REMOVE BUTTON
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -76,7 +76,10 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
|
|||||||
"Sélectionner une ressource",
|
"Sélectionner une ressource",
|
||||||
1,
|
1,
|
||||||
widget.inResourceTypes,
|
widget.inResourceTypes,
|
||||||
context
|
context,
|
||||||
|
true, // IS SELECT
|
||||||
|
false, // IS ADD FALSE only for geopoint for now
|
||||||
|
true // IS REMOVE BUTTON
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@ -92,7 +92,10 @@ class _GeoPointContentListState extends State<GeoPointContentList> {
|
|||||||
"Sélectionner une ressource",
|
"Sélectionner une ressource",
|
||||||
1,
|
1,
|
||||||
[ResourceType.Image, ResourceType.ImageUrl, ResourceType.Video, ResourceType.VideoUrl, ResourceType.Audio],
|
[ResourceType.Image, ResourceType.ImageUrl, ResourceType.Video, ResourceType.VideoUrl, ResourceType.Audio],
|
||||||
context
|
context,
|
||||||
|
true, // IS SELECT TRUE
|
||||||
|
true, // IS ADD - only for geopoint for now
|
||||||
|
false // IS REMOVE BUTTON
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@ -207,7 +207,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
isTitle: true
|
isTitle: false
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
|
|||||||
@ -24,55 +24,57 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
|||||||
return Container(
|
return Container(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: AlignmentDirectional.topCenter,
|
alignment: AlignmentDirectional.topCenter,
|
||||||
child: Column(
|
child: SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
if(managerAppContext.pinCode != null)
|
children: [
|
||||||
Padding(
|
if(managerAppContext.pinCode != null)
|
||||||
padding: const EdgeInsets.all(10.0),
|
Padding(
|
||||||
child: Align(
|
padding: const EdgeInsets.all(10.0),
|
||||||
alignment: AlignmentDirectional.centerStart,
|
child: Align(
|
||||||
child: AutoSizeText(
|
alignment: AlignmentDirectional.centerStart,
|
||||||
"Code pin: " + managerAppContext.pinCode.toString(),
|
child: AutoSizeText(
|
||||||
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w300),
|
"Code pin: " + managerAppContext.pinCode.toString(),
|
||||||
maxLines: 2,
|
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w300),
|
||||||
maxFontSize: 25.0,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
maxFontSize: 25.0,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
FutureBuilder(
|
||||||
FutureBuilder(
|
future: getDevices(appContext),
|
||||||
future: getDevices(appContext),
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
return GridView.builder(
|
||||||
return GridView.builder(
|
shrinkWrap: true,
|
||||||
shrinkWrap: true,
|
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
|
||||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
|
itemCount: snapshot.data.length,
|
||||||
itemCount: snapshot.data.length,
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
return Container(
|
||||||
return Container(
|
decoration: boxDecoration(),
|
||||||
decoration: boxDecoration(),
|
padding: const EdgeInsets.all(15),
|
||||||
padding: const EdgeInsets.all(15),
|
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||||
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment.center,
|
||||||
alignment: Alignment.center,
|
child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement()
|
||||||
child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement()
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
);
|
||||||
);
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
return Text("No data");
|
||||||
return Text("No data");
|
} else {
|
||||||
} else {
|
return Center(
|
||||||
return Center(
|
child: Container(
|
||||||
child: Container(
|
height: size.height * 0.2,
|
||||||
height: size.height * 0.2,
|
child: LoadingCommon()
|
||||||
child: LoadingCommon()
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class ResourcesScreen extends StatefulWidget {
|
|||||||
final Function? onGetResult; //return ResourceDTO
|
final Function? onGetResult; //return ResourceDTO
|
||||||
final bool isImage;
|
final bool isImage;
|
||||||
final bool isAddButton;
|
final bool isAddButton;
|
||||||
|
final bool isSelect;
|
||||||
|
final bool isRemoveButton;
|
||||||
final bool isFilter;
|
final bool isFilter;
|
||||||
final List<ResourceType> resourceTypes;
|
final List<ResourceType> resourceTypes;
|
||||||
const ResourcesScreen({
|
const ResourcesScreen({
|
||||||
@ -26,6 +28,8 @@ class ResourcesScreen extends StatefulWidget {
|
|||||||
this.isImage = false,
|
this.isImage = false,
|
||||||
this.onGetResult,
|
this.onGetResult,
|
||||||
this.isAddButton = true,
|
this.isAddButton = true,
|
||||||
|
this.isRemoveButton = false,
|
||||||
|
this.isSelect = false,
|
||||||
required this.resourceTypes,
|
required this.resourceTypes,
|
||||||
this.isFilter = true
|
this.isFilter = true
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@ -49,7 +53,7 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
|||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if(snapshot.data != null) {
|
if(snapshot.data != null) {
|
||||||
List<ResourceDTO> tempOutput = [];
|
List<ResourceDTO> tempOutput = [];
|
||||||
if(!widget.isAddButton) {
|
if(widget.isRemoveButton) {
|
||||||
tempOutput.add(ResourceDTO());
|
tempOutput.add(ResourceDTO());
|
||||||
tempOutput.addAll(new List<ResourceDTO>.from(snapshot.data));
|
tempOutput.addAll(new List<ResourceDTO>.from(snapshot.data));
|
||||||
} else {
|
} else {
|
||||||
@ -61,9 +65,8 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
|||||||
resourceTypesIn: widget.isImage ? resource_types.where((rt) => rt.type == ResourceType.Image || rt.type == ResourceType.ImageUrl).map((rt) => rt.type).toList() : widget.resourceTypes,
|
resourceTypesIn: widget.isImage ? resource_types.where((rt) => rt.type == ResourceType.Image || rt.type == ResourceType.ImageUrl).map((rt) => rt.type).toList() : widget.resourceTypes,
|
||||||
isAddButton: widget.isAddButton,
|
isAddButton: widget.isAddButton,
|
||||||
onSelect: (value) async {
|
onSelect: (value) async {
|
||||||
if (widget.onGetResult == null) {
|
if(widget.isSelect) {
|
||||||
// Main screen
|
if (value.id == null && widget.isAddButton) {
|
||||||
if (value.id == null) {
|
|
||||||
List<dynamic>? result = await showNewResource(appContext, context);
|
List<dynamic>? result = await showNewResource(appContext, context);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
@ -74,24 +77,42 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
|||||||
// For refresh
|
// For refresh
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var result = await showResource(value, appContext, context, size);
|
// Result for select modal
|
||||||
if(result != null) {
|
widget.onGetResult!(value);
|
||||||
// Update resource
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext() as ManagerAppContext;
|
|
||||||
try{
|
|
||||||
var resourceUpdated = managerAppContext.clientAPI!.resourceApi!.resourceUpdate(result);
|
|
||||||
setState(() {
|
|
||||||
// refresh ui
|
|
||||||
showNotification(kSuccess, kWhite, 'La ressource a été mise à jour avec succès', context, null);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
print("Error during updating resource");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Result for select modal
|
if (widget.onGetResult == null) {
|
||||||
widget.onGetResult!(value);
|
// Main screen
|
||||||
|
if (value.id == null) {
|
||||||
|
List<dynamic>? result = await showNewResource(appContext, context);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
await create(result[0], result[1], result[2], appContext, context);
|
||||||
|
Future.delayed(Duration(seconds: 2), () {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
// For refresh
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var result = await showResource(value, appContext, context, size);
|
||||||
|
if(result != null) {
|
||||||
|
// Update resource
|
||||||
|
ManagerAppContext managerAppContext = appContext.getContext() as ManagerAppContext;
|
||||||
|
try{
|
||||||
|
var resourceUpdated = managerAppContext.clientAPI!.resourceApi!.resourceUpdate(result);
|
||||||
|
setState(() {
|
||||||
|
// refresh ui
|
||||||
|
showNotification(kSuccess, kWhite, 'La ressource a été mise à jour avec succès', context, null);
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
print("Error during updating resource");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Result for select modal
|
||||||
|
widget.onGetResult!(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});//bodyGrid(tempOutput, size, appContext);
|
});//bodyGrid(tempOutput, size, appContext);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import 'package:manager_app/Screens/Resources/resources_screen.dart';
|
|||||||
import 'package:manager_app/constants.dart';
|
import 'package:manager_app/constants.dart';
|
||||||
import 'package:manager_api_new/api.dart';
|
import 'package:manager_api_new/api.dart';
|
||||||
|
|
||||||
dynamic showSelectResourceModal (String text, int maxLines, List<ResourceType> resourceTypes, BuildContext mainContext) async { /*Function onSelect,*/
|
dynamic showSelectResourceModal (String text, int maxLines, List<ResourceType> resourceTypes, BuildContext mainContext, bool isSelect, bool isAddButton, bool isRemoveButton) async { /*Function onSelect,*/
|
||||||
Size size = MediaQuery.of(mainContext).size;
|
Size size = MediaQuery.of(mainContext).size;
|
||||||
|
|
||||||
var result = await showDialog(
|
var result = await showDialog(
|
||||||
@ -21,7 +21,9 @@ dynamic showSelectResourceModal (String text, int maxLines, List<ResourceType> r
|
|||||||
width: size.width * 0.85,
|
width: size.width * 0.85,
|
||||||
height: size.height * 0.85,
|
height: size.height * 0.85,
|
||||||
child: ResourcesScreen(
|
child: ResourcesScreen(
|
||||||
isAddButton: false,
|
isAddButton: isAddButton,
|
||||||
|
isSelect: isSelect,
|
||||||
|
isRemoveButton: isRemoveButton,
|
||||||
onGetResult: (ResourceDTO? resource) {
|
onGetResult: (ResourceDTO? resource) {
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
var result = resource;
|
var result = resource;
|
||||||
|
|||||||
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 2.0.3+7
|
version: 2.0.4+8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.1.0 <4.0.0"
|
sdk: ">=3.1.0 <4.0.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user