mirror of
https://github.com/dancojocaru2000/logic-circuits-simulator.git
synced 2025-06-19 10:32:28 +03:00
Compare commits
No commits in common. "e4041020f1c288d279f9162380f609ed426a439e" and "85838c2b325064a5cbd420b514b3faf39044088e" have entirely different histories.
e4041020f1
...
85838c2b32
6 changed files with 20 additions and 75 deletions
|
@ -20,7 +20,7 @@ class NewProjectDialog extends HookWidget {
|
|||
final newProjectAction = useMemoized(() {
|
||||
if (newDialogNameController.text.isEmpty) return null;
|
||||
return () {
|
||||
projectsState.newProject(newDialogNameController.text.trim());
|
||||
projectsState.newProject(newDialogNameController.text);
|
||||
Navigator.pop(context);
|
||||
};
|
||||
}, [newDialogNameController.text]);
|
||||
|
@ -217,9 +217,6 @@ class NewProjectDialog extends HookWidget {
|
|||
icon: const Icon(Icons.done),
|
||||
onPressed: newProjectAction,
|
||||
),
|
||||
errorText: projectsState.projects.map((p) => p.projectName).contains(newDialogNameController.text.trim())
|
||||
? 'A project with the same name already exists'
|
||||
: null,
|
||||
),
|
||||
onSubmitted: newProjectAction == null ? null : (_) => newProjectAction(),
|
||||
),
|
||||
|
|
|
@ -27,8 +27,6 @@ class ComponentEntry with _$ComponentEntry {
|
|||
List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false)
|
||||
required bool visualDesigned,
|
||||
@JsonKey(defaultValue: [])
|
||||
required List<String> dependencies,
|
||||
}) = _ComponentEntry;
|
||||
|
||||
factory ComponentEntry.fromJson(Map<String, Object?> json) => _$ComponentEntryFromJson(json);
|
||||
|
|
|
@ -170,8 +170,6 @@ mixin _$ComponentEntry {
|
|||
List<String>? get logicExpression => throw _privateConstructorUsedError;
|
||||
@JsonKey(defaultValue: false)
|
||||
bool get visualDesigned => throw _privateConstructorUsedError;
|
||||
@JsonKey(defaultValue: [])
|
||||
List<String> get dependencies => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
|
@ -192,8 +190,7 @@ abstract class $ComponentEntryCopyWith<$Res> {
|
|||
List<String> outputs,
|
||||
@JsonKey(includeIfNull: false) List<String>? truthTable,
|
||||
@JsonKey(includeIfNull: false) List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false) bool visualDesigned,
|
||||
@JsonKey(defaultValue: []) List<String> dependencies});
|
||||
@JsonKey(defaultValue: false) bool visualDesigned});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
@ -215,7 +212,6 @@ class _$ComponentEntryCopyWithImpl<$Res>
|
|||
Object? truthTable = freezed,
|
||||
Object? logicExpression = freezed,
|
||||
Object? visualDesigned = freezed,
|
||||
Object? dependencies = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
componentId: componentId == freezed
|
||||
|
@ -250,10 +246,6 @@ class _$ComponentEntryCopyWithImpl<$Res>
|
|||
? _value.visualDesigned
|
||||
: visualDesigned // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dependencies: dependencies == freezed
|
||||
? _value.dependencies
|
||||
: dependencies // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -273,8 +265,7 @@ abstract class _$$_ComponentEntryCopyWith<$Res>
|
|||
List<String> outputs,
|
||||
@JsonKey(includeIfNull: false) List<String>? truthTable,
|
||||
@JsonKey(includeIfNull: false) List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false) bool visualDesigned,
|
||||
@JsonKey(defaultValue: []) List<String> dependencies});
|
||||
@JsonKey(defaultValue: false) bool visualDesigned});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
@ -298,7 +289,6 @@ class __$$_ComponentEntryCopyWithImpl<$Res>
|
|||
Object? truthTable = freezed,
|
||||
Object? logicExpression = freezed,
|
||||
Object? visualDesigned = freezed,
|
||||
Object? dependencies = freezed,
|
||||
}) {
|
||||
return _then(_$_ComponentEntry(
|
||||
componentId: componentId == freezed
|
||||
|
@ -333,10 +323,6 @@ class __$$_ComponentEntryCopyWithImpl<$Res>
|
|||
? _value.visualDesigned
|
||||
: visualDesigned // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dependencies: dependencies == freezed
|
||||
? _value._dependencies
|
||||
: dependencies // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -352,13 +338,11 @@ class _$_ComponentEntry implements _ComponentEntry {
|
|||
required final List<String> outputs,
|
||||
@JsonKey(includeIfNull: false) final List<String>? truthTable,
|
||||
@JsonKey(includeIfNull: false) final List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false) required this.visualDesigned,
|
||||
@JsonKey(defaultValue: []) required final List<String> dependencies})
|
||||
@JsonKey(defaultValue: false) required this.visualDesigned})
|
||||
: _inputs = inputs,
|
||||
_outputs = outputs,
|
||||
_truthTable = truthTable,
|
||||
_logicExpression = logicExpression,
|
||||
_dependencies = dependencies;
|
||||
_logicExpression = logicExpression;
|
||||
|
||||
factory _$_ComponentEntry.fromJson(Map<String, dynamic> json) =>
|
||||
_$$_ComponentEntryFromJson(json);
|
||||
|
@ -407,17 +391,10 @@ class _$_ComponentEntry implements _ComponentEntry {
|
|||
@override
|
||||
@JsonKey(defaultValue: false)
|
||||
final bool visualDesigned;
|
||||
final List<String> _dependencies;
|
||||
@override
|
||||
@JsonKey(defaultValue: [])
|
||||
List<String> get dependencies {
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_dependencies);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ComponentEntry(componentId: $componentId, componentName: $componentName, componentDescription: $componentDescription, inputs: $inputs, outputs: $outputs, truthTable: $truthTable, logicExpression: $logicExpression, visualDesigned: $visualDesigned, dependencies: $dependencies)';
|
||||
return 'ComponentEntry(componentId: $componentId, componentName: $componentName, componentDescription: $componentDescription, inputs: $inputs, outputs: $outputs, truthTable: $truthTable, logicExpression: $logicExpression, visualDesigned: $visualDesigned)';
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -438,9 +415,7 @@ class _$_ComponentEntry implements _ComponentEntry {
|
|||
const DeepCollectionEquality()
|
||||
.equals(other._logicExpression, _logicExpression) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.visualDesigned, visualDesigned) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._dependencies, _dependencies));
|
||||
.equals(other.visualDesigned, visualDesigned));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
|
@ -454,8 +429,7 @@ class _$_ComponentEntry implements _ComponentEntry {
|
|||
const DeepCollectionEquality().hash(_outputs),
|
||||
const DeepCollectionEquality().hash(_truthTable),
|
||||
const DeepCollectionEquality().hash(_logicExpression),
|
||||
const DeepCollectionEquality().hash(visualDesigned),
|
||||
const DeepCollectionEquality().hash(_dependencies));
|
||||
const DeepCollectionEquality().hash(visualDesigned));
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
|
@ -472,18 +446,13 @@ abstract class _ComponentEntry implements ComponentEntry {
|
|||
const factory _ComponentEntry(
|
||||
{required final String componentId,
|
||||
required final String componentName,
|
||||
@JsonKey(includeIfNull: false)
|
||||
final String? componentDescription,
|
||||
@JsonKey(includeIfNull: false) final String? componentDescription,
|
||||
required final List<String> inputs,
|
||||
required final List<String> outputs,
|
||||
@JsonKey(includeIfNull: false)
|
||||
final List<String>? truthTable,
|
||||
@JsonKey(includeIfNull: false)
|
||||
final List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false)
|
||||
required final bool visualDesigned,
|
||||
@JsonKey(defaultValue: [])
|
||||
required final List<String> dependencies}) = _$_ComponentEntry;
|
||||
@JsonKey(includeIfNull: false) final List<String>? truthTable,
|
||||
@JsonKey(includeIfNull: false) final List<String>? logicExpression,
|
||||
@JsonKey(defaultValue: false) required final bool visualDesigned}) =
|
||||
_$_ComponentEntry;
|
||||
|
||||
factory _ComponentEntry.fromJson(Map<String, dynamic> json) =
|
||||
_$_ComponentEntry.fromJson;
|
||||
|
@ -509,9 +478,6 @@ abstract class _ComponentEntry implements ComponentEntry {
|
|||
@JsonKey(defaultValue: false)
|
||||
bool get visualDesigned => throw _privateConstructorUsedError;
|
||||
@override
|
||||
@JsonKey(defaultValue: [])
|
||||
List<String> get dependencies => throw _privateConstructorUsedError;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$_ComponentEntryCopyWith<_$_ComponentEntry> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
|
|
@ -34,10 +34,6 @@ _$_ComponentEntry _$$_ComponentEntryFromJson(Map<String, dynamic> json) =>
|
|||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
visualDesigned: json['visualDesigned'] as bool? ?? false,
|
||||
dependencies: (json['dependencies'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList() ??
|
||||
[],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_ComponentEntryToJson(_$_ComponentEntry instance) {
|
||||
|
@ -58,6 +54,5 @@ Map<String, dynamic> _$$_ComponentEntryToJson(_$_ComponentEntry instance) {
|
|||
writeNotNull('truthTable', instance.truthTable);
|
||||
writeNotNull('logicExpression', instance.logicExpression);
|
||||
val['visualDesigned'] = instance.visualDesigned;
|
||||
val['dependencies'] = instance.dependencies;
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -168,12 +168,9 @@ class EditComponentPage extends HookWidget {
|
|||
sliver: SliverToBoxAdapter(
|
||||
child: TextField(
|
||||
controller: componentNameEditingController,
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Component name',
|
||||
errorText: projectState.index.components.where((c) => c.componentId != ce().componentId).map((c) => c.componentName).contains(componentNameEditingController.text.trim())
|
||||
? 'A component with the same name already exists'
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -452,13 +449,6 @@ class EditComponentPage extends HookWidget {
|
|||
child: const Text('Visual Designer'),
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: OutlinedButton(
|
||||
onPressed: null,
|
||||
child: const Text('Script'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -580,7 +570,7 @@ class EditComponentPage extends HookWidget {
|
|||
floatingActionButton: !dirty ? null : FloatingActionButton(
|
||||
onPressed: () async {
|
||||
if (componentNameEditingController.text.isNotEmpty) {
|
||||
await projectState.editComponent(ce().copyWith(componentName: componentNameEditingController.text.trim()));
|
||||
await projectState.editComponent(ce().copyWith(componentName: componentNameEditingController.text));
|
||||
}
|
||||
await projectState.editComponent(ce().copyWith(
|
||||
inputs: inputs.value,
|
||||
|
|
|
@ -77,7 +77,6 @@ class ProjectState extends ChangeNotifier {
|
|||
inputs: [],
|
||||
outputs: [],
|
||||
visualDesigned: false,
|
||||
dependencies: [],
|
||||
);
|
||||
await _updateIndex(index.copyWith(components: index.components + [newComponent]));
|
||||
return newComponent;
|
||||
|
|
Loading…
Add table
Reference in a new issue