diff --git a/lib/shared/general/base/adaptive_text_field.dart b/lib/shared/general/base/adaptive_text_field.dart index de5df59f..4684493e 100644 --- a/lib/shared/general/base/adaptive_text_field.dart +++ b/lib/shared/general/base/adaptive_text_field.dart @@ -136,6 +136,27 @@ class BaseAdaptiveTextFieldState extends State { super.dispose(); } + List? _textInputFormatter() { + if (this.widget.inputFormatters != null) { + return this.widget.inputFormatters; + } + + if (this.widget.keyboardType == TextInputType.number) { + return [ + FilteringTextInputFormatter.digitsOnly, + ]; + } + + if (this.widget.keyboardType == + const TextInputType.numberWithOptions(decimal: true)) { + return [ + FilteringTextInputFormatter.deny(',', replacementString: '.'), + FilteringTextInputFormatter.allow(RegExp(r'^-?\d*\.?\d*')), + ]; + } + return null; + } + @override Widget build(BuildContext context) { return Column( @@ -148,7 +169,7 @@ class BaseAdaptiveTextFieldState extends State { cursorColor: Theme.of(context).textSelectionTheme.cursorColor, placeholder: this.widget.placeholder, keyboardType: this.widget.keyboardType, - inputFormatters: this.widget.inputFormatters ?? [], + inputFormatters: _textInputFormatter(), minLines: this.widget.minLines, maxLines: this.widget.maxLines ?? this.widget.minLines, autocorrect: this.widget.autocorrect, @@ -192,7 +213,7 @@ class BaseAdaptiveTextFieldState extends State { : null, ), keyboardType: this.widget.keyboardType, - inputFormatters: this.widget.inputFormatters ?? [], + inputFormatters: _textInputFormatter(), minLines: this.widget.minLines, maxLines: this.widget.maxLines ?? this.widget.minLines, autocorrect: this.widget.autocorrect, diff --git a/lib/shared/general/cupertino_dropdown.dart b/lib/shared/general/cupertino_dropdown.dart index e11889a8..38c95950 100644 --- a/lib/shared/general/cupertino_dropdown.dart +++ b/lib/shared/general/cupertino_dropdown.dart @@ -33,7 +33,7 @@ class CupertinoDropdown extends StatelessWidget { right: 2.0, ), child: DropdownButton( - underline: Container(), + underline: const SizedBox(), isExpanded: true, isDense: true, value: this.value, diff --git a/lib/shared/general/custom_expansion_tile.dart b/lib/shared/general/custom_expansion_tile.dart index 2e4e7ed9..16625b07 100644 --- a/lib/shared/general/custom_expansion_tile.dart +++ b/lib/shared/general/custom_expansion_tile.dart @@ -151,7 +151,7 @@ class _CustomExpansionTileState extends State ), ), ), - collapsed: Container(), + collapsed: const SizedBox(), expanded: this.widget.expandedBody, ), ); diff --git a/lib/stores/views/dashboard.dart b/lib/stores/views/dashboard.dart index 0ecd8bfa..33d595d1 100644 --- a/lib/stores/views/dashboard.dart +++ b/lib/stores/views/dashboard.dart @@ -549,7 +549,7 @@ abstract class _DashboardStore with Store { !defaultFilter.filterSettings.containsKey(key))); } - Filter _filterWithDefaults(Filter filter) { + Filter _populateFiltersWithDefaults(Filter filter) { try { final defaultFilterSettings = _defaultFilters .firstWhere( @@ -1642,11 +1642,13 @@ abstract class _DashboardStore with Store { /// default FilterSettings of these. List filters = [...sceneItem.filters]; - /// If this is the first time we fetch the current [Filter]s, we - /// can just add them since there are no default ones. + /// If this is the first time we fetch the current [Filter]s or we + /// have new ones or some were deleted, we can just add them since + /// there are no default ones. if (filters.length != responseFilters.length) { filters = []; - filters.addAll(responseFilters.map(_filterWithDefaults)); + filters + .addAll(responseFilters.map(_populateFiltersWithDefaults)); } else { /// We handle this case if this is a subsequent fetch and our /// [Filter]s are already populated. Here we need to make sure @@ -1746,7 +1748,9 @@ abstract class _DashboardStore with Store { this.currentSceneItems = ObservableList.of( this.currentSceneItems.map( (sceneItem) => sceneItem.copyWith( - filters: sceneItem.filters.map(_filterWithDefaults).toList(), + filters: sceneItem.filters + .map(_populateFiltersWithDefaults) + .toList(), ), ), ); diff --git a/lib/stores/views/statistics.dart b/lib/stores/views/statistics.dart index 77255694..15460ecb 100644 --- a/lib/stores/views/statistics.dart +++ b/lib/stores/views/statistics.dart @@ -139,7 +139,7 @@ abstract class _StatisticsStore with Store { this.excludeUnnamedStats = false; this.statType = StatType.All; this.durationFilter = null; - this.durationFilterAmount; + this.durationFilterAmount = null; this.durationFilterTimeUnit = TimeUnit.Minutes; /// Used as a toggle (only listen for change, not value) to exactly determine diff --git a/lib/tab_base.dart b/lib/tab_base.dart index 269c1a89..3239071c 100644 --- a/lib/tab_base.dart +++ b/lib/tab_base.dart @@ -99,7 +99,7 @@ class _TabBaseState extends State { TabsStore tabsStore = GetIt.instance(); return Scaffold( - body: Observer(builder: (_) { + body: Observer(builder: (context) { return WillPopScope( onWillPop: () { if (tabsStore.navigatorKeys[tabsStore.activeTab]!.currentState! @@ -131,7 +131,7 @@ class _TabBaseState extends State { }), extendBody: true, bottomNavigationBar: Observer( - builder: (_) => CupertinoTabBar( + builder: (context) => CupertinoTabBar( backgroundColor: !StylingHelper.isApple(context) ? CupertinoTheme.of(context).barBackgroundColor.withOpacity(1.0) : null, diff --git a/lib/views/dashboard/dashboard.dart b/lib/views/dashboard/dashboard.dart index cf61fb3e..9278dc82 100644 --- a/lib/views/dashboard/dashboard.dart +++ b/lib/views/dashboard/dashboard.dart @@ -134,7 +134,7 @@ class _DashboardViewState extends State { @override Widget build(BuildContext context) { return ThemedCupertinoScaffold( - body: Observer(builder: (_) { + body: Observer(builder: (context) { return Stack( alignment: Alignment.topCenter, children: [ diff --git a/lib/views/dashboard/widgets/obs_widgets/stats/stats.dart b/lib/views/dashboard/widgets/obs_widgets/stats/stats.dart index a030e1cc..99f29f15 100644 --- a/lib/views/dashboard/widgets/obs_widgets/stats/stats.dart +++ b/lib/views/dashboard/widgets/obs_widgets/stats/stats.dart @@ -46,7 +46,7 @@ class _StatsState extends State { ), ), Expanded( - child: Observer(builder: (_) { + child: Observer(builder: (context) { return PageView( controller: _pageController, children: [ diff --git a/lib/views/dashboard/widgets/scenes/exposed_controls/exposed_controls.dart b/lib/views/dashboard/widgets/scenes/exposed_controls/exposed_controls.dart index a4272d93..ff40bc8a 100644 --- a/lib/views/dashboard/widgets/scenes/exposed_controls/exposed_controls.dart +++ b/lib/views/dashboard/widgets/scenes/exposed_controls/exposed_controls.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:obs_blade/shared/general/base/card.dart'; +import 'package:obs_blade/shared/general/base/divider.dart'; +import 'package:obs_blade/shared/general/custom_expansion_tile.dart'; import 'package:obs_blade/shared/general/described_box.dart'; import 'package:obs_blade/views/dashboard/widgets/scenes/exposed_controls/hotkeys_control/hotkeys_control.dart'; import 'package:obs_blade/views/dashboard/widgets/scenes/exposed_controls/replay_buffer_controls.dart'; @@ -90,8 +92,23 @@ class ExposedControls extends StatelessWidget { return exposedControls.isNotEmpty ? BaseCard( bottomPadding: 0.0, - child: Column( - children: exposedControls, + paddingChild: const EdgeInsets.symmetric(vertical: 18.0), + child: CustomExpansionTile( + headerText: 'Exposed Controls', + headerPadding: const EdgeInsets.symmetric(horizontal: 18.0), + expandedBody: Column( + children: [ + const SizedBox(height: 18.0), + const BaseDivider(), + const SizedBox(height: 24.0), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 18.0), + child: Column( + children: exposedControls, + ), + ) + ], + ), ), ) : const SizedBox(); diff --git a/lib/views/dashboard/widgets/scenes/scene_buttons/scene_button.dart b/lib/views/dashboard/widgets/scenes/scene_buttons/scene_button.dart index 28598614..b2aeaa77 100644 --- a/lib/views/dashboard/widgets/scenes/scene_buttons/scene_button.dart +++ b/lib/views/dashboard/widgets/scenes/scene_buttons/scene_button.dart @@ -38,7 +38,7 @@ class SceneButton extends StatelessWidget { hiveKey: HiveKeys.Settings, rebuildKeys: const [SettingsKeys.ExposeStudioControls], builder: (context, settingsBox, child) => Observer( - builder: (_) => + builder: (context) => // GestureDetector( // onTap: () { // if (dashboardStore.editSceneVisibility) { diff --git a/lib/views/dashboard/widgets/scenes/scene_buttons/scene_buttons.dart b/lib/views/dashboard/widgets/scenes/scene_buttons/scene_buttons.dart index d8c25317..cf80afe8 100644 --- a/lib/views/dashboard/widgets/scenes/scene_buttons/scene_buttons.dart +++ b/lib/views/dashboard/widgets/scenes/scene_buttons/scene_buttons.dart @@ -29,7 +29,8 @@ class SceneButtons extends StatelessWidget { return HiveBuilder( hiveKey: HiveKeys.HiddenScene, - builder: (context, hiddenScenesBox, child) => Observer(builder: (_) { + builder: (context, hiddenScenesBox, child) => + Observer(builder: (context) { Iterable? visibleScenes = dashboardStore.scenes; List hiddenScenes = []; diff --git a/lib/views/dashboard/widgets/scenes/scene_content/audio_inputs/audio_inputs.dart b/lib/views/dashboard/widgets/scenes/scene_content/audio_inputs/audio_inputs.dart index 4e752277..a24a056c 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/audio_inputs/audio_inputs.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/audio_inputs/audio_inputs.dart @@ -28,7 +28,7 @@ class _AudioInputsState extends State DashboardStore dashboardStore = GetIt.instance(); return Observer( - builder: (_) => NestedScrollManager( + builder: (context) => NestedScrollManager( parentScrollController: ModalRoute.of(context)!.settings.arguments as ScrollController, child: Scrollbar( diff --git a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/dynamic_input.dart b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/dynamic_input.dart index 21221742..3a7661da 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/dynamic_input.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/dynamic_input.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:obs_blade/shared/general/base/adaptive_switch.dart'; import 'package:obs_blade/shared/general/base/adaptive_text_field.dart'; +import 'package:obs_blade/shared/general/keyboard_number_header.dart'; enum InputType { Int, @@ -75,22 +76,28 @@ class _DynamicInputState extends State { width: 102.0, alignment: Alignment.centerRight, child: switch (_type) { - InputType.Int => BaseAdaptiveTextField( + InputType.Int => KeyboardNumberHeader( focusNode: _focusNode, - controller: _controller, - keyboardType: TextInputType.number, - onChanged: (value) => int.tryParse(value) != null - ? this.widget.onUpdate?.call(int.parse(value)) - : null, + child: BaseAdaptiveTextField( + focusNode: _focusNode, + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) => int.tryParse(value) != null + ? this.widget.onUpdate?.call(int.parse(value)) + : null, + ), ), - InputType.Double => BaseAdaptiveTextField( + InputType.Double => KeyboardNumberHeader( focusNode: _focusNode, - controller: _controller, - keyboardType: - const TextInputType.numberWithOptions(decimal: true), - onChanged: (value) => double.tryParse(value) != null - ? this.widget.onUpdate?.call(double.parse(value)) - : null, + child: BaseAdaptiveTextField( + focusNode: _focusNode, + controller: _controller, + keyboardType: + const TextInputType.numberWithOptions(decimal: true), + onChanged: (value) => double.tryParse(value) != null + ? this.widget.onUpdate?.call(double.parse(value)) + : null, + ), ), InputType.Bool => BaseAdaptiveSwitch( value: this.widget.value, diff --git a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/filter_list.dart b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/filter_list.dart index ef82625f..e97bab28 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/filter_list.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/filter_list/filter_list.dart @@ -102,7 +102,7 @@ class _FilterListState extends State { child: Scrollbar( child: ListView( padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom + 12.0, + bottom: MediaQuery.paddingOf(context).bottom + 24.0, ), children: sceneItem.filters .map( diff --git a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/scene_items.dart b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/scene_items.dart index 98a1d8b5..6eb8f53f 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/scene_items/scene_items.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/scene_items/scene_items.dart @@ -27,7 +27,7 @@ class _SceneItemsState extends State super.build(context); DashboardStore dashboardStore = GetIt.instance(); - return Observer(builder: (_) { + return Observer(builder: (context) { return NestedScrollManager( parentScrollController: ModalRoute.of(context)!.settings.arguments as ScrollController, diff --git a/lib/views/dashboard/widgets/scenes/scene_content/visibility_edit_toggle.dart b/lib/views/dashboard/widgets/scenes/scene_content/visibility_edit_toggle.dart index 908ea2ee..4f3c63f3 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/visibility_edit_toggle.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/visibility_edit_toggle.dart @@ -41,7 +41,7 @@ class VisibilityEditToggle extends StatelessWidget { }; Widget editButton = Observer( - builder: (_) => ThemedCupertinoButton( + builder: (context) => ThemedCupertinoButton( text: (this.sceneItemType == SceneItemType.Source ? dashboardStore.editSceneItemVisibility : dashboardStore.editAudioVisibility) diff --git a/lib/views/dashboard/widgets/scenes/scene_content/visibility_slide_wrapper.dart b/lib/views/dashboard/widgets/scenes/scene_content/visibility_slide_wrapper.dart index 56d2f556..e2faa0ba 100644 --- a/lib/views/dashboard/widgets/scenes/scene_content/visibility_slide_wrapper.dart +++ b/lib/views/dashboard/widgets/scenes/scene_content/visibility_slide_wrapper.dart @@ -120,7 +120,7 @@ class _VisibilitySlideWrapperState extends State { } return Observer( - builder: (_) => Offstage( + builder: (context) => Offstage( offstage: _isItemHidden( dashboardStore, hiddenSceneItemsBox, hiddenSceneItem), child: Slidable( diff --git a/lib/views/dashboard/widgets/scenes/scene_preview/scene_preview.dart b/lib/views/dashboard/widgets/scenes/scene_preview/scene_preview.dart index 9b43edb1..caf5e949 100644 --- a/lib/views/dashboard/widgets/scenes/scene_preview/scene_preview.dart +++ b/lib/views/dashboard/widgets/scenes/scene_preview/scene_preview.dart @@ -78,7 +78,7 @@ class _ScenePreviewState extends State { child: Padding( padding: const EdgeInsets.all(12.0), child: Observer( - builder: (_) => Stack( + builder: (context) => Stack( children: [ if (dashboardStore.scenePreviewImageBytes != null) Column( diff --git a/lib/views/dashboard/widgets/scenes/studio_mode_transition_button.dart b/lib/views/dashboard/widgets/scenes/studio_mode_transition_button.dart index e3961f12..0a9dea69 100644 --- a/lib/views/dashboard/widgets/scenes/studio_mode_transition_button.dart +++ b/lib/views/dashboard/widgets/scenes/studio_mode_transition_button.dart @@ -1,4 +1,5 @@ import 'package:flutter/cupertino.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:get_it/get_it.dart'; import 'package:obs_blade/shared/general/hive_builder.dart'; import 'package:obs_blade/stores/views/dashboard.dart'; @@ -23,53 +24,57 @@ class StudioModeTransitionButton extends StatelessWidget { SettingsKeys.ExposeStudioControls, ], builder: (context, settingsBox, child) { - return AnimatedSwitcher( - duration: const Duration(milliseconds: 200), - transitionBuilder: (child, animation) => FadeTransition( - opacity: CurvedAnimation( - parent: animation, - curve: const Interval( - 0.4, - 1.0, - curve: Curves.easeInQuad, - ), - reverseCurve: Curves.easeOutQuad, - ), - child: SizeTransition( - sizeFactor: CurvedAnimation( + return Observer( + builder: (context) => AnimatedSwitcher( + duration: const Duration(milliseconds: 200), + transitionBuilder: (child, animation) => FadeTransition( + opacity: CurvedAnimation( parent: animation, - curve: Curves.easeInQuad, + curve: const Interval( + 0.4, + 1.0, + curve: Curves.easeInQuad, + ), reverseCurve: Curves.easeOutQuad, ), - child: child, + child: SizeTransition( + sizeFactor: CurvedAnimation( + parent: animation, + curve: Curves.easeInQuad, + reverseCurve: Curves.easeOutQuad, + ), + child: child, + ), ), - ), - child: (settingsBox.get(SettingsKeys.ExposeStudioControls.name, - defaultValue: false) && - dashboardStore.studioMode) - ? Align( - alignment: Alignment.center, - child: SizedBox( - width: 128.0, - child: BaseButton( - text: 'Transition', - secondary: true, - onPressed: () { - dashboardStore.setActiveSceneName( - dashboardStore.studioModePreviewSceneName!); - NetworkHelper.makeRequest( - GetIt.instance().activeSession!.socket, - RequestType.SetCurrentProgramScene, - { - 'sceneName': - dashboardStore.studioModePreviewSceneName - }, - ); - }, + child: (settingsBox.get(SettingsKeys.ExposeStudioControls.name, + defaultValue: false) && + dashboardStore.studioMode) + ? Align( + alignment: Alignment.center, + child: SizedBox( + width: 128.0, + child: BaseButton( + text: 'Transition', + secondary: true, + onPressed: () { + dashboardStore.setActiveSceneName( + dashboardStore.studioModePreviewSceneName!); + NetworkHelper.makeRequest( + GetIt.instance() + .activeSession! + .socket, + RequestType.SetCurrentProgramScene, + { + 'sceneName': + dashboardStore.studioModePreviewSceneName + }, + ); + }, + ), ), - ), - ) - : const SizedBox(), + ) + : const SizedBox(), + ), ); }, ); diff --git a/lib/views/dashboard/widgets/scenes/transition_controls.dart b/lib/views/dashboard/widgets/scenes/transition_controls.dart index 10f52270..b38e3d36 100644 --- a/lib/views/dashboard/widgets/scenes/transition_controls.dart +++ b/lib/views/dashboard/widgets/scenes/transition_controls.dart @@ -28,7 +28,7 @@ class TransitionControls extends StatelessWidget { Widget build(BuildContext context) { DashboardStore dashboardStore = GetIt.instance(); - return Observer(builder: (_) { + return Observer(builder: (context) { TextEditingController controller = TextEditingController( text: dashboardStore.currentTransition?.transitionDuration ?.toString() ?? diff --git a/lib/views/dashboard/widgets/status_app_bar/general_actions.dart b/lib/views/dashboard/widgets/status_app_bar/general_actions.dart index 0fb4c1a6..f793f5ca 100644 --- a/lib/views/dashboard/widgets/status_app_bar/general_actions.dart +++ b/lib/views/dashboard/widgets/status_app_bar/general_actions.dart @@ -45,7 +45,7 @@ class GeneralActions extends StatelessWidget { SettingsKeys.DontShowStreamStopMessage, ], builder: (context, settingsBox, child) => Observer( - builder: (_) => AppBarActions( + builder: (context) => AppBarActions( actions: [ if (!settingsBox.get(SettingsKeys.ExposeStreamingControls.name, defaultValue: false)) diff --git a/lib/views/dashboard/widgets/status_app_bar/status_app_bar.dart b/lib/views/dashboard/widgets/status_app_bar/status_app_bar.dart index 650cb259..c479636f 100644 --- a/lib/views/dashboard/widgets/status_app_bar/status_app_bar.dart +++ b/lib/views/dashboard/widgets/status_app_bar/status_app_bar.dart @@ -80,7 +80,7 @@ class StatusAppBar extends StatelessWidget { ), Padding( padding: const EdgeInsets.only(top: 2.0, bottom: 2.0), - child: Observer(builder: (_) { + child: Observer(builder: (context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/views/home/widgets/connect_box/connect_box.dart b/lib/views/home/widgets/connect_box/connect_box.dart index 0a8cd9f5..c8806fca 100644 --- a/lib/views/home/widgets/connect_box/connect_box.dart +++ b/lib/views/home/widgets/connect_box/connect_box.dart @@ -17,7 +17,7 @@ class ConnectBox extends StatelessWidget { HomeStore homeStore = GetIt.instance(); return Observer( - builder: (_) => SwitcherCard( + builder: (context) => SwitcherCard( title: homeStore.connectMode.text, child: () { switch (homeStore.connectMode) { diff --git a/lib/views/home/widgets/saved_connections/saved_connections.dart b/lib/views/home/widgets/saved_connections/saved_connections.dart index cc787970..a7eb20bd 100644 --- a/lib/views/home/widgets/saved_connections/saved_connections.dart +++ b/lib/views/home/widgets/saved_connections/saved_connections.dart @@ -81,7 +81,7 @@ class SavedConnections extends StatelessWidget { )), ); // return Observer( - // builder: (_) => FutureBuilder>( + // builder: (context) => FutureBuilder>( // future: // GetIt.instance().autodiscoverConnections, // builder: (context, snapshot) { diff --git a/lib/views/intro/widgets/intro_slides/slide_controls.dart b/lib/views/intro/widgets/intro_slides/slide_controls.dart index 8b95c50f..4df4eb97 100644 --- a/lib/views/intro/widgets/intro_slides/slide_controls.dart +++ b/lib/views/intro/widgets/intro_slides/slide_controls.dart @@ -72,7 +72,7 @@ class _SlideControlsState extends State { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Observer(builder: (_) { + Observer(builder: (context) { return SizedBox( height: 52.0, width: 52.0, @@ -114,7 +114,7 @@ class _SlideControlsState extends State { ), count: this.widget.amountChildren, ), - Observer(builder: (_) { + Observer(builder: (context) { return SizedBox( height: 52.0, width: 52.0, diff --git a/lib/views/settings/custom_theme/widgets/add_edit_theme/theme_loader.dart b/lib/views/settings/custom_theme/widgets/add_edit_theme/theme_loader.dart index 84b7decc..3dccba22 100644 --- a/lib/views/settings/custom_theme/widgets/add_edit_theme/theme_loader.dart +++ b/lib/views/settings/custom_theme/widgets/add_edit_theme/theme_loader.dart @@ -63,7 +63,7 @@ class _ThemeLoaderState extends State { ), ) .toList(), - selectedItemBuilder: (_) => _availableThemes + selectedItemBuilder: (context) => _availableThemes .map( (theme) => Text( theme.name ?? 'OBS Blade Base', diff --git a/lib/views/settings/logs/log_detail/log_detail.dart b/lib/views/settings/logs/log_detail/log_detail.dart index bf7c7d84..8c76766b 100644 --- a/lib/views/settings/logs/log_detail/log_detail.dart +++ b/lib/views/settings/logs/log_detail/log_detail.dart @@ -102,7 +102,7 @@ class LogDetailView extends StatelessWidget { body: HiveBuilder( hiveKey: HiveKeys.AppLog, builder: (context, appLogBox, child) => Observer( - builder: (_) { + builder: (context) { Map> mergedLogs = {}; List.from(appLogBox.values) diff --git a/lib/views/settings/logs/widgets/log_filter.dart b/lib/views/settings/logs/widgets/log_filter.dart index 31609ba3..487d9deb 100644 --- a/lib/views/settings/logs/widgets/log_filter.dart +++ b/lib/views/settings/logs/widgets/log_filter.dart @@ -19,7 +19,7 @@ class LogFilter extends StatelessWidget { return BaseCard( bottomPadding: 12.0, child: Observer( - builder: (_) { + builder: (context) { return Column( children: [ DateRange( diff --git a/lib/views/settings/logs/widgets/log_grid/log_list.dart b/lib/views/settings/logs/widgets/log_grid/log_list.dart index 5e132ed5..2190ac05 100644 --- a/lib/views/settings/logs/widgets/log_grid/log_list.dart +++ b/lib/views/settings/logs/widgets/log_grid/log_list.dart @@ -25,7 +25,7 @@ class LogList extends StatelessWidget { child: HiveBuilder( hiveKey: HiveKeys.AppLog, builder: (context, appLogBox, child) { - return Observer(builder: (_) { + return Observer(builder: (context) { List datesMSWithLogs = []; Iterable filteredOrderedLogs = diff --git a/lib/views/settings/widgets/support_dialog/blacksmith_content/blacksmith_content.dart b/lib/views/settings/widgets/support_dialog/blacksmith_content/blacksmith_content.dart index 504f45f0..bcfecdfd 100644 --- a/lib/views/settings/widgets/support_dialog/blacksmith_content/blacksmith_content.dart +++ b/lib/views/settings/widgets/support_dialog/blacksmith_content/blacksmith_content.dart @@ -51,7 +51,7 @@ class BlacksmithContent extends StatelessWidget { HiveBuilder( hiveKey: HiveKeys.Settings, rebuildKeys: const [SettingsKeys.BoughtBlacksmith], - builder: (_, settingsBox, child) { + builder: (context, settingsBox, child) { if (!settingsBox.get( SettingsKeys.BoughtBlacksmith.name, defaultValue: false, diff --git a/lib/views/statistics/statistics.dart b/lib/views/statistics/statistics.dart index d495b3bf..a917a1df 100644 --- a/lib/views/statistics/statistics.dart +++ b/lib/views/statistics/statistics.dart @@ -288,7 +288,7 @@ class _StatisticsViewState extends State { ), paddingChild: const EdgeInsets.all(0), child: Observer( - builder: (_) { + builder: (context) { /// Only purpose of this line is to omit the debug message of /// missing observable (which is not correct) since I pass the /// store to internal functions to handle sort and filter where diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/amount_entries_control.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/amount_entries_control.dart index 0018ba23..0fc71392 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/amount_entries_control.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/amount_entries_control.dart @@ -14,7 +14,7 @@ class AmountEntriesControl extends StatelessWidget { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => SizedBox( + builder: (context) => SizedBox( width: double.infinity, child: CupertinoSlidingSegmentedControl( groupValue: statisticsStore.amountStatisticEntries, diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/exclude_unnamed_checkbox.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/exclude_unnamed_checkbox.dart index 6eb89315..6ac98a4e 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/exclude_unnamed_checkbox.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/exclude_unnamed_checkbox.dart @@ -16,7 +16,7 @@ class ExcludeUnnamedCheckbox extends StatelessWidget { return Transform.translate( offset: const Offset(-12.0, 0.0), child: Observer( - builder: (_) => BaseCheckbox( + builder: (context) => BaseCheckbox( value: statisticsStore.excludeUnnamedStats, text: 'Exclude unnamed entries', tristate: true, diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/favorite_control.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/favorite_control.dart index 7c0f1fb8..90c19171 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/favorite_control.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/favorite_control.dart @@ -13,7 +13,7 @@ class FavoriteControl extends StatelessWidget { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => SizedBox( + builder: (context) => SizedBox( width: double.infinity, child: CupertinoSlidingSegmentedControl( groupValue: statisticsStore.showOnlyFavorites ?? 'null', diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_duration.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_duration.dart index cbdbc36d..e28172eb 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_duration.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_duration.dart @@ -67,7 +67,7 @@ class _FilterDurationState extends State { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => Row( + builder: (context) => Row( children: [ SizedBox( width: 142.0, diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_name.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_name.dart index 6bd0b46e..d598261e 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_name.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_name.dart @@ -1,14 +1,43 @@ import 'package:flutter/cupertino.dart'; import 'package:get_it/get_it.dart'; +import 'package:mobx/mobx.dart'; import '../../../../../stores/views/statistics.dart'; -class FilterName extends StatelessWidget { +class FilterName extends StatefulWidget { const FilterName({Key? key}) : super(key: key); + @override + State createState() => _FilterNameState(); +} + +class _FilterNameState extends State { + final List _d = []; + final TextEditingController _controller = TextEditingController(); + + @override + void initState() { + super.initState(); + + _d.add(reaction( + (_) => GetIt.instance().triggeredDefault, + (__) => _controller.clear(), + )); + } + + @override + void dispose() { + for (final d in _d) { + d(); + } + + super.dispose(); + } + @override Widget build(BuildContext context) { return CupertinoTextField( + controller: _controller, placeholder: 'Filter by name...', clearButtonMode: OverlayVisibilityMode.always, onChanged: (name) => GetIt.instance().setFilterName( diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_status.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_status.dart index d5140ab1..abb737ec 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_status.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/filter_status.dart @@ -12,7 +12,7 @@ class FilterStatus extends StatelessWidget { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => TagBox( + builder: (context) => TagBox( color: statisticsStore.isFilterSortActive ? Theme.of(context).colorScheme.secondary : Theme.of(context).scaffoldBackgroundColor, diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/order_row.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/order_row.dart index bb7caef4..8e1c0771 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/order_row.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/order_row.dart @@ -19,8 +19,9 @@ class OrderRow extends StatelessWidget { Widget build(BuildContext context) { StatisticsStore statisticsStore = GetIt.instance(); - return Observer( - builder: (_) => Row( + return Observer(builder: (context) { + statisticsStore.triggeredDefault; + return Row( children: [ Expanded( child: CupertinoDropdown( @@ -46,7 +47,7 @@ class OrderRow extends StatelessWidget { ), ), ], - ), - ); + ); + }); } } diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/stat_type_control.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/stat_type_control.dart index 3ffa1c3b..0c75c7d0 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/stat_type_control.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/stat_type_control.dart @@ -12,7 +12,7 @@ class StatTypeControl extends StatelessWidget { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => SizedBox( + builder: (context) => SizedBox( width: double.infinity, child: CupertinoSlidingSegmentedControl( groupValue: statisticsStore.statType, diff --git a/lib/views/statistics/widgets/card_header/sort_filter_panel/statistics_date_range.dart b/lib/views/statistics/widgets/card_header/sort_filter_panel/statistics_date_range.dart index 12141086..1b5afad8 100644 --- a/lib/views/statistics/widgets/card_header/sort_filter_panel/statistics_date_range.dart +++ b/lib/views/statistics/widgets/card_header/sort_filter_panel/statistics_date_range.dart @@ -13,7 +13,7 @@ class StatisticsDateRange extends StatelessWidget { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) => DateRange( + builder: (context) => DateRange( selectedFromDate: statisticsStore.fromDate, updateFromDate: (date) => statisticsStore.setFromDate(date), selectedToDate: statisticsStore.toDate, diff --git a/lib/views/statistics/widgets/paginated_statistics/paginated_statistics.dart b/lib/views/statistics/widgets/paginated_statistics/paginated_statistics.dart index c8d850ba..e52dd206 100644 --- a/lib/views/statistics/widgets/paginated_statistics/paginated_statistics.dart +++ b/lib/views/statistics/widgets/paginated_statistics/paginated_statistics.dart @@ -34,7 +34,7 @@ class _PaginatedStatisticsState extends State { StatisticsStore statisticsStore = GetIt.instance(); return Observer( - builder: (_) { + builder: (context) { int amountPages = _getMaxPages(statisticsStore.amountStatisticEntries.number); if (_page > amountPages) {