Skip to content

Commit 058c83b

Browse files
committed
Fix lint error
1 parent e5891f8 commit 058c83b

File tree

16 files changed

+153
-160
lines changed

16 files changed

+153
-160
lines changed

lib/data/core/extensions/stream_extension.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ List<LeaveApplication> getLeaveApplicationFromLeaveEmployee(
2626
}
2727
return null;
2828
})
29-
.whereNotNull()
29+
.nonNulls
3030
.toList();
3131
}

lib/ui/admin/forms/create_form/bloc/create_form_bloc.dart

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:collection/collection.dart';
2+
import 'package:flutter/cupertino.dart';
23
import 'package:flutter_bloc/flutter_bloc.dart';
34
import 'package:image_picker/image_picker.dart';
45
import 'package:injectable/injectable.dart';
@@ -101,7 +102,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
101102
orgFormFields: state.fields,
102103
fieldId: event.fieldId,
103104
updater: (field) {
104-
List<EquatableTextEditingController> options = field?.options ?? [];
105+
List<TextEditingController> options = field?.options ?? [];
105106
if (event.type != FormFieldAnswerType.checkBox &&
106107
event.type != FormFieldAnswerType.dropDown) {
107108
for (final option in options) {
@@ -112,8 +113,8 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
112113
field?.inputType != FormFieldAnswerType.dropDown &&
113114
(event.type == FormFieldAnswerType.checkBox ||
114115
event.type == FormFieldAnswerType.dropDown)) {
115-
options.add(EquatableTextEditingController(
116-
text: 'Option ${options.length}'));
116+
options
117+
.add(TextEditingController(text: 'Option ${options.length}'));
117118
}
118119
return field?.copyWith(
119120
inputType: event.type,
@@ -129,10 +130,8 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
129130
orgFormFields: state.fields,
130131
fieldId: event.fieldId,
131132
updater: (field) {
132-
List<EquatableTextEditingController> options =
133-
field?.options?.toList() ?? [];
134-
options.add(
135-
EquatableTextEditingController(text: 'Option ${options.length}'));
133+
List<TextEditingController> options = field?.options?.toList() ?? [];
134+
options.add(TextEditingController(text: 'Option ${options.length}'));
136135
return field?.copyWith(options: options);
137136
});
138137
emit(state.copyWith(fields: fields));
@@ -144,8 +143,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
144143
orgFormFields: state.fields,
145144
fieldId: event.fieldId,
146145
updater: (field) {
147-
List<EquatableTextEditingController>? options =
148-
field?.options?.toList();
146+
List<TextEditingController>? options = field?.options?.toList();
149147
if (options != null) {
150148
options[event.optionIndex].dispose();
151149
options.removeAt(event.optionIndex);
@@ -163,7 +161,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
163161
OrgFormFieldCreateFormState(
164162
index: _index++,
165163
id: _formRepo.generateNewFormFieldId(formId: state.formId),
166-
question: EquatableTextEditingController());
164+
question: TextEditingController());
167165
final fields = state.fields.toList();
168166
fields.sort((a, b) => a.index.compareTo(b.index));
169167
fields.add(orgFormField);
@@ -177,7 +175,7 @@ class CreateFormBloc extends Bloc<CreateFormEvents, CreateFormState> {
177175
if (image != null) {
178176
final OrgFormFieldCreateFormState orgFormField =
179177
OrgFormFieldCreateFormState(
180-
question: EquatableTextEditingController(),
178+
question: TextEditingController(),
181179
inputType: FormFieldAnswerType.none,
182180
type: FormFieldType.image,
183181
index: _index++,

lib/ui/admin/forms/create_form/bloc/org_form_field_update_data_model.dart

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@ import 'package:equatable/equatable.dart';
22
import '../../../../../data/model/org_forms/org_form_field/org_form_field.dart';
33
import 'package:flutter/cupertino.dart' show TextEditingController;
44

5-
class EquatableTextEditingController extends TextEditingController
6-
with EquatableMixin {
7-
EquatableTextEditingController({super.text});
8-
9-
@override
10-
List<Object?> get props => [value];
11-
}
12-
135
class OrgFormFieldCreateFormState extends Equatable {
146
final String id;
157
final int index;
16-
final EquatableTextEditingController question;
8+
final TextEditingController question;
179
final String image;
1810
final FormFieldType type;
1911
final FormFieldAnswerType inputType;
20-
final List<EquatableTextEditingController>? options;
12+
final List<TextEditingController>? options;
2113
final bool isRequired;
2214

2315
const OrgFormFieldCreateFormState(
@@ -36,7 +28,7 @@ class OrgFormFieldCreateFormState extends Equatable {
3628
String? image,
3729
FormFieldAnswerType? inputType,
3830
bool? allowOptionNull,
39-
List<EquatableTextEditingController>? options,
31+
List<TextEditingController>? options,
4032
bool? isRequired}) =>
4133
OrgFormFieldCreateFormState(
4234
image: image ?? this.image,

lib/ui/admin/forms/create_form/widget/org_create_form_info_view.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ class HeaderImageView extends StatelessWidget {
102102
child: Container(
103103
margin: const EdgeInsets.all(8),
104104
decoration: BoxDecoration(
105-
color: context.colorScheme.surface.withOpacity(0.60),
105+
color: context.colorScheme.surface
106+
.withValues(alpha: 0.60),
106107
borderRadius: BorderRadius.circular(50)),
107108
child: Row(
108109
mainAxisSize: MainAxisSize.min,

lib/ui/admin/members/detail/widget/time_off_card.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class TimeOffCard extends StatelessWidget {
6060
children: [
6161
CircularProgressIndicator(
6262
strokeWidth: 8,
63-
backgroundColor:
64-
context.colorScheme.primary.withOpacity(0.5),
63+
backgroundColor: context.colorScheme.primary
64+
.withValues(alpha: 0.5),
6565
color: context.colorScheme.primary,
6666
value: percentage,
6767
),

lib/ui/shared/appbar_drawer/drawer/bloc/app_drawer_bloc.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class DrawerBloc extends Bloc<DrawerEvents, DrawerState> {
3434
await _accountService.fetchSpaceIds(uid: _userManager.userUID!);
3535
final spaces = await Future.wait(spaceIds.map((spaceId) async {
3636
return await _spaceService.getSpace(spaceId);
37-
})).then((value) => value.whereNotNull().toList());
37+
})).then((value) => value.nonNulls.toList());
3838
emit(state.copyWith(fetchSpacesStatus: Status.success, spaces: spaces));
3939
} on Exception {
4040
emit(state.copyWith(

lib/ui/sign_in/bloc/sign_in_view_bloc.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {
3939
} else {
4040
emit(state.copyWith(googleSignInLoading: false));
4141
}
42-
} catch(e) {
42+
} catch (e) {
4343
emit(state.copyWith(
4444
googleSignInLoading: false, error: firesbaseAuthError));
4545
}

lib/ui/sign_in/setup_profile/setup_profile_screen.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ class _SetupProfileScreenState extends State<SetupProfileScreen> {
108108
return AppButton(
109109
backgroundColor: state.buttonEnabled
110110
? context.colorScheme.primary
111-
: context.colorScheme.primary.withOpacity(0.5),
111+
: context.colorScheme.primary
112+
.withValues(alpha: 0.5),
112113
loading: state.isSubmitting,
113114
tag: context.l10n.submit_button_tag,
114115
onTap: () => context

lib/ui/sign_in/sign_in_screen.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SignInScreenState extends State<SignInScreen> {
5353
end: Alignment.bottomCenter,
5454
colors: [
5555
context.colorScheme.surface,
56-
context.colorScheme.primary.withOpacity(0.5)
56+
context.colorScheme.primary.withValues(alpha: 0.5)
5757
],
5858
stops: const [
5959
0.5,

lib/ui/space/create_space/create_workspace_screen.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ class _CreateWorkSpaceScreenState extends State<CreateWorkSpaceScreen>
9898
return AppButton(
9999
backgroundColor: state.buttonState == ButtonState.enable
100100
? context.colorScheme.primary
101-
: context.colorScheme.primary.withOpacity(0.5),
101+
: context.colorScheme.primary
102+
.withValues(alpha: 0.5),
102103
loading: state.createSpaceStatus == Status.loading,
103104
tag: state.page == 2
104105
? locale.create_space_tag

lib/ui/space/join_space/bloc/join_space_bloc.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:collection/collection.dart';
21
import 'package:flutter_bloc/flutter_bloc.dart';
32
import 'package:injectable/injectable.dart';
43
import 'package:projectunity/data/core/exception/error_const.dart';
@@ -50,15 +49,15 @@ class JoinSpaceBloc extends Bloc<JoinSpaceEvents, JoinSpaceState> {
5049

5150
return await Future.wait(invitations.map((invitation) async {
5251
return await _spaceService.getSpace(invitation.spaceId);
53-
})).then((value) => value.whereNotNull().toList());
52+
})).then((value) => value.nonNulls.toList());
5453
}
5554

5655
Future<List<Space>> joinedSpace() async {
5756
final List<String> spaceIds =
5857
await accountService.fetchSpaceIds(uid: _userManager.userUID!);
5958
return await Future.wait(spaceIds.map((spaceId) async {
6059
return await _spaceService.getSpace(spaceId);
61-
})).then((value) => value.whereNotNull().toList());
60+
})).then((value) => value.nonNulls.toList());
6261
}
6362

6463
Future<void> _init(

lib/ui/user/leaves/detail/widget/response_note.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ResponseNote extends StatelessWidget {
2828
decoration: BoxDecoration(
2929
boxShadow: AppTheme.commonBoxShadow(context),
3030
borderRadius: AppTheme.commonBorderRadius,
31-
color: context.colorScheme.primary.withOpacity(0.5),
31+
color: context.colorScheme.primary.withValues(alpha: 0.5),
3232
),
3333
child: Text(
3434
leaveResponse,

lib/ui/widget/leave_details_widget/leave_details_header_content.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LeaveTypeAgoTitleWithStatus extends StatelessWidget {
2626
padding: const EdgeInsets.all(16),
2727
decoration: BoxDecoration(
2828
borderRadius: BorderRadius.circular(8),
29-
color: leaveStatusColor(status, context).withOpacity(0.1)),
29+
color: leaveStatusColor(status, context).withValues(alpha: 0.1)),
3030
child: Row(
3131
mainAxisAlignment: MainAxisAlignment.spaceBetween,
3232
children: [

0 commit comments

Comments
 (0)