Skip to content

Commit

Permalink
build: test and flutter analyze issues fix. Test result : +219 ~10: A…
Browse files Browse the repository at this point in the history
…ll tests passed!
  • Loading branch information
cevheri committed Nov 20, 2024
1 parent bd92bfa commit 34fbc97
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 52 deletions.
1 change: 0 additions & 1 deletion lib/data/repository/city_repository.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:dart_json_mapper/dart_json_mapper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc_advance/data/app_api_exception.dart';

Expand Down
1 change: 0 additions & 1 deletion lib/data/repository/district_repository.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:dart_json_mapper/dart_json_mapper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc_advance/data/app_api_exception.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/data/repository/user_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UserRepository {
Future<List<User?>> getUsers({int page = 0, int size = 10, List<String> sort = const ["id,desc"]}) async {
debugPrint("BEGIN:getUsers repository start");
final httpResponse = await HttpUtils.getRequest("/admin/$_resource?page=$page&size=$size&sort=${sort.join("&sort=")}");
final response = User.fromJsonStringList(httpResponse.body)!;
final response = User.fromJsonStringList(httpResponse.body);
debugPrint("END:getUsers successful");
return response;
}
Expand Down
1 change: 1 addition & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions lib/main/main_local.mapper.g.dart

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions lib/main/main_prod.mapper.g.dart

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions lib/presentation/common_blocs/authority/authority_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AuthorityState extends Equatable {
}

@override
List<Object> get props => [status];
List<Object> get props => [status, authorities ?? []];

@override
bool get stringify => true;
Expand All @@ -35,12 +35,7 @@ class AuthorityInitialState extends AuthorityState {}
class AuthorityLoadInProgressState extends AuthorityState {}

class AuthorityLoadSuccessState extends AuthorityState {
final List authorities;

const AuthorityLoadSuccessState({required this.authorities});

@override
List<Object> get props => [authorities];
const AuthorityLoadSuccessState({required List authorities}) : super(authorities: authorities, status: AuthorityStatus.success);
}

class AuthorityLoadFailureState extends AuthorityState {
Expand Down
9 changes: 2 additions & 7 deletions lib/presentation/common_blocs/city/city_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CityState extends Equatable {
}

@override
List<Object> get props => [status];
List<Object> get props => [status, cities ?? []];

@override
bool get stringify => true;
Expand All @@ -33,12 +33,7 @@ class CityState extends Equatable {
class CityInitialState extends CityState {}

class CityLoadSuccessState extends CityState {
final List<City?> cities;

const CityLoadSuccessState({required this.cities});

@override
List<Object> get props => [cities];
const CityLoadSuccessState({required List<City?> cities}) : super(cities: cities, status: CityStatus.success);
}

class CityLoadFailureState extends CityState {
Expand Down
1 change: 0 additions & 1 deletion lib/presentation/screen/login/bloc/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import '../../../../data/models/user_jwt.dart';
import '../../../../data/repository/login_repository.dart';

part 'login_event.dart';

part 'login_state.dart';

class LoginBloc extends Bloc<LoginEvent, LoginState> {
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screen/user/edit/edit_form_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class EditFormAuthorities extends StatelessWidget {
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(errorText: S.of(context).authorities_required),
]),
items: state.authorities.map((role) => DropdownMenuItem(value: role, child: Text(role))).toList(),
items: state.authorities!.map((role) => DropdownMenuItem(value: role, child: Text(role))).toList(),
initialValue: () {}(),
onChanged: (value) {},
);
Expand Down
8 changes: 3 additions & 5 deletions lib/presentation/screen/user/list/list_user_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ class ListUserScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.max,
verticalDirection: VerticalDirection.down,
children: [

Expanded(
flex: 7,
child: Text(
state.userList[index].authorities!.contains("ROLE_ADMIN")? S.of(context).admin : S.of(context).guest,
child: Text(state.userList[index].authorities!.contains("ROLE_ADMIN") ? S.of(context).admin : S.of(context).guest,
textAlign: TextAlign.left),
),
SizedBox(width: 5),
Expand Down Expand Up @@ -275,15 +273,15 @@ class ListUserScreen extends StatelessWidget {
decoration: InputDecoration(
hintText: S.of(context).authorities,
),
items: state.authorities
items: state.authorities!
.map(
(role) => DropdownMenuItem(
value: role,
child: Text(role),
),
)
.toList(),
initialValue: state.authorities[0],
initialValue: state.authorities![0],
);
} else {
return Container();
Expand Down

0 comments on commit 34fbc97

Please sign in to comment.