From 7afd7b6a5cb1f3ccb07163d9b7532576549a684e Mon Sep 17 00:00:00 2001 From: ChikatoTakenouchi Date: Sun, 18 Sep 2022 14:55:44 +0900 Subject: [PATCH 1/4] =?UTF-8?q?wip:=20RootPage=E3=81=A8FavoriteREpositorie?= =?UTF-8?q?sPage=E3=81=AE=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screen/favorite_repositories_page.dart | 19 +++++++++++ lib/screen/github_list_page.dart | 2 +- lib/screen/root_page.dart | 38 ++++++++++++++++++++++ lib/screen/start_page.dart | 4 +-- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 lib/screen/favorite_repositories_page.dart create mode 100644 lib/screen/root_page.dart diff --git a/lib/screen/favorite_repositories_page.dart b/lib/screen/favorite_repositories_page.dart new file mode 100644 index 0000000..27420ef --- /dev/null +++ b/lib/screen/favorite_repositories_page.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +class FavoriteRepositoriesPage extends HookConsumerWidget { + const FavoriteRepositoriesPage({super.key}); + @override + Widget build(BuildContext context, WidgetRef ref) { + return Scaffold( + appBar: AppBar( + title: const Text('お気に入り'), + ), + body: Container( + child: Center( + child: Text('テキスト'), + ), + ), + ); + } +} diff --git a/lib/screen/github_list_page.dart b/lib/screen/github_list_page.dart index 0096fb0..d50625d 100644 --- a/lib/screen/github_list_page.dart +++ b/lib/screen/github_list_page.dart @@ -42,7 +42,7 @@ class GithubListPage extends HookConsumerWidget { hintText: 'Search', ), ) - : const Text('Github List'), + : const Text('探す'), actions: [ IconButton( onPressed: () { diff --git a/lib/screen/root_page.dart b/lib/screen/root_page.dart new file mode 100644 index 0000000..be5bc3e --- /dev/null +++ b/lib/screen/root_page.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:github_searcher_flutter/screen/favorite_repositories_page.dart'; +import 'package:github_searcher_flutter/screen/github_list_page.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +class RootPage extends HookConsumerWidget { + const RootPage({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final selectedIndex = useState(0); + final widgets = useState>([ + const GithubListPage(), + const FavoriteRepositoriesPage(), + ]); + + return Scaffold( + body: widgets.value.elementAt(selectedIndex.value), + bottomNavigationBar: BottomNavigationBar( + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.search), + label: '探す', + ), + BottomNavigationBarItem( + icon: Icon(Icons.star), + label: 'お気に入り', + ), + ], + currentIndex: selectedIndex.value, + onTap: (value) { + selectedIndex.value = value; + }, + ), + ); + } +} diff --git a/lib/screen/start_page.dart b/lib/screen/start_page.dart index 0fd6014..28092e3 100644 --- a/lib/screen/start_page.dart +++ b/lib/screen/start_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:github_searcher_flutter/model/repository/auth_repository.dart'; -import 'package:github_searcher_flutter/screen/github_list_page.dart'; +import 'package:github_searcher_flutter/screen/root_page.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; class StartPage extends HookConsumerWidget { @@ -19,7 +19,7 @@ class StartPage extends HookConsumerWidget { theme: ThemeData( primarySwatch: Colors.blue, ), - home: const GithubListPage(), + home: const RootPage(), ); } } From a3e5a136f856e59ccebb4d5cda323b49eb5441cb Mon Sep 17 00:00:00 2001 From: ChikatoTakenouchi Date: Wed, 21 Sep 2022 08:27:25 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20Tab=E3=81=8C=E5=88=87=E3=82=8A?= =?UTF-8?q?=E6=9B=BF=E3=82=8F=E3=81=A3=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=81=8C=E5=88=9D=E6=9C=9F=E5=8C=96=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screen/root_page.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/screen/root_page.dart b/lib/screen/root_page.dart index be5bc3e..b22c485 100644 --- a/lib/screen/root_page.dart +++ b/lib/screen/root_page.dart @@ -16,7 +16,13 @@ class RootPage extends HookConsumerWidget { ]); return Scaffold( - body: widgets.value.elementAt(selectedIndex.value), + body: IndexedStack( + index: selectedIndex.value, + children: const [ + GithubListPage(), + FavoriteRepositoriesPage(), + ], + ), bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem( From 2bba06ed5bea6e47eed58d28f07596261135addd Mon Sep 17 00:00:00 2001 From: ChikatoTakenouchi Date: Sun, 23 Oct 2022 18:06:38 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=81=8C=E5=A4=96=E3=82=8C=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screen/github_list_page.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/screen/github_list_page.dart b/lib/screen/github_list_page.dart index d50625d..7bcfd5d 100644 --- a/lib/screen/github_list_page.dart +++ b/lib/screen/github_list_page.dart @@ -17,6 +17,7 @@ class GithubListPage extends HookConsumerWidget { final repositories = ref.watch(githubRepositoryControllerProvider); final refreshController = useState(RefreshController()); final scrollController = useScrollController(); + final focusNode = useState(FocusNode()); return Scaffold( appBar: AppBar( @@ -41,11 +42,13 @@ class GithubListPage extends HookConsumerWidget { decoration: const InputDecoration( hintText: 'Search', ), + focusNode: focusNode.value, ) : const Text('探す'), actions: [ IconButton( onPressed: () { + focusNode.value.requestFocus(); isSearch.value = true; }, icon: const Icon(Icons.search), From 2c1cf93bfaff286de6b24ca87ac91832664e0aec Mon Sep 17 00:00:00 2001 From: ChikatoTakenouchi Date: Sun, 23 Oct 2022 18:07:20 +0900 Subject: [PATCH 4/4] =?UTF-8?q?wip:=20=E4=BD=99=E8=A8=88=E3=81=AA=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screen/root_page.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/screen/root_page.dart b/lib/screen/root_page.dart index b22c485..cfd97f8 100644 --- a/lib/screen/root_page.dart +++ b/lib/screen/root_page.dart @@ -10,10 +10,6 @@ class RootPage extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final selectedIndex = useState(0); - final widgets = useState>([ - const GithubListPage(), - const FavoriteRepositoriesPage(), - ]); return Scaffold( body: IndexedStack(