💄 Use different icon for mute state of outputs
This commit is contained in:
@ -4,7 +4,12 @@ import 'package:gomix_flutter/mixer_state.dart' as mixer;
|
||||
class MixingCard extends StatefulWidget {
|
||||
final mixer.Port port;
|
||||
final Function sendAction;
|
||||
const MixingCard({super.key, required this.port, required this.sendAction});
|
||||
final bool isOutput;
|
||||
const MixingCard(
|
||||
{super.key,
|
||||
required this.port,
|
||||
required this.sendAction,
|
||||
this.isOutput = false});
|
||||
|
||||
@override
|
||||
State<MixingCard> createState() => _MixingCardState();
|
||||
@ -45,21 +50,27 @@ class _MixingCardState extends State<MixingCard> {
|
||||
children: [
|
||||
Expanded(child: Text(widget.port.name, style: labelStyle)),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: IconButton.filledTonal(
|
||||
iconSize: 20,
|
||||
isSelected: widget.port.state.mute,
|
||||
onPressed: () {
|
||||
widget.sendAction({
|
||||
"method": "setPortState",
|
||||
"UUID": widget.port.uuid,
|
||||
"stateData": {"mute": !widget.port.state.mute}
|
||||
});
|
||||
},
|
||||
icon: widget.port.state.mute
|
||||
height: 40,
|
||||
width: 40,
|
||||
child: IconButton.filledTonal(
|
||||
iconSize: 20,
|
||||
isSelected: widget.port.state.mute,
|
||||
onPressed: () {
|
||||
widget.sendAction({
|
||||
"method": "setPortState",
|
||||
"UUID": widget.port.uuid,
|
||||
"stateData": {"mute": !widget.port.state.mute}
|
||||
});
|
||||
},
|
||||
icon: widget.isOutput
|
||||
? (widget.port.state.mute
|
||||
? const Icon(Icons.volume_off_outlined)
|
||||
: const Icon(Icons.volume_up_outlined))
|
||||
: (widget.port.state.mute
|
||||
? const Icon(Icons.mic_off_outlined)
|
||||
: const Icon(Icons.mic_none_outlined))),
|
||||
: const Icon(Icons.mic_none_outlined)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
|
@ -13,8 +13,8 @@ class MixingTab extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MixingTabState extends State<MixingTab> {
|
||||
Widget buildCardGrid(
|
||||
List<mixer.Port> from, int cols, double cardGridAspectRatio) {
|
||||
Widget buildCardGrid(List<mixer.Port> from, int cols,
|
||||
double cardGridAspectRatio, bool isOutput) {
|
||||
return GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
@ -23,7 +23,11 @@ class _MixingTabState extends State<MixingTab> {
|
||||
mainAxisSpacing: 10,
|
||||
crossAxisSpacing: 10,
|
||||
children: from
|
||||
.map((p) => MixingCard(port: p, sendAction: widget.sendAction))
|
||||
.map((p) => MixingCard(
|
||||
port: p,
|
||||
sendAction: widget.sendAction,
|
||||
isOutput: isOutput,
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
@ -46,12 +50,12 @@ class _MixingTabState extends State<MixingTab> {
|
||||
Text("Inputs", style: Theme.of(context).textTheme.titleLarge),
|
||||
const SizedBox(height: 10),
|
||||
buildCardGrid(
|
||||
widget.mixerState.inputs, cols, cardGridAspectRatio),
|
||||
widget.mixerState.inputs, cols, cardGridAspectRatio, false),
|
||||
const SizedBox(height: 20),
|
||||
Text("Outputs", style: Theme.of(context).textTheme.titleLarge),
|
||||
const SizedBox(height: 10),
|
||||
buildCardGrid(
|
||||
widget.mixerState.outputs, cols, cardGridAspectRatio),
|
||||
widget.mixerState.outputs, cols, cardGridAspectRatio, true),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user