Skip to content

Commit

Permalink
Some minor renaming and cleanup in flutter projects
Browse files Browse the repository at this point in the history
  • Loading branch information
hkbinaurics committed Jul 5, 2024
1 parent fbe2023 commit 713f1f9
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter/foundation.dart' show kIsWeb;
// Callback to allocate an audio device sliver in the list of active/inactive
// devices lists
Widget? allocateAudioDeviceSliver(AudYoFloOneDeviceSelectionOptionWithId option,
bool fromActiveList, AudYoFloSingleSelectionComponent? reportW) =>
bool fromActiveList, AudYoFloSelectionComponentUi? reportW) =>
AudYoFloOneDeviceSliver(option, fromActiveList, reportW);

// ============================================================================
Expand All @@ -20,7 +20,7 @@ Widget? allocateAudioDeviceSliver(AudYoFloOneDeviceSelectionOptionWithId option,
Widget? allocateHeadtrackerDeviceSliver(
AudYoFloOneDeviceSelectionOptionWithId option,
bool fromActiveList,
AudYoFloSingleSelectionComponent? reportW) =>
AudYoFloSelectionComponentUi? reportW) =>
AudYoFloOneHeadtrackerDeviceSliver(option, fromActiveList, reportW);

BottomAppBar? allocatorBottomAppBar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AudYoFloAudioSettingsWidget extends StatefulWidget {
final Widget? Function(
AudYoFloOneDeviceSelectionOptionWithId option,
bool fromActiveList,
AudYoFloSingleSelectionComponent?) callbackActiveInactiveDeviceSliver;
AudYoFloSelectionComponentUi?) callbackActiveInactiveDeviceSliver;
@override
_AudYoFloAudioSettingsWidgetState createState() =>
_AudYoFloAudioSettingsWidgetState();
Expand Down
10 changes: 8 additions & 2 deletions flutter/ayf_pack/lib/models/ayf_backend_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ abstract class AudYoFloBackendCache

