Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaijoe committed Aug 16, 2024
1 parent 7e84c44 commit 8189fc2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions forui/lib/src/foundation/stateless_form_field.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

/// A stateless single form field.
Expand Down Expand Up @@ -53,6 +54,7 @@ abstract class FStatelessFormField<T> extends StatelessWidget {
/// * [RestorationManager], which explains how state restoration works in Flutter.
final String? restorationId;

/// Creates a [FStatelessFormField].
const FStatelessFormField({
required this.initialValue,
this.onSave,
Expand All @@ -76,6 +78,7 @@ abstract class FStatelessFormField<T> extends StatelessWidget {
builder: (state) => builder(context, state),
);

/// The builder for the [FormField].
Widget builder(BuildContext context, FormFieldState<T> state);

@override
Expand Down
1 change: 1 addition & 0 deletions forui/lib/src/widgets/label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ final class FLabel extends StatelessWidget {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('style', style))
..add(EnumProperty('axis', axis))
..add(EnumProperty('state', state));
}
Expand Down
8 changes: 4 additions & 4 deletions forui/test/src/widgets/checkbox_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main() {
(false, false, true),
]) {
testWidgets(
'$name with ${enabled ? 'enabled' : 'disabled'}, ${initialValue.toString() + ' value'} & ${error ? 'with error' : 'without error'}',
'$name with ${enabled ? 'enabled' : 'disabled'}, ${'$initialValue value'} & ${error ? 'with error' : 'without error'}',
(tester) async {
await tester.pumpWidget(
TestScaffold(
Expand All @@ -43,7 +43,7 @@ void main() {
await expectLater(
find.byType(TestScaffold),
matchesGoldenFile(
'check-box/$name-${enabled ? 'enabled' : 'disabled'}-${initialValue}${error ? '-error' : ''}.png',
'check-box/$name-${enabled ? 'enabled' : 'disabled'}-$initialValue${error ? '-error' : ''}.png',
),
);
});
Expand All @@ -62,7 +62,7 @@ void main() {
(false, false, true),
]) {
testWidgets(
'$name with label, ${enabled ? 'enabled' : 'disabled'}, ${initialValue.toString() + ' value'} & ${error ? 'with error' : 'without error'}',
'$name with label, ${enabled ? 'enabled' : 'disabled'}, ${'$initialValue value'} & ${error ? 'with error' : 'without error'}',
(tester) async {
await tester.pumpWidget(
TestScaffold(
Expand All @@ -84,7 +84,7 @@ void main() {
await expectLater(
find.byType(TestScaffold),
matchesGoldenFile(
'check-box/$name-label-${enabled ? 'enabled' : 'disabled'}-${initialValue}${error ? '-error' : ''}.png',
'check-box/$name-label-${enabled ? 'enabled' : 'disabled'}-$initialValue${error ? '-error' : ''}.png',
),
);
});
Expand Down
24 changes: 12 additions & 12 deletions forui/test/src/widgets/label_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ void main() {
group('FLabel', () {
for (final (name, theme, _) in TestScaffold.themes) {
for (final state in FLabelState.values) {
testWidgets('$name horizontal with ${state}', (tester) async {
testWidgets('$name horizontal with $state', (tester) async {
await tester.pumpWidget(
TestScaffold(
data: theme,
child: SizedBox(
width: 300,
child: FLabel(
axis: Axis.horizontal,
label: Text('Email'),
description: Text('Enter your email address.'),
error: Text('Please enter a valid email address.'),
label: const Text('Email'),
description: const Text('Enter your email address.'),
error: const Text('Please enter a valid email address.'),
state: state,
child: DecoratedBox(
child: const DecoratedBox(
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5)), color: Colors.grey),
child: SizedBox(width: 16, height: 16),
),
Expand All @@ -35,23 +35,23 @@ void main() {

await expectLater(
find.byType(TestScaffold),
matchesGoldenFile('label/$name-horizontal-${state}.png'),
matchesGoldenFile('label/$name-horizontal-$state.png'),
);
});
}

for (final state in FLabelState.values) {
testWidgets('$name vertical with ${state}', (tester) async {
testWidgets('$name vertical with $state', (tester) async {
await tester.pumpWidget(
TestScaffold(
data: theme,
child: FLabel(
axis: Axis.vertical,
label: Text('Email'),
description: Text('Enter your email address.'),
error: Text('Please enter a valid email address.'),
label: const Text('Email'),
description: const Text('Enter your email address.'),
error: const Text('Please enter a valid email address.'),
state: state,
child: DecoratedBox(
child: const DecoratedBox(
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5)), color: Colors.grey),
child: SizedBox(width: 200, height: 30),
),
Expand All @@ -61,7 +61,7 @@ void main() {

await expectLater(
find.byType(TestScaffold),
matchesGoldenFile('label/$name-vertical-${state}.png'),
matchesGoldenFile('label/$name-vertical-$state.png'),
);
});
}
Expand Down

0 comments on commit 8189fc2

Please sign in to comment.