-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(filters): toggle filters now possible and some minor layout u…
…pdates
- Loading branch information
Showing
12 changed files
with
167 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
lib/types/classes/stream/events/source_filter_enable_state_changed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'base.dart'; | ||
|
||
/// A source filter's enable state has changed. | ||
class SourceFilterEnableStateChangedEvent extends BaseEvent { | ||
SourceFilterEnableStateChangedEvent(super.json); | ||
|
||
/// Name of the source the filter is on | ||
String get sourceName => this.json['sourceName']; | ||
|
||
/// Name of the filter | ||
String get filterName => this.json['filterName']; | ||
|
||
/// Whether the filter is enabled | ||
bool get filterEnabled => this.json['filterEnabled']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_mobx/flutter_mobx.dart'; | ||
import 'package:get_it/get_it.dart'; | ||
import 'package:obs_blade/shared/general/base/divider.dart'; | ||
import 'package:obs_blade/stores/shared/network.dart'; | ||
import 'package:obs_blade/stores/views/dashboard.dart'; | ||
import 'package:obs_blade/types/classes/api/scene_item.dart'; | ||
import 'package:obs_blade/types/enums/request_type.dart'; | ||
import 'package:obs_blade/utils/network_helper.dart'; | ||
|
||
class FilterList extends StatelessWidget { | ||
final SceneItem sceneItem; | ||
|
||
const FilterList({ | ||
super.key, | ||
required this.sceneItem, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
DashboardStore dashboardStore = GetIt.instance<DashboardStore>(); | ||
|
||
return Observer(builder: (context) { | ||
/// Hacky approach... this widget will be displayed in a | ||
/// CupertinoModalBottomSheet which will be provided the [SceneItem] | ||
/// which filters we are editing. When we update the filters, the | ||
/// underlying [SceneItem] is updated but not a new one is provided | ||
/// here in the widget since it's being called imperatively... | ||
late SceneItem sceneItem; | ||
try { | ||
sceneItem = dashboardStore.currentSceneItems.firstWhere( | ||
(sceneItem) => sceneItem.sceneItemId == sceneItem.sceneItemId, | ||
); | ||
} catch (_) { | ||
Navigator.of(context).pop(); | ||
} | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 24.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
'Filters', | ||
style: Theme.of(context).textTheme.headlineSmall, | ||
), | ||
Text( | ||
sceneItem.sourceName!, | ||
style: Theme.of(context).textTheme.bodySmall, | ||
), | ||
const SizedBox(height: 12.0), | ||
const Text( | ||
'List of filters which are attached to the selected scene item.'), | ||
const SizedBox(height: 24.0), | ||
const BaseDivider(), | ||
Expanded( | ||
child: Scrollbar( | ||
child: ListView.builder( | ||
padding: EdgeInsets.only( | ||
bottom: MediaQuery.paddingOf(context).bottom + 12.0, | ||
), | ||
itemCount: sceneItem.filters?.length ?? 0, | ||
itemBuilder: (context, index) => ListTile( | ||
contentPadding: const EdgeInsets.all(0), | ||
title: Text(sceneItem.filters![index].filterName), | ||
trailing: IconButton( | ||
onPressed: () => NetworkHelper.makeRequest( | ||
GetIt.instance<NetworkStore>().activeSession!.socket, | ||
RequestType.SetSourceFilterEnabled, | ||
{ | ||
'sourceName': sceneItem.sourceName, | ||
'filterName': sceneItem.filters![index].filterName, | ||
'filterEnabled': | ||
!sceneItem.filters![index].filterEnabled, | ||
}, | ||
), | ||
icon: Icon( | ||
sceneItem.filters![index].filterEnabled | ||
? Icons.visibility | ||
: Icons.visibility_off, | ||
color: sceneItem.filters![index].filterEnabled | ||
? Theme.of(context).buttonTheme.colorScheme!.primary | ||
: CupertinoColors.destructiveRed, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
lib/views/dashboard/widgets/scenes/studio_mode_transition_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters