Skip to content

Commit 1551186

Browse files
committed
chore(cleanup): some context adjustments
1 parent b414ebf commit 1551186

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+190
-105
lines changed

lib/shared/general/base/adaptive_text_field.dart

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,27 @@ class BaseAdaptiveTextFieldState extends State<BaseAdaptiveTextField> {
136136
super.dispose();
137137
}
138138

139+
List<TextInputFormatter>? _textInputFormatter() {
140+
if (this.widget.inputFormatters != null) {
141+
return this.widget.inputFormatters;
142+
}
143+
144+
if (this.widget.keyboardType == TextInputType.number) {
145+
return [
146+
FilteringTextInputFormatter.digitsOnly,
147+
];
148+
}
149+
150+
if (this.widget.keyboardType ==
151+
const TextInputType.numberWithOptions(decimal: true)) {
152+
return [
153+
FilteringTextInputFormatter.deny(',', replacementString: '.'),
154+
FilteringTextInputFormatter.allow(RegExp(r'^-?\d*\.?\d*')),
155+
];
156+
}
157+
return null;
158+
}
159+
139160
@override
140161
Widget build(BuildContext context) {
141162
return Column(
@@ -148,7 +169,7 @@ class BaseAdaptiveTextFieldState extends State<BaseAdaptiveTextField> {
148169
cursorColor: Theme.of(context).textSelectionTheme.cursorColor,
149170
placeholder: this.widget.placeholder,
150171
keyboardType: this.widget.keyboardType,
151-
inputFormatters: this.widget.inputFormatters ?? [],
172+
inputFormatters: _textInputFormatter(),
152173
minLines: this.widget.minLines,
153174
maxLines: this.widget.maxLines ?? this.widget.minLines,
154175
autocorrect: this.widget.autocorrect,
@@ -192,7 +213,7 @@ class BaseAdaptiveTextFieldState extends State<BaseAdaptiveTextField> {
192213
: null,
193214
),
194215
keyboardType: this.widget.keyboardType,
195-
inputFormatters: this.widget.inputFormatters ?? [],
216+
inputFormatters: _textInputFormatter(),
196217
minLines: this.widget.minLines,
197218
maxLines: this.widget.maxLines ?? this.widget.minLines,
198219
autocorrect: this.widget.autocorrect,

lib/shared/general/cupertino_dropdown.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CupertinoDropdown<T> extends StatelessWidget {
3333
right: 2.0,
3434
),
3535
child: DropdownButton<T>(
36-
underline: Container(),
36+
underline: const SizedBox(),
3737
isExpanded: true,
3838
isDense: true,
3939
value: this.value,

lib/shared/general/custom_expansion_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class _CustomExpansionTileState extends State<CustomExpansionTile>
151151
),
152152
),
153153
),
154-
collapsed: Container(),
154+
collapsed: const SizedBox(),
155155
expanded: this.widget.expandedBody,
156156
),
157157
);

lib/stores/views/dashboard.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ abstract class _DashboardStore with Store {
549549
!defaultFilter.filterSettings.containsKey(key)));
550550
}
551551

