Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove focus color in input decoration editor #169

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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