String dbValueToString(dynamic value, DataType dataType) {
String rc;
- if (!(value is String)) {
+ if (value is! String) {
rc = asString(value);
} else {
switch (dataType) {
{required DataType dataType,
dynamic defaultValue,
bool nullReturnsNull = false}) {
- var rc;
+ dynamic rc;
if (value == null) {
rc = nullReturnsNull ? null : defaultValue;
} else if (value is String) {
final regExpTag = RegExp(r'<#\d+>$');
factory I18N() {
- if (instance == null) {
- instance = I18N.internal(MemoryLogger());
- }
+ instance ??= I18N.internal(MemoryLogger());
return instance!;
}
- /**
- * Constructor for initializing the global instance.
- *
- * @param logger: the logger used for error messages.
- */
+ /// Constructor for initializing the global instance.
+ ///
+ /// @param logger: the logger used for error messages.
I18N.internal(this.logger) {
instance = this;
}
/// The related database table.
String tableName = '';
- final needsSqlAll;
+ final bool needsSqlAll;
/// If true the fields create, createdBy ... have the same ("short") column name
/// instead of prefix and name.
String columnPrefix = '';
ModuleMetaData(this.moduleName, this.propertyList, this.pageList,
{String tableName = '',
- String moduleNameSingular = '',
+ this.moduleNameSingular = '',
String columnPrefix = '',
bool shortModifiedLabel = false,
- bool this.needsSqlAll = false}) {
+ this.needsSqlAll = false}) {
this.tableName = tableName.isEmpty ? moduleName.toLowerCase() : tableName;
- this.shortModifiedLabel = shortModifiedLabel;
if (moduleNameSingular.isEmpty) {
if (!moduleName.endsWith('s')) {
moduleNameSingular = moduleName;
moduleNameSingular = moduleName.substring(0, length);
}
}
- this.moduleNameSingular = moduleNameSingular;
this.columnPrefix = columnPrefix.isNotEmpty
? columnPrefix
- : this.moduleNameSingular.toLowerCase();
+ : moduleNameSingular.toLowerCase();
for (var item in propertyList) {
item.module = this;
rc = 'String';
break;
case DataType.undefined:
- throw FormatException('dartType(): data type is undefined');
+ throw const FormatException('dartType(): data type is undefined');
}
return rc;
}
}
break;
case DataType.undefined:
- throw FormatException('mySqlType(): data type is undefined');
+ throw const FormatException('mySqlType(): data type is undefined');
}
return rc;
}
///
/// Override it if needed.
void onInitialized() {
- for (var page in this.pageList) {
+ for (var page in pageList) {
page.onInitialized();
}
}
/// Returns the meta data of a property given by its [name] or null if missing.
PropertyMetaData? propertyByName(String name) {
- final rc = propertyList.singleWhere((element) => element.name == name,
- orElse: null);
+ PropertyMetaData? rc;
+ for (final element in propertyList){
+ if (element.name == name){
+ rc = element;
+ break;
+ }
+ }
return rc;
}
final List<WidgetMetaData> fields;
final String globalComboBoxes;
PageMetaData(this.label, this.pageType,
- {String name = '', required this.fields, this.globalComboBoxes = ''}) {
+ {this.name = '', required this.fields, this.globalComboBoxes = ''}) {
if (name.isEmpty) {
name = enumToString(pageType);
}
- this.name = name;
}
/// Does things when the instance is inititialized.
return rc;
}
/// Returns the module names as string list.
-List<String> moduleNames() {
+List<String> moduleNames(){
return [
'Benchmarks',
'Roles',
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-class BenchmarkData extends DataRecord<int> {
+class BenchmarkData extends DataRecord<int>{
int? id;
String? lastName;
String? firstName;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- BenchmarkData(
- {this.id,
- this.lastName,
- this.firstName,
- this.email,
- this.birthday,
- this.active,
- this.weight,
- this.income,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ BenchmarkData({
+ this.id, this.lastName, this.firstName, this.email, this.birthday, this.active, this.weight, this.income, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
BenchmarkData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('benchmark_id')
- ? fromString(map['benchmark_id'], dataType: DataType.reference)
- : null;
- lastName = map.containsKey('benchmark_lastname')
- ? fromString(map['benchmark_lastname'], dataType: DataType.string)
- : null;
- firstName = map.containsKey('benchmark_firstname')
- ? fromString(map['benchmark_firstname'], dataType: DataType.string)
- : null;
- email = map.containsKey('benchmark_email')
- ? fromString(map['benchmark_email'], dataType: DataType.string)
- : null;
- birthday = map.containsKey('benchmark_birthday')
- ? fromString(map['benchmark_birthday'], dataType: DataType.date)
- : null;
- active = map.containsKey('benchmark_active')
- ? fromString(map['benchmark_active'], dataType: DataType.bool)
- : null;
- weight = map.containsKey('benchmark_weight')
- ? fromString(map['benchmark_weight'], dataType: DataType.float)
- : null;
- income = map.containsKey('benchmark_income')
- ? fromString(map['benchmark_income'], dataType: DataType.currency)
- : null;
- createdAt = map.containsKey('benchmark_createdat')
- ? fromString(map['benchmark_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('benchmark_createdby')
- ? fromString(map['benchmark_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('benchmark_changedat')
- ? fromString(map['benchmark_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('benchmark_changedby')
- ? fromString(map['benchmark_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('benchmark_id') ? fromString(map['benchmark_id'], dataType: DataType.reference) : null;
+ lastName = map.containsKey('benchmark_lastname') ? fromString(map['benchmark_lastname'], dataType: DataType.string) : null;
+ firstName = map.containsKey('benchmark_firstname') ? fromString(map['benchmark_firstname'], dataType: DataType.string) : null;
+ email = map.containsKey('benchmark_email') ? fromString(map['benchmark_email'], dataType: DataType.string) : null;
+ birthday = map.containsKey('benchmark_birthday') ? fromString(map['benchmark_birthday'], dataType: DataType.date) : null;
+ active = map.containsKey('benchmark_active') ? fromString(map['benchmark_active'], dataType: DataType.bool) : null;
+ weight = map.containsKey('benchmark_weight') ? fromString(map['benchmark_weight'], dataType: DataType.float) : null;
+ income = map.containsKey('benchmark_income') ? fromString(map['benchmark_income'], dataType: DataType.currency) : null;
+ createdAt = map.containsKey('benchmark_createdat') ? fromString(map['benchmark_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('benchmark_createdby') ? fromString(map['benchmark_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('benchmark_changedat') ? fromString(map['benchmark_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('benchmark_changedby') ? fromString(map['benchmark_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'benchmark_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'lastName':
- rc = DataType.string;
- break;
- case 'firstName':
- rc = DataType.string;
- break;
- case 'email':
- rc = DataType.string;
- break;
- case 'birthday':
- rc = DataType.date;
- break;
- case 'active':
- rc = DataType.bool;
- break;
- case 'weight':
- rc = DataType.float;
- break;
- case 'income':
- rc = DataType.currency;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'lastName':
+ rc = DataType.string;
+ break;
+ case 'firstName':
+ rc = DataType.string;
+ break;
+ case 'email':
+ rc = DataType.string;
+ break;
+ case 'birthday':
+ rc = DataType.date;
+ break;
+ case 'active':
+ rc = DataType.bool;
+ break;
+ case 'weight':
+ rc = DataType.float;
+ break;
+ case 'income':
+ rc = DataType.currency;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
}
class _CreateBenchmarkPageState extends CreateBenchmarkCustom {
- _CreateBenchmarkPageState() : super();
-
+ _CreateBenchmarkPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _DeleteBenchmarkPageState extends DeleteBenchmarkCustom {
- _DeleteBenchmarkPageState(int primaryKey) : super(primaryKey);
-
+ _DeleteBenchmarkPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _EditBenchmarkPageState extends EditBenchmarkCustom {
- _EditBenchmarkPageState(int primaryKey) : super(primaryKey);
-
+ _EditBenchmarkPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _ListBenchmarkPageState extends ListBenchmarkCustom {
- _ListBenchmarkPageState() : super();
-
+ _ListBenchmarkPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _CreateRolePageState extends CreateRoleCustom {
- _CreateRolePageState() : super();
-
+ _CreateRolePageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _EditRolePageState extends EditRoleCustom {
- _EditRolePageState(int primaryKey) : super(primaryKey);
-
+ _EditRolePageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _ListRolePageState extends ListRoleCustom {
- _ListRolePageState() : super();
-
+ _ListRolePageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-class RoleData extends DataRecord<int> {
+class RoleData extends DataRecord<int>{
int? id;
String? name;
DateTime? createdAt;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- RoleData(
- {this.id,
- this.name,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ RoleData({
+ this.id, this.name, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
RoleData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('role_id')
- ? fromString(map['role_id'], dataType: DataType.reference)
- : null;
- name = map.containsKey('role_name')
- ? fromString(map['role_name'], dataType: DataType.string)
- : null;
- createdAt = map.containsKey('role_createdat')
- ? fromString(map['role_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('role_createdby')
- ? fromString(map['role_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('role_changedat')
- ? fromString(map['role_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('role_changedby')
- ? fromString(map['role_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('role_id') ? fromString(map['role_id'], dataType: DataType.reference) : null;
+ name = map.containsKey('role_name') ? fromString(map['role_name'], dataType: DataType.string) : null;
+ createdAt = map.containsKey('role_createdat') ? fromString(map['role_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('role_createdby') ? fromString(map['role_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('role_changedat') ? fromString(map['role_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('role_changedby') ? fromString(map['role_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'role_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'name':
- rc = DataType.string;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'name':
+ rc = DataType.string;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
}
class _ListRoleStarterPageState extends ListRoleStarterCustom {
- _ListRoleStarterPageState() : super();
-
+ _ListRoleStarterPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _MappingRoleStarterPageState extends MappingRoleStarterCustom {
- _MappingRoleStarterPageState() : super();
-
+ _MappingRoleStarterPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-class RoleStarterData extends DataRecord<int> {
+class RoleStarterData extends DataRecord<int>{
int? id;
int? role;
int? starter;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- RoleStarterData(
- {this.id,
- this.role,
- this.starter,
- this.order,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ RoleStarterData({
+ this.id, this.role, this.starter, this.order, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
RoleStarterData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('rolestarter_id')
- ? fromString(map['rolestarter_id'], dataType: DataType.reference)
- : null;
- role = map.containsKey('rolestarter_role')
- ? fromString(map['rolestarter_role'], dataType: DataType.reference)
- : null;
- starter = map.containsKey('rolestarter_starter')
- ? fromString(map['rolestarter_starter'], dataType: DataType.reference)
- : null;
- order = map.containsKey('rolestarter_order')
- ? fromString(map['rolestarter_order'], dataType: DataType.int)
- : null;
- createdAt = map.containsKey('rolestarter_createdat')
- ? fromString(map['rolestarter_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('rolestarter_createdby')
- ? fromString(map['rolestarter_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('rolestarter_changedat')
- ? fromString(map['rolestarter_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('rolestarter_changedby')
- ? fromString(map['rolestarter_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('rolestarter_id') ? fromString(map['rolestarter_id'], dataType: DataType.reference) : null;
+ role = map.containsKey('rolestarter_role') ? fromString(map['rolestarter_role'], dataType: DataType.reference) : null;
+ starter = map.containsKey('rolestarter_starter') ? fromString(map['rolestarter_starter'], dataType: DataType.reference) : null;
+ order = map.containsKey('rolestarter_order') ? fromString(map['rolestarter_order'], dataType: DataType.int) : null;
+ createdAt = map.containsKey('rolestarter_createdat') ? fromString(map['rolestarter_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('rolestarter_createdby') ? fromString(map['rolestarter_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('rolestarter_changedat') ? fromString(map['rolestarter_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('rolestarter_changedby') ? fromString(map['rolestarter_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'rolestarter_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'role':
- rc = DataType.reference;
- break;
- case 'starter':
- rc = DataType.reference;
- break;
- case 'order':
- rc = DataType.int;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'role':
+ rc = DataType.reference;
+ break;
+ case 'starter':
+ rc = DataType.reference;
+ break;
+ case 'order':
+ rc = DataType.int;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
class CreateScopePage extends StatefulWidget {
final PageStates pageStates = PageStates();
-
CreateScopePage() : super();
-
@override
_CreateScopePageState createState() {
final rc = _CreateScopePageState();
}
class _CreateScopePageState extends CreateScopeCustom {
- _CreateScopePageState() : super();
-
+ _CreateScopePageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
class DeleteScopePage extends StatefulWidget {
final int primaryKey;
final PageStates pageStates = PageStates();
-
DeleteScopePage(this.primaryKey) : super();
-
@override
_DeleteScopePageState createState() {
final rc = _DeleteScopePageState(this.primaryKey);
}
class _DeleteScopePageState extends DeleteScopeCustom {
- _DeleteScopePageState(int primaryKey) : super(primaryKey);
-
+ _DeleteScopePageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
class EditScopePage extends StatefulWidget {
final int primaryKey;
final PageStates pageStates = PageStates();
-
EditScopePage(this.primaryKey) : super();
-
@override
_EditScopePageState createState() {
final rc = _EditScopePageState(this.primaryKey);
}
class _EditScopePageState extends EditScopeCustom {
- _EditScopePageState(int primaryKey) : super(primaryKey);
-
+ _EditScopePageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
class ListScopePage extends StatefulWidget {
final PageStates pageStates = PageStates();
-
ListScopePage() : super();
-
@override
_ListScopePageState createState() {
final rc = _ListScopePageState();
}
class _ListScopePageState extends ListScopeCustom {
- _ListScopePageState() : super();
-
+ _ListScopePageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-
-class ScopeData extends DataRecord<int> {
+class ScopeData extends DataRecord<int>{
int? id;
String? scope;
String? name;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- ScopeData(
- {this.id,
- this.scope,
- this.name,
- this.value,
- this.position,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ ScopeData({
+ this.id, this.scope, this.name, this.value, this.position, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
ScopeData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('scope_id')
- ? fromString(map['scope_id'], dataType: DataType.reference)
- : null;
- scope = map.containsKey('scope_scope')
- ? fromString(map['scope_scope'], dataType: DataType.string)
- : null;
- name = map.containsKey('scope_name')
- ? fromString(map['scope_name'], dataType: DataType.string)
- : null;
- value = map.containsKey('scope_value')
- ? fromString(map['scope_value'], dataType: DataType.string)
- : null;
- position = map.containsKey('scope_position')
- ? fromString(map['scope_position'], dataType: DataType.int)
- : null;
- createdAt = map.containsKey('scope_createdat')
- ? fromString(map['scope_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('scope_createdby')
- ? fromString(map['scope_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('scope_changedat')
- ? fromString(map['scope_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('scope_changedby')
- ? fromString(map['scope_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('scope_id') ? fromString(map['scope_id'], dataType: DataType.reference) : null;
+ scope = map.containsKey('scope_scope') ? fromString(map['scope_scope'], dataType: DataType.string) : null;
+ name = map.containsKey('scope_name') ? fromString(map['scope_name'], dataType: DataType.string) : null;
+ value = map.containsKey('scope_value') ? fromString(map['scope_value'], dataType: DataType.string) : null;
+ position = map.containsKey('scope_position') ? fromString(map['scope_position'], dataType: DataType.int) : null;
+ createdAt = map.containsKey('scope_createdat') ? fromString(map['scope_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('scope_createdby') ? fromString(map['scope_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('scope_changedat') ? fromString(map['scope_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('scope_changedby') ? fromString(map['scope_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'scope_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'scope':
- rc = DataType.string;
- break;
- case 'name':
- rc = DataType.string;
- break;
- case 'value':
- rc = DataType.string;
- break;
- case 'position':
- rc = DataType.int;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'scope':
+ rc = DataType.string;
+ break;
+ case 'name':
+ rc = DataType.string;
+ break;
+ case 'value':
+ rc = DataType.string;
+ break;
+ case 'position':
+ rc = DataType.int;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
-
@override
DataMap toMap({DataMap? map, bool clear = true}) {
map ??= DataMap();
}
class _CreateStarterPageState extends CreateStarterCustom {
- _CreateStarterPageState() : super();
-
+ _CreateStarterPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _DeleteStarterPageState extends DeleteStarterCustom {
- _DeleteStarterPageState(int primaryKey) : super(primaryKey);
-
+ _DeleteStarterPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _EditStarterPageState extends EditStarterCustom {
- _EditStarterPageState(int primaryKey) : super(primaryKey);
-
+ _EditStarterPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _ListStarterPageState extends ListStarterCustom {
- _ListStarterPageState() : super();
-
+ _ListStarterPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-class StarterData extends DataRecord<int> {
+class StarterData extends DataRecord<int>{
int? id;
String? name;
String? route;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- StarterData(
- {this.id,
- this.name,
- this.route,
- this.icon,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ StarterData({
+ this.id, this.name, this.route, this.icon, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
StarterData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('starter_id')
- ? fromString(map['starter_id'], dataType: DataType.reference)
- : null;
- name = map.containsKey('starter_name')
- ? fromString(map['starter_name'], dataType: DataType.string)
- : null;
- route = map.containsKey('starter_route')
- ? fromString(map['starter_route'], dataType: DataType.string)
- : null;
- icon = map.containsKey('starter_icon')
- ? fromString(map['starter_icon'], dataType: DataType.string)
- : null;
- createdAt = map.containsKey('starter_createdat')
- ? fromString(map['starter_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('starter_createdby')
- ? fromString(map['starter_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('starter_changedat')
- ? fromString(map['starter_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('starter_changedby')
- ? fromString(map['starter_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('starter_id') ? fromString(map['starter_id'], dataType: DataType.reference) : null;
+ name = map.containsKey('starter_name') ? fromString(map['starter_name'], dataType: DataType.string) : null;
+ route = map.containsKey('starter_route') ? fromString(map['starter_route'], dataType: DataType.string) : null;
+ icon = map.containsKey('starter_icon') ? fromString(map['starter_icon'], dataType: DataType.string) : null;
+ createdAt = map.containsKey('starter_createdat') ? fromString(map['starter_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('starter_createdby') ? fromString(map['starter_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('starter_changedat') ? fromString(map['starter_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('starter_changedby') ? fromString(map['starter_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'starter_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'name':
- rc = DataType.string;
- break;
- case 'route':
- rc = DataType.string;
- break;
- case 'icon':
- rc = DataType.string;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'name':
+ rc = DataType.string;
+ break;
+ case 'route':
+ rc = DataType.string;
+ break;
+ case 'icon':
+ rc = DataType.string;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
}
class _CreateUserPageState extends CreateUserCustom {
- _CreateUserPageState() : super();
-
+ _CreateUserPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _DeleteUserPageState extends DeleteUserCustom {
- _DeleteUserPageState(int primaryKey) : super(primaryKey);
-
+ _DeleteUserPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _EditUserPageState extends EditUserCustom {
- _EditUserPageState(int primaryKey) : super(primaryKey);
-
+ _EditUserPageState(int primaryKey): super(primaryKey);
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
}
class _ListUserPageState extends ListUserCustom {
- _ListUserPageState() : super();
-
+ _ListUserPageState(): super();
@override
void didChangeDependencies() {
final size = MediaQuery.of(context).size;
import '../../base/defines.dart';
import '../../base/helper.dart';
import '../../persistence/data_record.dart';
-class UserData extends DataRecord<int> {
+class UserData extends DataRecord<int>{
int? id;
String? name;
String? displayName;
String? createdBy;
DateTime? changedAt;
String? changedBy;
-
- UserData(
- {this.id,
- this.name,
- this.displayName,
- this.email,
- this.role,
- this.status,
- this.createdAt,
- this.createdBy,
- this.changedAt,
- this.changedBy});
-
+ UserData({
+ this.id, this.name, this.displayName, this.email, this.role, this.status, this.createdAt, this.createdBy, this.changedAt, this.changedBy});
UserData.createFromMap(DataMap map) {
fromMap(map);
}
-
@override
void fromMap(DataMap map) {
- id = map.containsKey('user_id')
- ? fromString(map['user_id'], dataType: DataType.reference)
- : null;
- name = map.containsKey('user_name')
- ? fromString(map['user_name'], dataType: DataType.string)
- : null;
- displayName = map.containsKey('user_displayname')
- ? fromString(map['user_displayname'], dataType: DataType.string)
- : null;
- email = map.containsKey('user_email')
- ? fromString(map['user_email'], dataType: DataType.string)
- : null;
- role = map.containsKey('user_role')
- ? fromString(map['user_role'], dataType: DataType.reference)
- : null;
- status = map.containsKey('user_status')
- ? fromString(map['user_status'], dataType: DataType.reference)
- : null;
- createdAt = map.containsKey('user_createdat')
- ? fromString(map['user_createdat'], dataType: DataType.datetime)
- : null;
- createdBy = map.containsKey('user_createdby')
- ? fromString(map['user_createdby'], dataType: DataType.string)
- : null;
- changedAt = map.containsKey('user_changedat')
- ? fromString(map['user_changedat'], dataType: DataType.datetime)
- : null;
- changedBy = map.containsKey('user_changedby')
- ? fromString(map['user_changedby'], dataType: DataType.string)
- : null;
+ id = map.containsKey('user_id') ? fromString(map['user_id'], dataType: DataType.reference) : null;
+ name = map.containsKey('user_name') ? fromString(map['user_name'], dataType: DataType.string) : null;
+ displayName = map.containsKey('user_displayname') ? fromString(map['user_displayname'], dataType: DataType.string) : null;
+ email = map.containsKey('user_email') ? fromString(map['user_email'], dataType: DataType.string) : null;
+ role = map.containsKey('user_role') ? fromString(map['user_role'], dataType: DataType.reference) : null;
+ status = map.containsKey('user_status') ? fromString(map['user_status'], dataType: DataType.reference) : null;
+ createdAt = map.containsKey('user_createdat') ? fromString(map['user_createdat'], dataType: DataType.datetime) : null;
+ createdBy = map.containsKey('user_createdby') ? fromString(map['user_createdby'], dataType: DataType.string) : null;
+ changedAt = map.containsKey('user_changedat') ? fromString(map['user_changedat'], dataType: DataType.datetime) : null;
+ changedBy = map.containsKey('user_changedby') ? fromString(map['user_changedby'], dataType: DataType.string) : null;
}
-
@override
int keyOf() {
return id ?? 0;
}
-
@override
- String nameOfKey() {
+ String nameOfKey(){
return 'user_id';
}
-
static DataType? dataTypeOf(String name) {
DataType? rc;
- switch (name) {
- case 'id':
- rc = DataType.reference;
- break;
- case 'name':
- rc = DataType.string;
- break;
- case 'displayName':
- rc = DataType.string;
- break;
- case 'email':
- rc = DataType.string;
- break;
- case 'role':
- rc = DataType.reference;
- break;
- case 'status':
- rc = DataType.reference;
- break;
- case 'createdAt':
- rc = DataType.datetime;
- break;
- case 'createdBy':
- rc = DataType.string;
- break;
- case 'changedAt':
- rc = DataType.datetime;
- break;
- case 'changedBy':
- rc = DataType.string;
- break;
- default:
- break;
+ switch(name){
+ case 'id':
+ rc = DataType.reference;
+ break;
+ case 'name':
+ rc = DataType.string;
+ break;
+ case 'displayName':
+ rc = DataType.string;
+ break;
+ case 'email':
+ rc = DataType.string;
+ break;
+ case 'role':
+ rc = DataType.reference;
+ break;
+ case 'status':
+ rc = DataType.reference;
+ break;
+ case 'createdAt':
+ rc = DataType.datetime;
+ break;
+ case 'createdBy':
+ rc = DataType.string;
+ break;
+ case 'changedAt':
+ rc = DataType.datetime;
+ break;
+ case 'changedBy':
+ rc = DataType.string;
+ break;
+ default:
+ break;
}
return rc;
}
///
/// Returns the records matching the filters. If no filter is given all
/// records are returned.
- Iterable<DataRecord<T>> recordsOf<T>(
+ Iterable<DataRecord<T>> recordsOf<T2>(
{RecordFilter? recordFilter, KeyFilter? keyFilter}) {
final keys2 =
keyFilter == null ? keys : keys.where((element) => keyFilter(element));
@override
Future<DbData> query({required String what, DataMap? data}) async {
- var rc;
+ DbData rc;
final fn = path.join(dataDirectory, '$what.json');
final file = File(fn);
if (!await file.exists()) {
- logger.error('missing $fn');
+ final message = 'missing $fn';
+ logger.error(message);
+ rc = DbData.message(message);
} else {
final content = await file.readAsString();
final data = convert.jsonDecode(content);
case 'analytics_outlined':
rc = Icons.analytics_outlined;
break;
+ case 'calendar_today_outlined':
+ rc = Icons.calendar_today_outlined;
+ break;
default:
logger.error('MenuConverter.iconByName(): unknown icon $name');
break;
child: const Text('Impressum'),
onTap: () => launch('https://public.hamatoma.de'),
),
- // SizedBox(
+ // const SizedBox(
// width: 100,
// ),
InkWell(
child: const Text('Datenschutz'),
onTap: () => launch('https://public.hamatoma.de'),
),
- // SizedBox(
+ // const SizedBox(
// width: 150,
// ),
const Text('Version ${GlobalData.version}'),
static late GlobalData _instance;
static String baseDirectory = '';
static var serverEnvironment = ServerEnvironment.productive;
- static final String applicationName = theApplicationName;
+ static const String applicationName = theApplicationName;
static String loginUserName = 'guest';
static int loginUserId = 0;
static int loginUserRole = 90;
}
class GlobalThemeData {
- static final formBackgroundColor = Color.fromARGB(0xee, 0xee, 0xee, 0xee);
- static final formElevation = 10.0;
- static final formTextBackgroundColor = Colors.white;
- static final padding = 16.0;
+ static const formBackgroundColor = Color.fromARGB(0xee, 0xee, 0xee, 0xee);
+ static const formElevation = 10.0;
+ static const formTextBackgroundColor = Colors.white;
+ static const padding = 16.0;
}
class GlobalTranslations {
} else if (Platform.isAndroid) {
getExternalStorageDirectory().then((dir) => localData = dir!);
} else {
- throw FormatException('HomeDirectory.getHomePath(): unknown platform');
+ throw const FormatException('HomeDirectory.getHomePath(): unknown platform');
}
}
}
}
} on FormatException catch (exc) {
rc = logger
- .error('${configurationFile.path}: ' + i18n.tr('failure:' + ' $exc'));
+ .error('${configurationFile.path}: ' + i18n.tr('failure:') + ' $exc');
}
return rc;
}
/// Returns the name of [permission].
static String nameOfPermission(Permission permission) {
- var rc;
+ String rc;
if (permission == Permission.storage) {
rc = i18n.tr('Storage');
} else if (permission == Permission.camera) {
/// The file named [filename] contains the items in a JSon format with
/// names given by the database table structures.
Structures.fromFile(String filename) {
- this.globalData = GlobalData();
+ globalData = GlobalData();
final file = File(filename);
if (!file.existsSync()) {
globalData.logger.error('cannot read structures from $filename');
rc.add(ComboboxAttended(item, this));
break;
case DisplayType.checkbox:
- throw FormatException(
+ throw const FormatException(
'AttendedPage.widgetOf(): not implemented: checkbox');
case DisplayType.custom:
- throw FormatException(
+ throw const FormatException(
'AttendedPage.widgetOf(): not implemented: custom');
}
}
);
widgets.add(currentChip);
if (pageCount > 7 && (ix == 0 && !inTop || ix == 7 - 2 && !inTail)) {
- widgets.add(Text(' ... '));
+ widgets.add(const Text(' ... '));
}
}
Widget? rc = Wrap(children: widgets);
List<DataRow>? rc;
if (dbData.recordList != null) {
rc = <DataRow>[];
- dbData.recordList!.forEach((record) {
+ for (var record in dbData.recordList!) {
final cells = <DataCell>[];
for (var column in columnList.split(';')) {
final primaryKey = moduleMetaData.primaryOf()?.columnName;
}));
}
final rc3 = DataRow(cells: cells);
- rc!.add(rc3);
- });
+ rc.add(rc3);
+ }
}
return rc ?? <DataRow>[];
}
abstract class AttendedStateful extends StatefulWidget {
final PageStates pageStates = PageStates();
+
+ AttendedStateful({Key? key}) : super(key: key);
}
this.initialTime = initialTime;
}
this.initialDate = initialDate ?? now;
- this.initialTime = initialTime ?? TimeOfDay(hour: 8, minute: 0);
+ this.initialTime = initialTime ?? const TimeOfDay(hour: 8, minute: 0);
this.lastDate = lastDate ?? DateTime(now.year + 1);
this.firstDate = firstDate ?? DateTime(now.year - 1);
selectedDate = initialDate;
{required Function(DateTime selected) storeSelected}) async {
final TimeOfDay? picked = await showTimePicker(
context: context,
- initialTime: initialTime ?? TimeOfDay(hour: 8, minute: 0),
+ initialTime: initialTime ?? const TimeOfDay(hour: 8, minute: 0),
);
if (picked != null) {
selectedTime = picked;
final DateTimeData dateData;
final TextEditingController dateController;
DateTimeFormField(
- {required BuildContext context,
+ {Key? key,
+ required BuildContext context,
required this.dateData,
required this.dateController,
- Key? key,
FocusNode? focusNode,
InputDecoration? decoration = const InputDecoration(),
TextInputType? keyboardType = TextInputType.datetime,
bool enableIMEPersonalizedLearning = true,
double? gapWidth,
DateTime? initialDate})
- : super(
+ : super(key: key,
child: Row(children: <Widget>[
Expanded(
child: TextFormField(
dateData.onButtonPressed(context, storeSelected: (selected) {
dateData.selectedDate = selected;
}),
- child: Icon(Icons.calendar_today_outlined)),
+ child: const Icon(Icons.calendar_today_outlined)),
SizedBox(width: gapWidth ?? GlobalThemeData.padding),
ElevatedButton(
onPressed: () =>
dateData.onButtonPressed(context, storeSelected: (selected) {
dateData.selectedDate = selected;
}),
- child: Icon(Icons.lock_clock_outlined)),
+ child: const Icon(Icons.lock_clock_outlined)),
]));
}
void addToList(List<Widget> widgetList, double padding) {
if (message.isNotEmpty) {
widgetList.add(SizedBox(height: padding));
- widgetList.add(Text(message, style: TextStyle(color: Colors.red)));
+ widgetList.add(Text(message, style: const TextStyle(color: Colors.red)));
}
}
void addToFormList(List<Widget> widgetList, double padding) {
if (message.isNotEmpty) {
- widgetList.add(Text(message, style: TextStyle(color: Colors.red)));
+ widgetList.add(Text(message, style: const TextStyle(color: Colors.red)));
}
}
}
Widget rc;
if (minWidth > screenWidth) {
final widgets = <Widget>[];
- formItems.forEach((element) {
+ for (var element in formItems) {
if (element.gapAbove > 0) {
widgets.add(SizedBox(height: element.gapAbove));
}
widgets.add(element.widget);
- });
+ }
rc = ListView(children: widgets);
} else {
int position = 0;
} else {
if (position < 12 || gap > 0.0) {
childrenRow
- .add(Expanded(flex: 12 - position, child: SizedBox(width: 1)));
+ .add(Expanded(flex: 12 - position, child: const SizedBox(width: 1)));
}
position = 0;
if (childrenColumn.isNotEmpty || gap > 0.0) {
}
if (position < 12) {
childrenRow
- .add(Expanded(flex: 12 - position, child: SizedBox(width: 1)));
+ .add(Expanded(flex: 12 - position, child: const SizedBox(width: 1)));
}
childrenColumn.add(Row(children: childrenRow));
rc = Column(children: childrenColumn);
+// ignore_for_file: avoid_print
+
import 'dart:io';
import 'package:dart_bones/dart_bones.dart';
import 'package:path/path.dart';
+// ignore: avoid_relative_lib_imports
import '../lib/meta/module_meta_data.dart';
+// ignore: avoid_relative_lib_imports
import '../lib/meta/modules.dart';
import 'generator_base.dart';
import 'page_generator.dart';
buffer.writeln("import '../../base/defines.dart';");
buffer.writeln("import '../../base/helper.dart';");
buffer.writeln("import '../../persistence/data_record.dart';");
- final type = 'int';
+ const type = 'int';
buffer.writeln(
'class ${module.moduleNameSingular}Data extends DataRecord<$type>{');
for (var item in module.propertyList) {
''');
buffer.write(''' @override
DataMap toMap({DataMap? map, bool clear = true}) {
- map ??= DataMap();
+ map ??= {};
if (clear) {
map.clear();
}
/// Creates the file modules.dart.
String createModules() {
+ print('= Creating modules.dart: current dir: ' + Directory.current.path);
final buffer = StringBuffer();
buffer.write('// DO NOT CHANGE. This file is created by the meta_tool\n');
buffer.write("import 'module_meta_data.dart';\n");
fileOfModule[moduleName] = name;
modules.add(moduleName);
files.add(name);
- }
+ }
}
modules.sort();
files.sort();
switch (name) {
''');
for (var module in modules) {
+ print(module);
buffer.write(" case '$module':\n");
final className = findClass(fileOfModule[module]!);
buffer.write(" rc = $className();\n");
+// ignore_for_file: avoid_relative_lib_imports
+
import 'package:dart_bones/dart_bones.dart';
import '../lib/base/i18n_io.dart';
import '../lib/meta/module_meta_data.dart';
+// ignore_for_file: avoid_relative_lib_imports
+
import 'dart:io';
import 'package:dart_bones/dart_bones.dart';
/// Handles the page generation. Is a base class of [Generator].
class PageGenerator extends SqlGenerator {
- static final templateBodyLoadData = '''SafeArea(
+ static const templateBodyLoadData = '''SafeArea(
child: FutureBuilder<DbData>(
future: _futureDbData,
builder: (context, snapshot) {
});
return rc;
})));''';
- static final templateBodySimple = '''SafeArea(
+ static const templateBodySimple = '''SafeArea(
child: buildFrame()));''';
- static final templateDidChangeDependencies = '''
+ static const templateDidChangeDependencies = '''
@override
void didChangeDependencies() {
requestRecord();
}''';
- static final templatePage = '''
+ static const templatePage = '''
// DO NOT CHANGE. This file is created by the meta_tool!
import 'package:flutter/material.dart';
class EditUserPage extends StatefulWidget {
DEF_PRIMARY final PageStates pageStates = PageStates();
- EditUserPage(THIS_PRIMARY) : super();
+ EditUserPage(THIS_PRIMARY_COMMA{Key? key}) : super(key: key);
@override
_EditUserPageState createState() {
- final rc = _EditUserPageState(THIS_PRIMARY);
+ final rc = _EditUserPageState(VAL_PRIMARY);
rc.attendedPage = AttendedPage(
this,
rc,
}
}''';
- static final templateGlobalComboBox = ''' comboRolesFromBackend(
+ static const templateGlobalComboBox = ''' comboRolesFromBackend(
attendedPage: attendedPage, onDone: () => setState(() => 1));
final itemsRoles = comboRoles(
i18n.trDyn(GlobalTranslations.combobox#UNDEF), attendedPage);''';
- static final templateListCustom =
+ static const templateListCustom =
'''// This file is created by the meta_tool. But it can be customized.
// It will never overridden by the meta_tool.
import 'package:flutter/material.dart';
}
Widget buildFrame({required JsonList rows, required int totalCount}){
- final padding = GlobalThemeData.padding;
+ const padding = GlobalThemeData.padding;
#INIT_COMBOS final formItems = <FormItem>[
#FORM_ITEMS FormItem(
ElevatedButton(
color: GlobalThemeData.formBackgroundColor,
elevation: GlobalThemeData.formElevation,
margin:
- EdgeInsets.symmetric(vertical: padding, horizontal: padding),
+ const EdgeInsets.symmetric(vertical: padding, horizontal: padding),
child: Padding(
- padding: EdgeInsets.symmetric(
+ padding: const EdgeInsets.symmetric(
vertical: padding, horizontal: padding),
child: WidgetForm.flexibleGrid(formItems,
screenWidth: attendedPage.pageStates.screenWidth,
final frameWidget = ListView(children: [
form,
if (tabBar != null) tabBar,
- SizedBox(height: padding),
+ const SizedBox(height: padding),
SizedBox(width: double.infinity, child: table),
]);
return frameWidget;
#DEF_FIELDS}
''';
- static final templateMappingCustom =
+ static const templateMappingCustom =
'''// This file is created by the meta_tool. But it can be customized.
// It will never overridden by the meta_tool.
import 'package:flutter/material.dart';
}
Widget buildFrame({required JsonList rows, required int totalCount}){
- final padding = GlobalThemeData.padding;
+ const padding = GlobalThemeData.padding;
#INIT_COMBOS final formItems = <FormItem>[
#FORM_ITEMS FormItem(
ElevatedButton(
color: GlobalThemeData.formBackgroundColor,
elevation: GlobalThemeData.formElevation,
margin:
- EdgeInsets.symmetric(vertical: padding, horizontal: padding),
+ const EdgeInsets.symmetric(vertical: padding, horizontal: padding),
child: Padding(
- padding: EdgeInsets.symmetric(
+ padding: const EdgeInsets.symmetric(
vertical: padding, horizontal: padding),
child: WidgetForm.flexibleGrid(formItems,
screenWidth: attendedPage.pageStates.screenWidth,
final frameWidget = ListView(children: [
form,
if (tabBar != null) tabBar,
- SizedBox(height: padding),
+ const SizedBox(height: padding),
SizedBox(width: double.infinity, child: table),
]);
return frameWidget;
#DEF_FIELDS}
''';
- static final templateRecordCustom =
+ static const templateRecordCustom =
'''// This file is created by the meta_tool. But it can be customized.
// It will never overridden by the meta_tool.
import 'package:flutter/material.dart';
final _fieldData = _FieldData();
final GlobalKey<FormState> _formKey =
GlobalKey<FormState>(debugLabel: 'EditUser');
-#DEF_CONTROLLER EditUserCustom(#THIS_PRIMARY);
+#DEF_CONTROLLER EditUserCustom(#VAL_PRIMARY);
@override
Widget build(BuildContext context) {
final rc = Scaffold(
}
Widget buildFrame() {
- final padding = GlobalThemeData.padding;
+ const padding = GlobalThemeData.padding;
#INIT_COMBO#ASSIGN_CONTROLLER final formItems = <FormItem>[
#FORM_ITEMS FormItem(
ElevatedButton(
key: _formKey,
child: Card(
margin:
- EdgeInsets.symmetric(vertical: padding, horizontal: padding),
+ const EdgeInsets.symmetric(vertical: padding, horizontal: padding),
child: Padding(
- padding: EdgeInsets.symmetric(
+ padding: const EdgeInsets.symmetric(
vertical: padding, horizontal: padding),
child: WidgetForm.flexibleGrid(
formItems,
#DEF_FIELD
#FROM_MAP#TO_MAP}
''';
- static final templateRequestRecord = '''
+ static const templateRequestRecord = '''
void requestRecord() => _futureDbData = globalData.restPersistence.query(
what: 'query',
data: {'module': 'Users', 'sql': 'byId', ':id': primaryKey});
''';
- static final templateStorageDoneCreate = '''
+ static const templateStorageDoneCreate = '''
if (answer.startsWith('id:')) {
final id = int.tryParse(answer.substring(3));
}
}
''';
- static final templateStorageDoneEdit = '''
+ static const templateStorageDoneEdit = '''
requestRecord();
attendedPage.pageStates.dbDataState.clear();
setState(() => 1);
''';
- static final templateStorageDoneDelete =
+ static const templateStorageDoneDelete =
"\n globalData.navigate(context, '/#MODULE/list');\n ";
- static final templateFromMap = ''' void fromMap(Map<String, dynamic> map) {
+ static const templateFromMap = ''' void fromMap(Map<String, dynamic> map) {
#BODY_FROM }
''';
- static final templatePageManager =
+ static const templatePageManager =
'''// DO NOT CHANGE. This file is created by the meta_tool!
import 'package:flutter/material.dart';
import 'page_manager_custom.dart';
}
''';
- static final templatePageManagerCustom =
+ static const templatePageManagerCustom =
'''// This file is created by the meta_tool. But it can be customized.
// It will never overridden by the meta_tool.
import 'package:flutter/material.dart';
//final arg1 = parts.length < 2 ? 0 : int.parse(parts[1]);
switch (parts[0]) {
case '/info':
- rc = InfoPage();
+ rc = const InfoPage();
break;
case '/log':
- rc = LogPage();
+ rc = const LogPage();
break;
default:
break;
}
''';
- static final templateCase = ''' case '/Users/edit':
+ static const templateCase = ''' case '/Users/edit':
rc = EditUserPage(ARG1);
break;
''';
buffer.writeln(" // please set outside: map[':id'] = primaryKey;");
}
for (var field in page.fields) {
- if (!(field is PropertyMetaData) || field.hasOption(':primary:')) {
+ if (field is! PropertyMetaData || field.hasOption(':primary:')) {
continue;
}
final name = field.name;
if (page.pageType == PageType.edit || page.pageType == PageType.delete) {
rc = rc
.replaceAll('DEF_PRIMARY', ' final int primaryKey;\n')
+ .replaceAll('THIS_PRIMARY_COMMA', 'this.primaryKey, ')
.replaceAll('THIS_PRIMARY', 'this.primaryKey')
.replaceAll('PARAM_PRIMARY', 'int primaryKey')
.replaceAll('VAL_PRIMARY', 'primaryKey');
} else {
rc = rc
.replaceAll('DEF_PRIMARY', '')
+ .replaceAll('THIS_PRIMARY_COMMA', '')
.replaceAll('THIS_PRIMARY', '')
.replaceAll('PARAM_PRIMARY', '')
.replaceAll('VAL_PRIMARY', '');
.replaceFirst(
'#DEF_PRIMARY', hasPrimary ? ' final int primaryKey;\n' : '')
.replaceFirst('#THIS_PRIMARY', hasPrimary ? 'this.primaryKey' : '')
+ .replaceFirst('#VAL_PRIMARY', hasPrimary ? 'primaryKey' : '')
.replaceFirst('#TO_MAP', buildToMap(page))
.replaceFirst('#FROM_MAP', buildFromMap(page))
.replaceFirst('#DEF_FUTURE', definitionFuture)
.replaceFirst('#IMPORTS#', imports.toString())
.replaceFirst('#CASES#', cases.toString());
writeFile('../lib/page/page_manager.dart', content);
- final full = '../lib/page/page_manager_custom.dart';
+ const full = '../lib/page/page_manager_custom.dart';
if (File(full).existsSync()) {
logger.log('$full already exists. We do not override');
} else {
+// ignore_for_file: avoid_relative_lib_imports
+
import 'dart:io';
import 'package:dart_bones/dart_bones.dart';
separator: first ? null : ',',
indent: 4,
buffer: parameters);
- addToBuffer('${item.columnName}',
+ addToBuffer(item.columnName,
maxLength: 80,
separator: first ? null : ',',
indent: 6,
dart_bones: ^1.2.2
dev_dependencies:
- pedantic: ^1.11.1
+ lints: ^1.0.1
test: ^1.17.10
-
+ flutter_lints: ^1.0.4
--- /dev/null
+---
+# DO NOT CHANGE. This file is created by the meta_tool
+# SQL statements of the module "Scopes":
+
+module: Scopes
+list:
+ type: list
+ parameters: []
+ order: "scope_id"
+ sql: |
+ SELECT
+ t0.*
+ FROM scopes t0
+byId:
+ type: record
+ parameters: [ ":id" ]
+ sql: "SELECT * FROM scopes WHERE scope_id=:id;"
+delete:
+ type: delete
+ parameters: [ ":id" ]
+ sql: "DELETE * FROM scopes WHERE scope_id=:id;"
+update:
+ type: update
+ parameters: [":id",":scope",":name",":value",":position"]
+ sql: |
+ UPDATE scopes SET
+ scope_scope=:scope,
+ scope_name=:name,
+ scope_value=:value,
+ scope_position=:position,
+ scope_changedat=NOW()
+ WHERE scope_id=:id;
+insert:
+ type: insert
+ parameters: [":scope",":name",":value",":position",":createdBy"]
+ sql: |
+ INSERT INTO scopes(scope_scope,scope_name,scope_value,scope_position,
+ scope_createdby,scope_createdat)
+ VALUES(:scope,:name,:value,:position,:createdBy,NOW());
order: "user_id"
sql: |
SELECT
- t0.*,t1.role_name AS role
+ t0.*,t1.role_name AS role,t2.role_name AS role
FROM users t0
JOIN roles t1 ON t1.role_id=t0.user_role
+ JOIN roles t2 ON t2.role_id=t0.user_status
WHERE
(:text='' OR user_name like :text
OR user_displayname like :text OR user_email like :text)
sql: "DELETE * FROM users WHERE user_id=:id;"
update:
type: update
- parameters: [":id",":name",":displayName",":email",":role"]
+ parameters: [":id",":name",":displayName",":email",":role",":status"]
sql: |
UPDATE users SET
user_name=:name,
user_displayname=:displayName,
user_email=:email,
user_role=:role,
+ user_status=:status,
user_changedat=NOW()
WHERE user_id=:id;
insert:
type: insert
- parameters: [":name",":displayName",":email",":role",":createdBy"]
+ parameters: [":name",":displayName",":email",":role",":status",":createdBy"]
sql: |
INSERT INTO users(user_name,user_displayname,user_email,user_role,
- user_createdby,user_createdat)
- VALUES(:name,:displayName,:email,:role,:createdBy,NOW());
+ user_status,user_createdby,user_createdat)
+ VALUES(:name,:displayName,:email,:role,:status,:createdBy,NOW());
timeout: 30
traceDataLength: 200
clientSessionTimeout: 900
-# put this content to /etc/exhibition/exhibition.yaml
+# put this content to /etc/exhibition/exhibition.sv.yaml
''';
return rc;
}
if (!executable.startsWith(Platform.pathSeparator)) {
executable = processSync.executeToString('which', [executable]).trim();
}
- final fnConfig = '/etc/exhibition/$appName.yaml';
+ final fnConfig = '/etc/exhibition/$appName.sv.yaml';
fileSync.ensureDirectory(path.dirname(fnConfig));
if (File(fnConfig).existsSync()) {
logger.log('= $fnConfig already exists.');