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",
|
||||
1,
|
||||
[ResourceType.Audio],
|
||||
context
|
||||
context,
|
||||
true, // IS SELECT
|
||||
false, // IS ADD FALSE only for geopoint for now
|
||||
true // IS REMOVE BUTTON
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
|
||||
@ -76,7 +76,10 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
|
||||
"Sélectionner une ressource",
|
||||
1,
|
||||
widget.inResourceTypes,
|
||||
context
|
||||
context,
|
||||
true, // IS SELECT
|
||||
false, // IS ADD FALSE only for geopoint for now
|
||||
true // IS REMOVE BUTTON
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
|
||||
@ -92,7 +92,10 @@ class _GeoPointContentListState extends State<GeoPointContentList> {
|
||||
"Sélectionner une ressource",
|
||||
1,
|
||||
[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) {
|
||||
setState(() {
|
||||
|
||||
@ -207,7 +207,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
isTitle: true
|
||||
isTitle: false
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
@ -24,55 +24,57 @@ class _DevicesScreenState extends State<DevicesScreen> {
|
||||
return Container(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.topCenter,
|
||||
child: Column(
|
||||
children: [
|
||||
if(managerAppContext.pinCode != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: AutoSizeText(
|
||||
"Code pin: " + managerAppContext.pinCode.toString(),
|
||||
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w300),
|
||||
maxLines: 2,
|
||||
maxFontSize: 25.0,
|
||||
textAlign: TextAlign.center,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
if(managerAppContext.pinCode != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: AutoSizeText(
|
||||
"Code pin: " + managerAppContext.pinCode.toString(),
|
||||
style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w300),
|
||||
maxLines: 2,
|
||||
maxFontSize: 25.0,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: getDevices(appContext),
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
|
||||
itemCount: snapshot.data.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
decoration: boxDecoration(),
|
||||
padding: const EdgeInsets.all(15),
|
||||
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement()
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||
return Text("No data");
|
||||
} else {
|
||||
return Center(
|
||||
child: Container(
|
||||
height: size.height * 0.2,
|
||||
child: LoadingCommon()
|
||||
)
|
||||
);
|
||||
FutureBuilder(
|
||||
future: getDevices(appContext),
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
|
||||
itemCount: snapshot.data.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
decoration: boxDecoration(),
|
||||
padding: const EdgeInsets.all(15),
|
||||
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: DeviceElement(deviceDTO: snapshot.data[index]), //getElement()
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||
return Text("No data");
|
||||
} else {
|
||||
return Center(
|
||||
child: Container(
|
||||
height: size.height * 0.2,
|
||||
child: LoadingCommon()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -19,6 +19,8 @@ class ResourcesScreen extends StatefulWidget {
|
||||
final Function? onGetResult; //return ResourceDTO
|
||||
final bool isImage;
|
||||
final bool isAddButton;
|
||||
final bool isSelect;
|
||||
final bool isRemoveButton;
|
||||
final bool isFilter;
|
||||
final List<ResourceType> resourceTypes;
|
||||
const ResourcesScreen({
|
||||
@ -26,6 +28,8 @@ class ResourcesScreen extends StatefulWidget {
|
||||
this.isImage = false,
|
||||
this.onGetResult,
|
||||
this.isAddButton = true,
|
||||
this.isRemoveButton = false,
|
||||
this.isSelect = false,
|
||||
required this.resourceTypes,
|
||||
this.isFilter = true
|
||||
}) : super(key: key);
|
||||
@ -49,7 +53,7 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if(snapshot.data != null) {
|
||||
List<ResourceDTO> tempOutput = [];
|
||||
if(!widget.isAddButton) {
|
||||
if(widget.isRemoveButton) {
|
||||
tempOutput.add(ResourceDTO());
|
||||
tempOutput.addAll(new List<ResourceDTO>.from(snapshot.data));
|
||||
} 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,
|
||||
isAddButton: widget.isAddButton,
|
||||
onSelect: (value) async {
|
||||
if (widget.onGetResult == null) {
|
||||
// Main screen
|
||||
if (value.id == null) {
|
||||
if(widget.isSelect) {
|
||||
if (value.id == null && widget.isAddButton) {
|
||||
List<dynamic>? result = await showNewResource(appContext, context);
|
||||
if (result != null)
|
||||
{
|
||||
@ -74,24 +77,42 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
// Result for select modal
|
||||
widget.onGetResult!(value);
|
||||
}
|
||||
} else {
|
||||
// Result for select modal
|
||||
widget.onGetResult!(value);
|
||||
if (widget.onGetResult == null) {
|
||||
// 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);
|
||||
} else {
|
||||
|
||||
@ -5,7 +5,7 @@ import 'package:manager_app/Screens/Resources/resources_screen.dart';
|
||||
import 'package:manager_app/constants.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;
|
||||
|
||||
var result = await showDialog(
|
||||
@ -21,7 +21,9 @@ dynamic showSelectResourceModal (String text, int maxLines, List<ResourceType> r
|
||||
width: size.width * 0.85,
|
||||
height: size.height * 0.85,
|
||||
child: ResourcesScreen(
|
||||
isAddButton: false,
|
||||
isAddButton: isAddButton,
|
||||
isSelect: isSelect,
|
||||
isRemoveButton: isRemoveButton,
|
||||
onGetResult: (ResourceDTO? resource) {
|
||||
if (resource != null) {
|
||||
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.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 2.0.3+7
|
||||
version: 2.0.4+8
|
||||
|
||||
environment:
|
||||
sdk: ">=3.1.0 <4.0.0"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user