Generation update + add checkInputContainer (IsTablet, IsOffline, IsMobile)
This commit is contained in:
parent
471190a153
commit
2b145f757c
81
lib/Components/check_input_container.dart
Normal file
81
lib/Components/check_input_container.dart
Normal file
@ -0,0 +1,81 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/color_picker.dart';
|
||||
|
||||
import '../constants.dart';
|
||||
|
||||
class CheckInputContainer extends StatefulWidget {
|
||||
final bool isChecked;
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final ValueChanged<bool> onChanged;
|
||||
const CheckInputContainer({
|
||||
Key key,
|
||||
this.isChecked,
|
||||
this.icon,
|
||||
this.label,
|
||||
this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CheckInputContainerState createState() => _CheckInputContainerState();
|
||||
}
|
||||
|
||||
class _CheckInputContainerState extends State<CheckInputContainer> {
|
||||
bool isChecked;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
setState(() {
|
||||
isChecked = widget.isChecked;
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Row(
|
||||
children: [
|
||||
if(widget.icon != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(
|
||||
widget.icon,
|
||||
color: kPrimaryColor,
|
||||
size: 25.0,
|
||||
),
|
||||
),
|
||||
if(widget.label != null)
|
||||
Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)),
|
||||
],
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: Checkbox(
|
||||
shape: CircleBorder(),
|
||||
value: isChecked,
|
||||
checkColor: Colors.white,
|
||||
activeColor: kPrimaryColor,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
isChecked = value;
|
||||
});
|
||||
widget.onChanged(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,9 @@ IconData getSectionIcon(elementType) {
|
||||
case SectionType.quizz:
|
||||
return Icons.question_answer;
|
||||
break;
|
||||
case SectionType.article:
|
||||
return Icons.article_outlined;
|
||||
break;
|
||||
}
|
||||
return Icons.menu;
|
||||
}
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import 'package:manager_app/Components/check_input_container.dart';
|
||||
import 'package:manager_app/Components/color_picker_input_container.dart';
|
||||
import 'package:manager_app/Components/confirmation_dialog.dart';
|
||||
import 'package:manager_app/Components/loading.dart';
|
||||
@ -178,6 +179,14 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
print(configurationDTO.languages);
|
||||
},
|
||||
),
|
||||
CheckInputContainer(
|
||||
icon: Icons.signal_wifi_off,
|
||||
label: "Hors ligne :",
|
||||
isChecked: configurationDTO.isOffline,
|
||||
onChanged: (value) {
|
||||
configurationDTO.isOffline = value;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
@ -198,6 +207,22 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
configurationDTO.secondaryColor = value;
|
||||
},
|
||||
),
|
||||
CheckInputContainer(
|
||||
icon: Icons.tablet,
|
||||
label: "Tablette :",
|
||||
isChecked: configurationDTO.isTablet,
|
||||
onChanged: (value) {
|
||||
configurationDTO.isTablet = value;
|
||||
},
|
||||
),
|
||||
CheckInputContainer(
|
||||
icon: Icons.phone_android,
|
||||
label: "MyVisit :",
|
||||
isChecked: configurationDTO.isMobile,
|
||||
onChanged: (value) {
|
||||
configurationDTO.isMobile = value;
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
@ -13,7 +13,7 @@ const kWhite = Color(0xFFFFFFFF);
|
||||
const kBlack = Color(0xFF000000);
|
||||
const kSuccess = Color(0xFF8bc34a);
|
||||
|
||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz"];
|
||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article"];
|
||||
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
|
||||
const List<String> languages = ["FR", "NL", "EN", "DE"];
|
||||
const List<String> resource_types = ["image", "image url", "video url"]; // "video",
|
||||
|
||||
@ -84,4 +84,3 @@ lib/model/user_detail_dto.dart
|
||||
lib/model/video_dto.dart
|
||||
lib/model/web_dto.dart
|
||||
pubspec.yaml
|
||||
test/article_dto_test.dart
|
||||
|
||||
@ -15,6 +15,7 @@ Name | Type | Description | Notes
|
||||
**languages** | **List<String>** | | [optional] [default to const []]
|
||||
**dateCreation** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**isMobile** | **bool** | | [optional]
|
||||
**isTablet** | **bool** | | [optional]
|
||||
**isOffline** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
@ -15,6 +15,7 @@ Name | Type | Description | Notes
|
||||
**languages** | **List<String>** | | [optional] [default to const []]
|
||||
**dateCreation** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**isMobile** | **bool** | | [optional]
|
||||
**isTablet** | **bool** | | [optional]
|
||||
**isOffline** | **bool** | | [optional]
|
||||
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
|
||||
**resources** | [**List<ResourceDTO>**](ResourceDTO.md) | | [optional] [default to const []]
|
||||
|
||||
@ -19,6 +19,7 @@ class ConfigurationDTO {
|
||||
this.languages,
|
||||
this.dateCreation,
|
||||
this.isMobile,
|
||||
this.isTablet,
|
||||
this.isOffline,
|
||||
});
|
||||
|
||||
@ -36,6 +37,8 @@ class ConfigurationDTO {
|
||||
|
||||
bool isMobile;
|
||||
|
||||
bool isTablet;
|
||||
|
||||
bool isOffline;
|
||||
|
||||
@override
|
||||
@ -47,6 +50,7 @@ class ConfigurationDTO {
|
||||
other.languages == languages &&
|
||||
other.dateCreation == dateCreation &&
|
||||
other.isMobile == isMobile &&
|
||||
other.isTablet == isTablet &&
|
||||
other.isOffline == isOffline;
|
||||
|
||||
@override
|
||||
@ -58,10 +62,11 @@ class ConfigurationDTO {
|
||||
(languages == null ? 0 : languages.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(isMobile == null ? 0 : isMobile.hashCode) +
|
||||
(isTablet == null ? 0 : isTablet.hashCode) +
|
||||
(isOffline == null ? 0 : isOffline.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isOffline=$isOffline]';
|
||||
String toString() => 'ConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -86,6 +91,9 @@ class ConfigurationDTO {
|
||||
if (isMobile != null) {
|
||||
json[r'isMobile'] = isMobile;
|
||||
}
|
||||
if (isTablet != null) {
|
||||
json[r'isTablet'] = isTablet;
|
||||
}
|
||||
if (isOffline != null) {
|
||||
json[r'isOffline'] = isOffline;
|
||||
}
|
||||
@ -108,6 +116,7 @@ class ConfigurationDTO {
|
||||
? null
|
||||
: DateTime.parse(json[r'dateCreation']),
|
||||
isMobile: json[r'isMobile'],
|
||||
isTablet: json[r'isTablet'],
|
||||
isOffline: json[r'isOffline'],
|
||||
);
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ class ExportConfigurationDTO {
|
||||
this.languages,
|
||||
this.dateCreation,
|
||||
this.isMobile,
|
||||
this.isTablet,
|
||||
this.isOffline,
|
||||
this.sections,
|
||||
this.resources,
|
||||
@ -38,6 +39,8 @@ class ExportConfigurationDTO {
|
||||
|
||||
bool isMobile;
|
||||
|
||||
bool isTablet;
|
||||
|
||||
bool isOffline;
|
||||
|
||||
List<SectionDTO> sections;
|
||||
@ -53,6 +56,7 @@ class ExportConfigurationDTO {
|
||||
other.languages == languages &&
|
||||
other.dateCreation == dateCreation &&
|
||||
other.isMobile == isMobile &&
|
||||
other.isTablet == isTablet &&
|
||||
other.isOffline == isOffline &&
|
||||
other.sections == sections &&
|
||||
other.resources == resources;
|
||||
@ -66,12 +70,13 @@ class ExportConfigurationDTO {
|
||||
(languages == null ? 0 : languages.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(isMobile == null ? 0 : isMobile.hashCode) +
|
||||
(isTablet == null ? 0 : isTablet.hashCode) +
|
||||
(isOffline == null ? 0 : isOffline.hashCode) +
|
||||
(sections == null ? 0 : sections.hashCode) +
|
||||
(resources == null ? 0 : resources.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isOffline=$isOffline, sections=$sections, resources=$resources]';
|
||||
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, sections=$sections, resources=$resources]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -96,6 +101,9 @@ class ExportConfigurationDTO {
|
||||
if (isMobile != null) {
|
||||
json[r'isMobile'] = isMobile;
|
||||
}
|
||||
if (isTablet != null) {
|
||||
json[r'isTablet'] = isTablet;
|
||||
}
|
||||
if (isOffline != null) {
|
||||
json[r'isOffline'] = isOffline;
|
||||
}
|
||||
@ -124,6 +132,7 @@ class ExportConfigurationDTO {
|
||||
? null
|
||||
: DateTime.parse(json[r'dateCreation']),
|
||||
isMobile: json[r'isMobile'],
|
||||
isTablet: json[r'isTablet'],
|
||||
isOffline: json[r'isOffline'],
|
||||
sections: SectionDTO.listFromJson(json[r'sections']),
|
||||
resources: ResourceDTO.listFromJson(json[r'resources']),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user