Skip to content

Commit

Permalink
♻️ refactor: コードの整理
Browse files Browse the repository at this point in the history
Issue #145
  • Loading branch information
susatthi committed May 25, 2022
1 parent 613ab13 commit a91969b
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lib/presentation/repo/state/list_view_state.dart
Expand Up @@ -17,27 +17,6 @@ import 'search_repos_sort.dart';

part 'list_view_state.freezed.dart';

/// リポジトリ一覧View状態
@freezed
class RepoListViewState with _$RepoListViewState {
const factory RepoListViewState({
@Default(0) int totalCount,
@Default(<Repo>[]) List<Repo> items,
@Default(false) bool hasNext,
@Default(1) int page,
@Default('') String query,
}) = _RepoListViewState;

factory RepoListViewState.from(SearchReposResult result) {
return RepoListViewState(
totalCount: result.totalCount,
items: result.items,
hasNext: result.items.length < result.totalCount,
query: result.query,
);
}
}

/// リポジトリ一覧View状態プロバイダー
final repoListViewStateProvider = StateNotifierProvider.autoDispose<
RepoListViewNotifier, AsyncValue<RepoListViewState>?>(
Expand All @@ -59,6 +38,27 @@ final repoListViewStateProvider = StateNotifierProvider.autoDispose<
},
);

/// リポジトリ一覧View状態
@freezed
class RepoListViewState with _$RepoListViewState {
const factory RepoListViewState({
@Default(0) int totalCount,
@Default(<Repo>[]) List<Repo> items,
@Default(false) bool hasNext,
@Default(1) int page,
@Default('') String query,
}) = _RepoListViewState;

factory RepoListViewState.from(SearchReposResult result) {
return RepoListViewState(
totalCount: result.totalCount,
items: result.items,
hasNext: result.items.length < result.totalCount,
query: result.query,
);
}
}

/// リポジトリ一覧ViewNotifier
class RepoListViewNotifier
extends StateNotifier<AsyncValue<RepoListViewState>?> {
Expand Down

0 comments on commit a91969b

Please sign in to comment.