Skip to content

Commit

Permalink
fix: remove focus color in input decoration editor (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeshuaro committed Dec 6, 2021
1 parent d39a15b commit 63708e5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 70 deletions.
7 changes: 0 additions & 7 deletions lib/advanced_theme/cubit/input_decoration_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ extension InputDecorationCubit on AdvancedThemeCubit {
_emitStateWithIconTheme(theme);
}

void inputDecorationFocusColorChanged(Color color) {
final theme = state.themeData.inputDecorationTheme.copyWith(
focusColor: color,
);
_emitStateWithIconTheme(theme);
}

void inputDecorationHoverColorChanged(Color color) {
final theme = state.themeData.inputDecorationTheme.copyWith(
hoverColor: color,
Expand Down
26 changes: 0 additions & 26 deletions lib/advanced_theme/views/input_decoration_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class InputDecorationEditor extends ExpansionPanelItem {
children: [
_FloatingLabelBehaviorDropdown(),
_FillColorPicker(),
_FocusColorPicker(),
_HoverColorPicker(),
_AlignLabelWithHintSwitch(),
_FilledSwitch(),
Expand Down Expand Up @@ -83,31 +82,6 @@ class _FillColorPicker extends StatelessWidget {
}
}

class _FocusColorPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<AdvancedThemeCubit, AdvancedThemeState>(
buildWhen: (previous, current) {
return previous.themeData.inputDecorationTheme.focusColor !=
current.themeData.inputDecorationTheme.focusColor;
},
builder: (context, state) {
return ColorListTile(
key: const Key('inputDecorationEditor_focusColorPicker'),
title: 'Focus Color',
color: state.themeData.inputDecorationTheme.focusColor ??
state.themeData.focusColor,
onColorChanged: (color) {
context
.read<AdvancedThemeCubit>()
.inputDecorationFocusColorChanged(color);
},
);
},
);
}
}

class _HoverColorPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
Expand Down
16 changes: 0 additions & 16 deletions test/advanced_theme/cubit/input_decoration_cubit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@ void main() {
);
});

group('inputDecorationFocusColorChanged', () {
final color = getRandomColor();
final theme = ThemeData(
inputDecorationTheme: InputDecorationTheme(
focusColor: color,
),
);

blocTest<AdvancedThemeCubit, AdvancedThemeState>(
'emits input decoration focus color',
build: () => cubit,
act: (cubit) => cubit.inputDecorationFocusColorChanged(color),
expect: () => [AdvancedThemeState(themeData: theme)],
);
});

group('inputDecorationHoverColorChanged', () {
final color = getRandomColor();
final theme = ThemeData(
Expand Down
21 changes: 0 additions & 21 deletions test/advanced_theme/views/input_decoration_editor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,6 @@ void main() {
},
);

testWidgets(
'focus color picker should update with color',
(tester) async {
final color = getRandomColor();
final state = AdvancedThemeState(
themeData: ThemeData(
inputDecorationTheme: InputDecorationTheme(focusColor: color),
),
);

await _pumpApp(tester, state);

await widgetTesters.checkColorPicker(
tester,
'inputDecorationEditor_focusColorPicker',
color,
);
verify(() => cubit.emit(state)).called(1);
},
);

testWidgets(
'hover color picker should update with color',
(tester) async {
Expand Down

0 comments on commit 63708e5

Please sign in to comment.