From 9583d11174f16801ceb8a8360a85754b5ff03d76 Mon Sep 17 00:00:00 2001 From: Koji Wakamiya Date: Sat, 5 Oct 2024 11:41:52 +0900 Subject: [PATCH] chore: update --- .github/workflows/deploy.yaml | 2 +- README.md | 50 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 835bfcf..86add5c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -19,7 +19,7 @@ jobs: cache: true - run: flutter pub get working-directory: example - - run: flutter build web --base-href "/paging_view/" --wasm + - run: flutter build web --base-href "/paging_view/" --web-renderer skwasm working-directory: example - uses: peaceiris/actions-gh-pages@v4 with: diff --git a/README.md b/README.md index 5939910..106b4bc 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,22 @@ https://koji-1009.github.io/paging_view/ 3. Set the step 2 instance obtained to `PagingList` or `PagingGrid`. ```dart -final dataSourcePublicRepositoriesProvider = Provider.autoDispose( - (ref) { - final dataSource = DataSourcePublicRepositories( - repository: ref.watch( - gitHubRepositoryProvider, - ), - ); +@riverpod +DataSourcePublicRepositories dataSourcePublicRepositories( + DataSourcePublicRepositoriesRef ref, +) { + final dataSource = DataSourcePublicRepositories( + repository: ref.watch( + gitHubRepositoryProvider, + ), + ); - ref.onDispose(() { - dataSource.dispose(); - }); + ref.onDispose(() { + dataSource.dispose(); + }); - return dataSource; - }, -); + return dataSource; +} /// 1 final class DataSourcePublicRepositories extends DataSource { @@ -60,7 +61,7 @@ final class DataSourcePublicRepositories extends DataSource { } } -class HomePage extends HookConsumerWidget { +class HomePage extends ConsumerWidget { const HomePage({super.key}); @override @@ -70,18 +71,15 @@ class HomePage extends HookConsumerWidget { final body = PagingList( /// 3 dataSource: dataSource, - builder: (context, repository, index) { - return Card( - child: ListTile( - title: Text(repository.fullName), - subtitle: Text(repository.description), - ), - ); - }, - errorBuilder: (context, e) => - Center( - child: Text('$e'), - ), + builder: (context, repository, index) => Card( + child: ListTile( + title: Text(repository.fullName), + subtitle: Text(repository.description), + ), + ), + errorBuilder: (context, e) => Center( + child: Text('$e'), + ), initialLoadingWidget: const Center( child: Padding( padding: EdgeInsets.all(16),