552-
Filter _filterWithDefaults(Filter filter) {
552+
Filter _populateFiltersWithDefaults(Filter filter) {
553553
try {
554554
final defaultFilterSettings = _defaultFilters
555555
.firstWhere(
@@ -1642,11 +1642,13 @@ abstract class _DashboardStore with Store {
16421642
/// default FilterSettings of these.
16431643
List<Filter> filters = [...sceneItem.filters];
16441644

1645-
/// If this is the first time we fetch the current [Filter]s, we
1646-
/// can just add them since there are no default ones.
1645+
/// If this is the first time we fetch the current [Filter]s or we
1646+
/// have new ones or some were deleted, we can just add them since
1647+
/// there are no default ones.
16471648
if (filters.length != responseFilters.length) {
16481649
filters = [];
1649-
filters.addAll(responseFilters.map(_filterWithDefaults));
1650+
filters
1651+
.addAll(responseFilters.map(_populateFiltersWithDefaults));
16501652
} else {
16511653
/// We handle this case if this is a subsequent fetch and our
16521654
/// [Filter]s are already populated. Here we need to make sure
@@ -1746,7 +1748,9 @@ abstract class _DashboardStore with Store {
17461748
this.currentSceneItems = ObservableList.of(
17471749
this.currentSceneItems.map(
17481750
(sceneItem) => sceneItem.copyWith(
1749-
filters: sceneItem.filters.map(_filterWithDefaults).toList(),
1751+
filters: sceneItem.filters
1752+
.map(_populateFiltersWithDefaults)
1753+
.toList(),
17501754
),
17511755
),
17521756
);

lib/stores/views/statistics.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ abstract class _StatisticsStore with Store {
139139
this.excludeUnnamedStats = false;
140140
this.statType = StatType.All;
141141
this.durationFilter = null;
142-
this.durationFilterAmount;
142+
this.durationFilterAmount = null;
143143
this.durationFilterTimeUnit = TimeUnit.Minutes;
144144

145145
/// Used as a toggle (only listen for change, not value) to exactly determine

lib/tab_base.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _TabBaseState extends State<TabBase> {
9999
TabsStore tabsStore = GetIt.instance<TabsStore>();
100100

101101
return Scaffold(
102-
body: Observer(builder: (_) {
102+
body: Observer(builder: (context) {
103103
return WillPopScope(
104104
onWillPop: () {
105105
if (tabsStore.navigatorKeys[tabsStore.activeTab]!.currentState!
@@ -131,7 +131,7 @@ class _TabBaseState extends State<TabBase> {
131131
}),
132132
extendBody: true,
133133
bottomNavigationBar: Observer(
134-
builder: (_) => CupertinoTabBar(
134+
builder: (context) => CupertinoTabBar(
135135
backgroundColor: !StylingHelper.isApple(context)
136136
? CupertinoTheme.of(context).barBackgroundColor.withOpacity(1.0)
137137
: null,

lib/views/dashboard/dashboard.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class _DashboardViewState extends State<DashboardView> {
134134
@override
135135
Widget build(BuildContext context) {
136136
return ThemedCupertinoScaffold(
137-
body: Observer(builder: (_) {
137+
body: Observer(builder: (context) {
138138
return Stack(
139139
alignment: Alignment.topCenter,
140140
children: [

lib/views/dashboard/widgets/obs_widgets/stats/stats.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class _StatsState extends State<Stats> {
4646
),
4747
),
4848
Expanded(
49-
child: Observer(builder: (_) {
49+
child: Observer(builder: (context) {
5050
return PageView(
5151
controller: _pageController,
5252
children: <Widget>[

lib/views/dashboard/widgets/scenes/exposed_controls/exposed_controls.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:obs_blade/shared/general/base/card.dart';
3+
import 'package:obs_blade/shared/general/base/divider.dart';
4+
import 'package:obs_blade/shared/general/custom_expansion_tile.dart';
35
import 'package:obs_blade/shared/general/described_box.dart';
46
import 'package:obs_blade/views/dashboard/widgets/scenes/exposed_controls/hotkeys_control/hotkeys_control.dart';
57
import 'package:obs_blade/views/dashboard/widgets/scenes/exposed_controls/replay_buffer_controls.dart';
@@ -90,8 +92,23 @@ class ExposedControls extends StatelessWidget {
9092
return exposedControls.isNotEmpty
9193
? BaseCard(
9294
bottomPadding: 0.0,
93-
child: Column(
94-
children: exposedControls,
95+
paddingChild: const EdgeInsets.symmetric(vertical: 18.0),
96+
child: CustomExpansionTile(
97+
headerText: 'Exposed Controls',
98+
headerPadding: const EdgeInsets.symmetric(horizontal: 18.0),
99+
expandedBody: Column(
100+
children: [
101+
const SizedBox(height: 18.0),
102+
const BaseDivider(),
103+
const SizedBox(height: 24.0),
104+
Padding(
105+
padding: const EdgeInsets.symmetric(horizontal: 18.0),
106+
child: Column(
107+
children: exposedControls,
108+
),
109+
)
110+
],
111+
),
95112
),
96113
)
97114
: const SizedBox();

lib/views/dashboard/widgets/scenes/scene_buttons/scene_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SceneButton extends StatelessWidget {
3838
hiveKey: HiveKeys.Settings,
3939
rebuildKeys: const [SettingsKeys.ExposeStudioControls],
4040
builder: (context, settingsBox, child) => Observer(
41-
builder: (_) =>
41+
builder: (context) =>
4242
// GestureDetector(
4343
// onTap: () {
4444
// if (dashboardStore.editSceneVisibility) {

0 commit comments

Comments
 (0)