@override
List<int> findProcessesMatchComponent(JvxComponentIdentification cpId,
{List<int>? lstIn}) {
{List<int>? lstIn, bool asFirstElement = false}) {
List<int> lst = [];
if (lstIn != null) {
lst = List.from(lstIn);
Expand All @@ -666,7 +666,13 @@ abstract class AudYoFloBackendCache
var involvedElementStart = con.involved;
bool foundElm = false;
if (involvedElementStart != null) {
foundElm = involvedElementStart.findProcessMatchComponent(cpId);
if (asFirstElement) {
if (cpId == involvedElementStart.cpId) {
foundElm = true;
}
} else {
foundElm = involvedElementStart.findProcessMatchComponent(cpId);
}
}
if (foundElm) {
lst.add(con.uId);
Expand Down
9 changes: 9 additions & 0 deletions flutter/ayf_pack/lib/models/ayf_component_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ class AudYoFloOneDeviceSelectionOptionWithId {
AudYoFloOneDeviceSelectionOptionWithId(this.option, this.idx);
}

class AudYoFloOneDeviceSelectionOptionWithIdAndProcess
extends AudYoFloOneDeviceSelectionOptionWithId {
AudYoFloOneConnectedProcess? proc;
List<AudYoFloOneComponentWithDetail> relChainComponents = [];
AudYoFloOneDeviceSelectionOptionWithIdAndProcess(
AudYoFloOneDeviceSelectionOption option, int idx)
: super(option, idx) {}
}

class AudYoFloOneComponentSelectionOption
extends AudYoFloOneSelectionOptionBase {
List<int> sids = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AudYoFloAudioDeviceRenderSection {
class AudYoFloOneDeviceSliver extends StatelessWidget {
final AudYoFloOneDeviceSelectionOptionWithId option;
final bool fromActiveList;
final AudYoFloSingleSelectionComponent? reportTarget;
final AudYoFloSelectionComponentUi? reportTarget;

AudYoFloOneDeviceSliver(this.option, this.fromActiveList, this.reportTarget);

Expand Down Expand Up @@ -147,7 +147,7 @@ class AudYoFloOneDeviceSliver extends StatelessWidget {
// update the widget which is in parallel to the device selection construct

if (reportTarget != null) {
reportTarget!.reportSelectionComponent(option.option.devIdent);
reportTarget!.reportSelectionComponentUi(option.option.devIdent);
}
},
child: Card(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AudYoFloDeviceSelectionWidget extends StatefulWidget {
final Widget? Function(
AudYoFloOneDeviceSelectionOptionWithId option,
bool fromActiveList,
AudYoFloSingleSelectionComponent?) callbackActiveInactiveDeviceSliver;
AudYoFloSelectionComponentUi?) callbackActiveInactiveDeviceSliver;

AudYoFloDeviceSelectionWidget(this.identT, this.tagDevices,
this.callbackDeviceWidget, this.callbackActiveInactiveDeviceSliver);
Expand All @@ -26,9 +26,7 @@ class AudYoFloDeviceSelectionWidget extends StatefulWidget {

class _AudYoFloDeviceSelectionWidgetStates
extends State<AudYoFloDeviceSelectionWidget>
with
AudYoFloSingleSelectionComponent,
AudYoFloOneTechnologyDevicesOnChange {
with AudYoFloSelectionComponentUi, AudYoFloOneTechnologyDevicesOnChange {
List<AudYoFloOneDeviceSelectionOption>? pContent;
JvxComponentIdentification selCpId = JvxComponentIdentification(
cpTp: JvxComponentTypeEnum.JVX_COMPONENT_UNKNOWN);
Expand All @@ -38,7 +36,7 @@ class _AudYoFloDeviceSelectionWidgetStates
// At the moment, this callback is called if a device was chosen in the list
// of active devices.
@override
void reportSelectionComponent(JvxComponentIdentification cpId) {
void reportSelectionComponentUi(JvxComponentIdentification cpId) {
setState(() {
selCpId = cpId;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class deviceSelectionDragData {
class AudYoFloDeviceActiveInactiveWidget extends StatefulWidget {
final List<AudYoFloOneDeviceSelectionOption>? pContent;
final JvxComponentIdentification cpId;
final AudYoFloSingleSelectionComponent? reportWidget;
final AudYoFloSelectionComponentUi? reportWidget;
final String tagDevices;
final Widget? Function(
AudYoFloOneDeviceSelectionOptionWithId option,
bool fromActiveList,
AudYoFloSingleSelectionComponent?) callbackActiveInactiveDeviceSliver;
AudYoFloSelectionComponentUi?) callbackActiveInactiveDeviceSliver;
AudYoFloDeviceActiveInactiveWidget(this.pContent, this.cpId, this.tagDevices,
this.callbackActiveInactiveDeviceSliver,
{this.reportWidget});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AudYoFloOneFileDeviceSliver extends StatelessWidget
with AudYoFloOneComponentPropertyOnChange, AudYoFloPropertyOnChangeGroups {
final AudYoFloOneDeviceSelectionOptionWithId option;
final JvxComponentIdentification cpIdConf;
final AudYoFloSingleSelectionComponent? reportTarget;
final AudYoFloSelectionComponentUi? reportTarget;
AudYoFloBackendCache? theBeCache;

AudYoFloPropertyOnChangeOneGroup oneGroupThisWidget =
Expand Down Expand Up @@ -170,7 +170,7 @@ class AudYoFloOneFileDeviceSliver extends StatelessWidget
return GestureDetector(
onTap: () {
if (reportTarget != null) {
reportTarget!.reportSelectionComponent(option.option.devIdent);
reportTarget!.reportSelectionComponentUi(option.option.devIdent);
}
},
child: Padding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AudYoFloHeadtrackerDeviceRenderSection {
class AudYoFloOneHeadtrackerDeviceSliver extends StatelessWidget {
final AudYoFloOneDeviceSelectionOptionWithId option;
final bool fromActiveList;
final AudYoFloSingleSelectionComponent? reportTarget;
final AudYoFloSelectionComponentUi? reportTarget;

AudYoFloOneHeadtrackerDeviceSliver(
this.option, this.fromActiveList, this.reportTarget);
Expand Down Expand Up @@ -94,7 +94,7 @@ class AudYoFloOneHeadtrackerDeviceSliver extends StatelessWidget {
// here, we run a callback to the next higher layer in the widget hierarchy to
// update the widget which is in parallel to the device selection construct
if (reportTarget != null) {
reportTarget!.reportSelectionComponent(option.option.devIdent);
reportTarget!.reportSelectionComponentUi(option.option.devIdent);
}
},
child: Card(
Expand Down
4 changes: 2 additions & 2 deletions flutter/ayf_pack/lib/types/ayf_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class AudYoFloCallByReference<T> {
// This class defines a callback that reports the selection (=clicked) of a
// specific component. Currently, it is used to select a device within the list of active
// devices
abstract class AudYoFloSingleSelectionComponent {
abstract class AudYoFloSelectionComponentUi {
// End up in this callback in case a selection was chosen (=clicked)
void reportSelectionComponent(JvxComponentIdentification cpId);
void reportSelectionComponentUi(JvxComponentIdentification cpId);
}

class AudYoFloCompileFlags {
Expand Down

0 comments on commit 713f1f9

Please sign in to comment.