From b91d93827c4b11f726a30a764b00d3e3b9989bd1 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sat, 7 Sep 2024 01:27:40 +0900 Subject: [PATCH 01/14] =?UTF-8?q?M3-337=20Feat=20:=20=EA=B7=B8=EB=A3=B9?= =?UTF-8?q?=EA=B2=80=EC=83=89=EC=8B=9C=20=EC=9D=B4=EB=A6=84,=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- lib/models/search_group.dart | 22 +++- lib/screens/search_group_screen.dart | 164 ++++++++++++++++++-------- lib/service/search_group_service.dart | 4 +- lib/utils/dio_service.dart | 2 +- lib/widgets/my_page/user_info.dart | 3 +- 6 files changed, 139 insertions(+), 58 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index bf6d1fda..7a89c2d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -58,7 +58,7 @@ Future main() async { LocationService().initBackgroundLocation(); - String initialRoute = await AuthService().isLogin() ? '/main' : '/permission'; + String initialRoute = '/main';//await AuthService().isLogin() ? '/main' : '/permission'; VersionCheck versionCheck = VersionCheck(); versionCheck.versionCheck(); diff --git a/lib/models/search_group.dart b/lib/models/search_group.dart index 5c9a17ee..aed3f005 100644 --- a/lib/models/search_group.dart +++ b/lib/models/search_group.dart @@ -1,16 +1,32 @@ class SearchGroupResult { String name; + String backgroundImageUrl; + String communityColor; - SearchGroupResult({required this.name}); + SearchGroupResult( + {required this.name, + required this.backgroundImageUrl, + required this.communityColor}); factory SearchGroupResult.fromJson(Map json) { return switch (json) { - {'name': var name} => SearchGroupResult(name: name), + { + 'name': var name, + 'backgroundImageUrl': var backgroundImageUrl, + 'communityColor': var communityColor + } => + SearchGroupResult( + name: name, + backgroundImageUrl: backgroundImageUrl, + communityColor: communityColor), _ => throw const FormatException('Failed to load group') }; } static List listFromJson(List jsonList) { - return [for (var element in jsonList) SearchGroupResult.fromJson(element)]; + return [ + for (var element in jsonList) + if (element != null) SearchGroupResult.fromJson(element) + ]; } } diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index c4b085ed..e1ab8be0 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -1,6 +1,8 @@ +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import '../constants/app_colors.dart'; import '../controllers/search_group_controller.dart'; class SearchGroupScreen extends StatelessWidget { @@ -16,42 +18,81 @@ class SearchGroupScreen extends StatelessWidget { FocusScope.of(context).unfocus(); }, child: Scaffold( + backgroundColor: AppColors.background, appBar: AppBar( + backgroundColor: AppColors.background, + leading: IconButton( + onPressed: () { + Get.back(); + }, + icon: Icon( + Icons.arrow_back_ios, + color: AppColors.buttonColor, + ), + ), title: Row( children: [ - const SizedBox(width: 8), - Flexible( - flex: 1, - child: TextField( - autofocus: true, - onSubmitted: (value) { - if (groupSearchController.searchController.text != '') { - groupSearchController.getSearchedGroup( - groupSearchController.searchController.text, - ); - } - }, - controller: groupSearchController.searchController, - focusNode: groupSearchController.searchFocusnode, - decoration: InputDecoration( - hintText: 'Enter keyword', - contentPadding: EdgeInsets.symmetric( - vertical: 7, - horizontal: 16, - ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width * 0.7, + height: 45, + // 적당한 높이 설정 + padding: EdgeInsets.symmetric(horizontal: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: AppColors.boxColor, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 10, horizontal: 5), + child: TextField( + controller: groupSearchController.searchController, + autofocus: false, + focusNode: groupSearchController.searchFocusnode, + onChanged: (value) { + if (groupSearchController + .searchController.text.isNotEmpty) { + groupSearchController.getSearchedGroup( + groupSearchController.searchController.text, + ); + } + }, + decoration: InputDecoration( + hintText: '그룹을 검색해주세요', + hintStyle: TextStyle( + color: AppColors.textPrimary, + fontSize: 11, + ), + border: InputBorder.none, + contentPadding: + EdgeInsets.symmetric(vertical: 11)), + style: TextStyle( + fontSize: 17.0, + color: AppColors.textPrimary, + ), + ), + ), + ), + IconButton( + onPressed: () { + String keyword = + groupSearchController.searchController.text; + if (keyword.isNotEmpty) { + groupSearchController.getSearchedGroup(keyword); + } + }, + icon: Icon( + Icons.search, + color: AppColors.buttonColor, + size: 20, + ), + ), + ], ), - ), - ), - IconButton( - onPressed: () { - String keyword = groupSearchController.searchController.text; - if (keyword != '') { - groupSearchController.getSearchedGroup(keyword); - } - }, - icon: const Icon( - Icons.search, - color: Colors.black, ), ), ], @@ -60,26 +101,47 @@ class SearchGroupScreen extends StatelessWidget { body: Column( children: [ Expanded( - child: Obx( - () { - if (groupSearchController.searchResult.isEmpty) { - return Center( - child: Text('그룹이 없습니다!'), - ); - } else { - return ListView.builder( - itemCount: groupSearchController.searchResult.length, - itemBuilder: (context, index) { - return ListTile( - title: Text( - groupSearchController.searchResult[index].name, + child: Obx(() { + if (groupSearchController.searchResult.isEmpty || + groupSearchController.searchResult.isEmpty) { + return Center( + child: Text( + '그룹이 없습니다!', + style: TextStyle(color: AppColors.textPrimary), + ), + ); + } else { + return ListView.builder( + itemCount: groupSearchController.searchResult.length, + itemBuilder: (context, index) { + return ListTile( + title: Container( + child: Row( + children: [ + Image( + image: CachedNetworkImageProvider( + groupSearchController + .searchResult[index].backgroundImageUrl, + ), + width: 44, + height: 44, + fit: BoxFit.cover, + ), + SizedBox(width: 8), + Text( + groupSearchController.searchResult[index].name, + style: TextStyle( + color: AppColors.textPrimary, + ), + ), + ], ), - ); - }, - ); - } - }, - ), + ), + ); + }, + ); + } + }), ), ], ), diff --git a/lib/service/search_group_service.dart b/lib/service/search_group_service.dart index 329c3b27..2045eb5f 100644 --- a/lib/service/search_group_service.dart +++ b/lib/service/search_group_service.dart @@ -17,10 +17,12 @@ class SearchGroupService { Future> getSearchGroups({ required String searchKeyword, }) async { + print('1111 ${searchKeyword}'); var response = await dio.get( - '/groups', + '/communities', queryParameters: {'searchKeyword': searchKeyword}, ); + print('2222 ${searchKeyword},${SearchGroupResult.listFromJson(response.data['data'])}'); return SearchGroupResult.listFromJson(response.data['data']); } } diff --git a/lib/utils/dio_service.dart b/lib/utils/dio_service.dart index 44cbfad4..e80aa918 100644 --- a/lib/utils/dio_service.dart +++ b/lib/utils/dio_service.dart @@ -30,7 +30,7 @@ class DioService { _dio.interceptors.add( InterceptorsWrapper( onRequest: (options, handler) async { - final accessToken = userManager.getAccessToken(); + final accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjA3NTc5ODUsImV4cCI6MTgyMTYyMTk4NSwidXNlcklkIjo2MjJ9.HNTbCbz02o9-GsDxcdGG-VxJl0Q_xb1hBeu7ihg9oSY';//userManager.getAccessToken(); options.headers.addAll({ 'Authorization': 'Bearer $accessToken', }); diff --git a/lib/widgets/my_page/user_info.dart b/lib/widgets/my_page/user_info.dart index 754385b9..5143d5ea 100644 --- a/lib/widgets/my_page/user_info.dart +++ b/lib/widgets/my_page/user_info.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import '../../constants/app_colors.dart'; import '../../constants/text_styles.dart'; import '../../controllers/my_page_controller.dart'; +import '../../screens/search_group_screen.dart'; import '../../screens/user_info_update_screen.dart'; class UserInfo extends StatelessWidget { @@ -16,7 +17,7 @@ class UserInfo extends StatelessWidget { return InkWell( borderRadius: BorderRadius.all(Radius.circular(16)), onTap: () { - Get.to(() => UserInfoUpdateScreen()); + Get.to(() => SearchGroupScreen());//UserInfoUpdateScreen()); }, child: Ink( decoration: const BoxDecoration( From 6dea98334191fa8be03209eb1c12730f67fe21d2 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 13:21:12 +0900 Subject: [PATCH 02/14] =?UTF-8?q?M3-337=20Feat=20:=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EC=82=AC=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 +- lib/utils/dio_service.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 7a89c2d7..bf6d1fda 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -58,7 +58,7 @@ Future main() async { LocationService().initBackgroundLocation(); - String initialRoute = '/main';//await AuthService().isLogin() ? '/main' : '/permission'; + String initialRoute = await AuthService().isLogin() ? '/main' : '/permission'; VersionCheck versionCheck = VersionCheck(); versionCheck.versionCheck(); diff --git a/lib/utils/dio_service.dart b/lib/utils/dio_service.dart index e80aa918..44cbfad4 100644 --- a/lib/utils/dio_service.dart +++ b/lib/utils/dio_service.dart @@ -30,7 +30,7 @@ class DioService { _dio.interceptors.add( InterceptorsWrapper( onRequest: (options, handler) async { - final accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjA3NTc5ODUsImV4cCI6MTgyMTYyMTk4NSwidXNlcklkIjo2MjJ9.HNTbCbz02o9-GsDxcdGG-VxJl0Q_xb1hBeu7ihg9oSY';//userManager.getAccessToken(); + final accessToken = userManager.getAccessToken(); options.headers.addAll({ 'Authorization': 'Bearer $accessToken', }); From 8cb7f89aebfd85dc56d2a34d7f1959319e3926d0 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 13:53:11 +0900 Subject: [PATCH 03/14] =?UTF-8?q?M3-337=20Feat=20:=20search=20group=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=20=EC=82=AD=EC=A0=9C,=20=EB=9D=BC?= =?UTF-8?q?=EC=9A=B0=ED=8A=B8=20=EC=A0=95=EC=83=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/service/search_group_service.dart | 28 --------------------------- lib/widgets/my_page/user_info.dart | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 lib/service/search_group_service.dart diff --git a/lib/service/search_group_service.dart b/lib/service/search_group_service.dart deleted file mode 100644 index 2045eb5f..00000000 --- a/lib/service/search_group_service.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:dio/dio.dart'; - -import '../models/search_group.dart'; -import '../utils/dio_service.dart'; - -class SearchGroupService { - static final SearchGroupService _instance = SearchGroupService._internal(); - - SearchGroupService._internal(); - - factory SearchGroupService() { - return _instance; - } - - final Dio dio = DioService().getDio(); - - Future> getSearchGroups({ - required String searchKeyword, - }) async { - print('1111 ${searchKeyword}'); - var response = await dio.get( - '/communities', - queryParameters: {'searchKeyword': searchKeyword}, - ); - print('2222 ${searchKeyword},${SearchGroupResult.listFromJson(response.data['data'])}'); - return SearchGroupResult.listFromJson(response.data['data']); - } -} diff --git a/lib/widgets/my_page/user_info.dart b/lib/widgets/my_page/user_info.dart index 5143d5ea..54ba0e3f 100644 --- a/lib/widgets/my_page/user_info.dart +++ b/lib/widgets/my_page/user_info.dart @@ -17,7 +17,7 @@ class UserInfo extends StatelessWidget { return InkWell( borderRadius: BorderRadius.all(Radius.circular(16)), onTap: () { - Get.to(() => SearchGroupScreen());//UserInfoUpdateScreen()); + Get.to(() => UserInfoUpdateScreen()); }, child: Ink( decoration: const BoxDecoration( From f44c140f731ab87f2211a125dde6e7c4bfea81b5 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:26:54 +0900 Subject: [PATCH 04/14] =?UTF-8?q?M3-337=20Feat=20:=20=EB=8C=80=ED=95=99?= =?UTF-8?q?=EB=B3=84=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B2=80=EC=83=89,?= =?UTF-8?q?=20=EA=B7=B8=EB=A3=B9=20px=20=EB=94=94=EC=9E=90=EC=9D=B8=20?= =?UTF-8?q?=EC=82=BD=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controllers/search_group_controller.dart | 6 +- lib/models/search_group.dart | 11 ++- lib/screens/search_group_screen.dart | 70 +++++++++++++++----- lib/service/community_service.dart | 12 ++++ 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/lib/controllers/search_group_controller.dart b/lib/controllers/search_group_controller.dart index b745da2e..430a58db 100644 --- a/lib/controllers/search_group_controller.dart +++ b/lib/controllers/search_group_controller.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import '../service/search_group_service.dart'; +import '../service/community_service.dart'; class GroupSearchController extends GetxController { RxList searchResult = [].obs; FocusNode searchFocusnode = FocusNode(); TextEditingController searchController = TextEditingController(); - SearchGroupService searchGroupService = SearchGroupService(); + CommunityService communityService = CommunityService(); @override void onInit() { @@ -31,7 +31,7 @@ class GroupSearchController extends GetxController { void getSearchedGroup(keyword) async { List getInstance = - await searchGroupService.getSearchGroups(searchKeyword: keyword); + await communityService.getSearchCommunities(searchKeyword: keyword); searchResult.assignAll(getInstance); } } diff --git a/lib/models/search_group.dart b/lib/models/search_group.dart index aed3f005..9deb4e7f 100644 --- a/lib/models/search_group.dart +++ b/lib/models/search_group.dart @@ -2,23 +2,28 @@ class SearchGroupResult { String name; String backgroundImageUrl; String communityColor; + int id; SearchGroupResult( {required this.name, required this.backgroundImageUrl, - required this.communityColor}); + required this.communityColor, + required this.id}); factory SearchGroupResult.fromJson(Map json) { return switch (json) { { 'name': var name, 'backgroundImageUrl': var backgroundImageUrl, - 'communityColor': var communityColor + 'communityColor': var communityColor, + 'id': var id } => SearchGroupResult( name: name, backgroundImageUrl: backgroundImageUrl, - communityColor: communityColor), + communityColor: communityColor, + id: id, + ), _ => throw const FormatException('Failed to load group') }; } diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index e1ab8be0..de92093e 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -1,9 +1,12 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import '../constants/app_colors.dart'; import '../controllers/search_group_controller.dart'; +import 'community_info_screen.dart'; +import 'community_screen.dart'; class SearchGroupScreen extends StatelessWidget { const SearchGroupScreen({super.key}); @@ -115,26 +118,59 @@ class SearchGroupScreen extends StatelessWidget { itemCount: groupSearchController.searchResult.length, itemBuilder: (context, index) { return ListTile( - title: Container( - child: Row( - children: [ - Image( - image: CachedNetworkImageProvider( - groupSearchController - .searchResult[index].backgroundImageUrl, + title: InkWell( + onTap: () { + Get.to(() => CommunityInfoScreen( + groupId: groupSearchController + .searchResult[index].id)); + }, + child: Container( + child: Row( + children: [ + SvgPicture.network(groupSearchController + .searchResult[index].backgroundImageUrl, + width: 38, ), - width: 44, - height: 44, - fit: BoxFit.cover, - ), - SizedBox(width: 8), - Text( - groupSearchController.searchResult[index].name, - style: TextStyle( + SizedBox(width: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + groupSearchController + .searchResult[index].name, + style: TextStyle( + color: AppColors.textPrimary, + ), + ), + Row( + children: [ + Text( + '1111px', + style: TextStyle( + color: AppColors.primary), + ), + Text( + 'ㆍ', + style: TextStyle( + color: AppColors.textForth), + ), + Text( + '누적 2222px', + style: TextStyle( + color: AppColors.textForth), + ), + ], + ), + ], + ), + Spacer(), + Icon( + Icons.arrow_forward_ios, color: AppColors.textPrimary, + size: 20, ), - ), - ], + ], + ), ), ), ); diff --git a/lib/service/community_service.dart b/lib/service/community_service.dart index b53b3ae9..f073115d 100644 --- a/lib/service/community_service.dart +++ b/lib/service/community_service.dart @@ -1,6 +1,7 @@ import 'package:dio/dio.dart'; import '../models/community.dart'; +import '../models/search_group.dart'; import '../utils/dio_service.dart'; class CommunityService { @@ -17,4 +18,15 @@ class CommunityService { var response = await dio.get('/communities/$communityId'); return Community.fromJson(response.data['data']); } + + Future> getSearchCommunities({ + required String searchKeyword, + }) async { + var response = await dio.get( + '/communities', + queryParameters: {'searchKeyword': searchKeyword}, + ); + print('2222 ${response.data['data']}'); + return SearchGroupResult.listFromJson(response.data['data']); + } } From 4407fc6221d68227b70738736def2a595dfbd5b0 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:56:27 +0900 Subject: [PATCH 05/14] =?UTF-8?q?M3-337=20Feat=20:=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=ED=99=95=EC=9E=A5=EC=9E=90=EB=B3=84=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EB=B0=A9=EC=8B=9D=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screens/search_group_screen.dart | 32 +++++++++++++++++++--- lib/widgets/community/community_image.dart | 25 ++++++++++++++--- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index de92093e..937fdaa9 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -127,10 +127,23 @@ class SearchGroupScreen extends StatelessWidget { child: Container( child: Row( children: [ - SvgPicture.network(groupSearchController - .searchResult[index].backgroundImageUrl, - width: 38, - ), + checkFileExtension(groupSearchController + .searchResult[index] + .backgroundImageUrl) == + 'svg' + ? SvgPicture.network( + groupSearchController + .searchResult[index] + .backgroundImageUrl, + width: 38, + ) + : Image( + image: CachedNetworkImageProvider( + groupSearchController + .searchResult[index] + .backgroundImageUrl), + width: 38, + ), SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -184,4 +197,15 @@ class SearchGroupScreen extends StatelessWidget { ), ); } + + String checkFileExtension(String url) { + Uri uri = Uri.parse(url); + String path = uri.path; + + if (path.contains('.')) { + return path.split('.').last; + } else { + return ''; + } + } } diff --git a/lib/widgets/community/community_image.dart b/lib/widgets/community/community_image.dart index e34fe335..219cd3c1 100644 --- a/lib/widgets/community/community_image.dart +++ b/lib/widgets/community/community_image.dart @@ -1,5 +1,6 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class CommunityImage extends StatelessWidget { final String imageUrl; @@ -13,10 +14,15 @@ class CommunityImage extends StatelessWidget { return Stack( children: [ Positioned.fill( - child: Image( - image: CachedNetworkImageProvider(imageUrl), - fit: BoxFit.cover, - ), + child: checkFileExtension(imageUrl) == 'svg' + ? SvgPicture.network( + imageUrl, + fit: BoxFit.fitWidth, + ) + : Image( + image: CachedNetworkImageProvider(imageUrl), + fit: BoxFit.fitWidth, + ), ), Container( decoration: BoxDecoration( @@ -36,4 +42,15 @@ class CommunityImage extends StatelessWidget { }, ); } + + String checkFileExtension(String url) { + Uri uri = Uri.parse(url); + String path = uri.path; + + if (path.contains('.')) { + return path.split('.').last; + } else { + return ''; + } + } } From dbe95c37d8f23ad6cbfa723dd42a05c7f7925b92 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 16:01:10 +0900 Subject: [PATCH 06/14] =?UTF-8?q?M3-337=20Feat=20:=20=ED=94=BD=EC=85=80?= =?UTF-8?q?=EC=88=98=EC=97=90=203=EC=9E=90=EB=A6=AC=EB=A7=88=EB=8B=A4=20,?= =?UTF-8?q?=20=EC=82=BD=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screens/search_group_screen.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index 937fdaa9..2a2ac18b 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:intl/intl.dart'; import '../constants/app_colors.dart'; import '../controllers/search_group_controller.dart'; @@ -158,7 +159,7 @@ class SearchGroupScreen extends StatelessWidget { Row( children: [ Text( - '1111px', + '${formatNumber(1122)}px', style: TextStyle( color: AppColors.primary), ), @@ -168,7 +169,7 @@ class SearchGroupScreen extends StatelessWidget { color: AppColors.textForth), ), Text( - '누적 2222px', + '누적 ${formatNumber(2222)}px', style: TextStyle( color: AppColors.textForth), ), @@ -208,4 +209,9 @@ class SearchGroupScreen extends StatelessWidget { return ''; } } + + String formatNumber(int number) { + final formatter = NumberFormat('#,###'); + return formatter.format(number); + } } From f9f5e6b5dfede87f1e4426650e367f5854a7aacc Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:10:37 +0900 Subject: [PATCH 07/14] =?UTF-8?q?M3-337=20Feat=20:=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=96=B4=20=EC=97=86=EC=9D=84=EC=8B=9C=20=EC=83=81=EC=9C=84?= =?UTF-8?q?=EB=9E=AD=ED=82=B9=EA=B7=B8=EB=A3=B9=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/app_colors.dart | 1 + lib/screens/search_group_screen.dart | 169 +++++++++++----------- lib/widgets/community/community_list.dart | 109 ++++++++++++++ 3 files changed, 195 insertions(+), 84 deletions(-) create mode 100644 lib/widgets/community/community_list.dart diff --git a/lib/constants/app_colors.dart b/lib/constants/app_colors.dart index ab2a8e83..9aee80b1 100644 --- a/lib/constants/app_colors.dart +++ b/lib/constants/app_colors.dart @@ -19,4 +19,5 @@ class AppColors { static const Color boxColorThird = Color(0xFF292929); static const Color buttonColor = Colors.white; static const Color navigationBarColor = Color(0xFF1D1D1D); + static const Color subLineColor = Color(0xFF262626); } diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index 2a2ac18b..06dfd2bf 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -6,6 +6,7 @@ import 'package:intl/intl.dart'; import '../constants/app_colors.dart'; import '../controllers/search_group_controller.dart'; +import '../widgets/community/community_list.dart'; import 'community_info_screen.dart'; import 'community_screen.dart'; @@ -105,93 +106,93 @@ class SearchGroupScreen extends StatelessWidget { body: Column( children: [ Expanded( - child: Obx(() { - if (groupSearchController.searchResult.isEmpty || - groupSearchController.searchResult.isEmpty) { - return Center( - child: Text( - '그룹이 없습니다!', - style: TextStyle(color: AppColors.textPrimary), - ), - ); - } else { - return ListView.builder( - itemCount: groupSearchController.searchResult.length, - itemBuilder: (context, index) { - return ListTile( - title: InkWell( - onTap: () { - Get.to(() => CommunityInfoScreen( - groupId: groupSearchController - .searchResult[index].id)); - }, - child: Container( - child: Row( - children: [ - checkFileExtension(groupSearchController - .searchResult[index] - .backgroundImageUrl) == - 'svg' - ? SvgPicture.network( - groupSearchController - .searchResult[index] - .backgroundImageUrl, - width: 38, - ) - : Image( - image: CachedNetworkImageProvider( - groupSearchController - .searchResult[index] - .backgroundImageUrl), - width: 38, - ), - SizedBox(width: 8), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - groupSearchController - .searchResult[index].name, - style: TextStyle( - color: AppColors.textPrimary, - ), - ), - Row( - children: [ - Text( - '${formatNumber(1122)}px', - style: TextStyle( - color: AppColors.primary), - ), - Text( - 'ㆍ', - style: TextStyle( - color: AppColors.textForth), - ), - Text( - '누적 ${formatNumber(2222)}px', - style: TextStyle( - color: AppColors.textForth), - ), - ], - ), - ], - ), - Spacer(), - Icon( - Icons.arrow_forward_ios, - color: AppColors.textPrimary, - size: 20, - ), - ], + child: groupSearchController.searchController.text.isEmpty + ? Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '상위 랭킹 그룹', + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.w500, + color: AppColors.textPrimary), + ), + SizedBox(height: 10), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(16)), + color: AppColors.boxColor, + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 17), + child: Column( + children: [ + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '1등 그룹', + isSearched: 1, + ), + Divider( + thickness: 1, + color: AppColors.subLineColor, + ), + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '2등 그룹', + isSearched: 2, + ), + Divider( + thickness: 1, + color: AppColors.subLineColor, + ), + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '2등 그룹', + isSearched: 3, + ), + ], + ), ), + ) + ], + ), + ) + : groupSearchController.searchResult.isEmpty + ? Center( + child: Text( + '그룹이 없습니다!', + style: TextStyle(color: AppColors.textPrimary), ), + ) + : ListView.builder( + itemCount: groupSearchController.searchResult.length, + itemBuilder: (context, index) { + return ListTile( + title: InkWell( + onTap: () { + Get.to( + () => CommunityInfoScreen( + groupId: groupSearchController + .searchResult[index].id), + ); + }, + child: CommunityList( + imageUrl: groupSearchController + .searchResult[index].backgroundImageUrl, + communityName: groupSearchController + .searchResult[index].name, + isSearched: 0, + ), + ), + ); + }, ), - ); - }, - ); - } - }), ), ], ), diff --git a/lib/widgets/community/community_list.dart b/lib/widgets/community/community_list.dart new file mode 100644 index 00000000..1f73103b --- /dev/null +++ b/lib/widgets/community/community_list.dart @@ -0,0 +1,109 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:intl/intl.dart'; + +import '../../constants/app_colors.dart'; + +class CommunityList extends StatelessWidget { + const CommunityList( + {super.key, required this.imageUrl, required this.communityName, required this.isSearched}); + + final String imageUrl; + final String communityName; + final int isSearched; + + @override + Widget build(BuildContext context) { + return Container( + child: Row( + children: [ + checkFileExtension(imageUrl) == + 'svg' + ? SvgPicture.network( + imageUrl, + width: 38, + ) + : Image( + image: CachedNetworkImageProvider(imageUrl), + width: 40, + ), + SizedBox(width: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + communityName, + style: TextStyle( + color: AppColors.textPrimary, + ), + ), + Row( + children: [ + Text( + '${formatNumber(1122)}px', + style: TextStyle(color: AppColors.primary), + ), + Text( + 'ㆍ', + style: TextStyle(color: AppColors.textForth), + ), + Text( + '누적 ${formatNumber(2222)}px', + style: TextStyle(color: AppColors.textForth), + ), + ], + ), + ], + ), + Spacer(), + selectIcon(isSearched), + ], + ), + ); + } + + String checkFileExtension(String url) { + Uri uri = Uri.parse(url); + String path = uri.path; + + if (path.contains('.')) { + return path.split('.').last; + } else { + return ''; + } + } + + String formatNumber(int number) { + final formatter = NumberFormat('#,###'); + return formatter.format(number); + } + + Widget selectIcon(int number){ + switch(number){ + case 0: + return Icon( + Icons.arrow_forward_ios, + color: AppColors.textPrimary, + size: 20, + ); + case 1: + return Image.asset( + 'assets/images/1st_place_medal.png', + width: 30, + ); + case 2: + return Image.asset( + 'assets/images/2nd_place_medal.png', + width: 30, + ); + case 3: + return Image.asset( + 'assets/images/3rd_place_medal.png', + width: 30, + ); + default: + return Container(); + } + } +} From 72d1df374b9972afba67e762c53c331674f3b2d3 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:25:35 +0900 Subject: [PATCH 08/14] =?UTF-8?q?M3-337=20Feat=20:=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=82=AC=EC=9D=B4=20=EC=84=A0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screens/search_group_screen.dart | 55 +++++++---- lib/widgets/community/community_list.dart | 109 ++++++++++++---------- 2 files changed, 97 insertions(+), 67 deletions(-) diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index 06dfd2bf..548369ac 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -13,11 +13,14 @@ import 'community_screen.dart'; class SearchGroupScreen extends StatelessWidget { const SearchGroupScreen({super.key}); + @override Widget build(BuildContext context) { final GroupSearchController groupSearchController = Get.put(GroupSearchController()); + const double betweenLine = 15; + return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); @@ -127,33 +130,39 @@ class SearchGroupScreen extends StatelessWidget { color: AppColors.boxColor, ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 17), + padding: const EdgeInsets.symmetric( + horizontal: 20, vertical: 17), child: Column( children: [ CommunityList( imageUrl: 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', communityName: '1등 그룹', + communityId: 1, isSearched: 1, ), Divider( thickness: 1, color: AppColors.subLineColor, + height: betweenLine, ), CommunityList( imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', communityName: '2등 그룹', + communityId: 2, isSearched: 2, ), Divider( thickness: 1, color: AppColors.subLineColor, + height: betweenLine, ), CommunityList( imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', communityName: '2등 그룹', + communityId: 3, isSearched: 3, ), ], @@ -173,23 +182,31 @@ class SearchGroupScreen extends StatelessWidget { : ListView.builder( itemCount: groupSearchController.searchResult.length, itemBuilder: (context, index) { - return ListTile( - title: InkWell( - onTap: () { - Get.to( - () => CommunityInfoScreen( - groupId: groupSearchController - .searchResult[index].id), - ); - }, - child: CommunityList( - imageUrl: groupSearchController - .searchResult[index].backgroundImageUrl, - communityName: groupSearchController - .searchResult[index].name, - isSearched: 0, + return Column( + children: [ + ListTile( + title: CommunityList( + imageUrl: groupSearchController + .searchResult[index].backgroundImageUrl, + communityName: groupSearchController + .searchResult[index].name, + communityId: groupSearchController + .searchResult[index].id, + isSearched: 0, + ), ), - ), + if (index < + groupSearchController.searchResult.length - + 1) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Divider( + thickness: 1, // 선의 두께 + color: AppColors.subLineColor, + height: 1,// 선의 색상 + ), + ), + ], ); }, ), diff --git a/lib/widgets/community/community_list.dart b/lib/widgets/community/community_list.dart index 1f73103b..7d9f45c0 100644 --- a/lib/widgets/community/community_list.dart +++ b/lib/widgets/community/community_list.dart @@ -1,64 +1,77 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:get/get.dart'; import 'package:intl/intl.dart'; import '../../constants/app_colors.dart'; +import '../../screens/community_info_screen.dart'; class CommunityList extends StatelessWidget { const CommunityList( - {super.key, required this.imageUrl, required this.communityName, required this.isSearched}); + {super.key, + required this.imageUrl, + required this.communityName, + required this.isSearched, + required this.communityId}); final String imageUrl; final String communityName; + final int communityId; final int isSearched; @override Widget build(BuildContext context) { - return Container( - child: Row( - children: [ - checkFileExtension(imageUrl) == - 'svg' - ? SvgPicture.network( - imageUrl, - width: 38, - ) - : Image( - image: CachedNetworkImageProvider(imageUrl), - width: 40, - ), - SizedBox(width: 8), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - communityName, - style: TextStyle( - color: AppColors.textPrimary, - ), - ), - Row( - children: [ - Text( - '${formatNumber(1122)}px', - style: TextStyle(color: AppColors.primary), - ), - Text( - 'ㆍ', - style: TextStyle(color: AppColors.textForth), + return ListTile( + title: InkWell( + onTap: () { + Get.to( + () => CommunityInfoScreen(groupId: communityId), + ); + }, + child: Row( + children: [ + checkFileExtension(imageUrl) == 'svg' + ? SvgPicture.network( + imageUrl, + width: 38, + ) + : Image( + image: CachedNetworkImageProvider(imageUrl), + width: 40, ), - Text( - '누적 ${formatNumber(2222)}px', - style: TextStyle(color: AppColors.textForth), + SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + communityName, + style: TextStyle( + color: AppColors.textPrimary, ), - ], - ), - ], - ), - Spacer(), - selectIcon(isSearched), - ], + ), + Row( + children: [ + Text( + '${formatNumber(1122)}px', + style: TextStyle(color: AppColors.primary), + ), + Text( + 'ㆍ', + style: TextStyle(color: AppColors.textForth), + ), + Text( + '누적 ${formatNumber(2222)}px', + style: TextStyle(color: AppColors.textForth), + ), + ], + ), + ], + ), + Spacer(), + selectIcon(isSearched), + ], + ), ), ); } @@ -79,8 +92,8 @@ class CommunityList extends StatelessWidget { return formatter.format(number); } - Widget selectIcon(int number){ - switch(number){ + Widget selectIcon(int number) { + switch (number) { case 0: return Icon( Icons.arrow_forward_ios, @@ -90,17 +103,17 @@ class CommunityList extends StatelessWidget { case 1: return Image.asset( 'assets/images/1st_place_medal.png', - width: 30, + width: 40, ); case 2: return Image.asset( 'assets/images/2nd_place_medal.png', - width: 30, + width: 40, ); case 3: return Image.asset( 'assets/images/3rd_place_medal.png', - width: 30, + width: 40, ); default: return Container(); From 7fa1d76b2f874cad894f6a2470306938be9d4b3e Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:30:05 +0900 Subject: [PATCH 09/14] M3-337 Feat : dart fix --- lib/models/search_group.dart | 4 ++-- lib/screens/search_group_screen.dart | 14 +++++--------- lib/widgets/community/community_list.dart | 2 +- lib/widgets/my_page/user_info.dart | 1 - 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/models/search_group.dart b/lib/models/search_group.dart index 9deb4e7f..6ab5f503 100644 --- a/lib/models/search_group.dart +++ b/lib/models/search_group.dart @@ -8,7 +8,7 @@ class SearchGroupResult { {required this.name, required this.backgroundImageUrl, required this.communityColor, - required this.id}); + required this.id,}); factory SearchGroupResult.fromJson(Map json) { return switch (json) { @@ -31,7 +31,7 @@ class SearchGroupResult { static List listFromJson(List jsonList) { return [ for (var element in jsonList) - if (element != null) SearchGroupResult.fromJson(element) + if (element != null) SearchGroupResult.fromJson(element), ]; } } diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index 548369ac..e4040abf 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -1,14 +1,10 @@ -import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; import '../constants/app_colors.dart'; import '../controllers/search_group_controller.dart'; import '../widgets/community/community_list.dart'; -import 'community_info_screen.dart'; -import 'community_screen.dart'; class SearchGroupScreen extends StatelessWidget { const SearchGroupScreen({super.key}); @@ -56,7 +52,7 @@ class SearchGroupScreen extends StatelessWidget { Expanded( child: Padding( padding: const EdgeInsets.symmetric( - vertical: 10, horizontal: 5), + vertical: 10, horizontal: 5,), child: TextField( controller: groupSearchController.searchController, autofocus: false, @@ -77,7 +73,7 @@ class SearchGroupScreen extends StatelessWidget { ), border: InputBorder.none, contentPadding: - EdgeInsets.symmetric(vertical: 11)), + EdgeInsets.symmetric(vertical: 11),), style: TextStyle( fontSize: 17.0, color: AppColors.textPrimary, @@ -120,7 +116,7 @@ class SearchGroupScreen extends StatelessWidget { style: TextStyle( fontSize: 22, fontWeight: FontWeight.w500, - color: AppColors.textPrimary), + color: AppColors.textPrimary,), ), SizedBox(height: 10), Container( @@ -131,7 +127,7 @@ class SearchGroupScreen extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric( - horizontal: 20, vertical: 17), + horizontal: 20, vertical: 17,), child: Column( children: [ CommunityList( @@ -168,7 +164,7 @@ class SearchGroupScreen extends StatelessWidget { ], ), ), - ) + ), ], ), ) diff --git a/lib/widgets/community/community_list.dart b/lib/widgets/community/community_list.dart index 7d9f45c0..053ef0b0 100644 --- a/lib/widgets/community/community_list.dart +++ b/lib/widgets/community/community_list.dart @@ -13,7 +13,7 @@ class CommunityList extends StatelessWidget { required this.imageUrl, required this.communityName, required this.isSearched, - required this.communityId}); + required this.communityId,}); final String imageUrl; final String communityName; diff --git a/lib/widgets/my_page/user_info.dart b/lib/widgets/my_page/user_info.dart index 54ba0e3f..754385b9 100644 --- a/lib/widgets/my_page/user_info.dart +++ b/lib/widgets/my_page/user_info.dart @@ -5,7 +5,6 @@ import 'package:get/get.dart'; import '../../constants/app_colors.dart'; import '../../constants/text_styles.dart'; import '../../controllers/my_page_controller.dart'; -import '../../screens/search_group_screen.dart'; import '../../screens/user_info_update_screen.dart'; class UserInfo extends StatelessWidget { From b01b4f1c98511f8ec0cbb2ccc4803f9ba8bfda9d Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:49:28 +0900 Subject: [PATCH 10/14] =?UTF-8?q?M3-337=20Feat=20:=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=96=B4=20=EB=8F=99=EC=A0=81=20=EC=9D=B8=EC=8B=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controllers/search_group_controller.dart | 53 +++- lib/screens/search_group_screen.dart | 240 ++++++++++--------- 2 files changed, 166 insertions(+), 127 deletions(-) diff --git a/lib/controllers/search_group_controller.dart b/lib/controllers/search_group_controller.dart index 430a58db..5dc891e8 100644 --- a/lib/controllers/search_group_controller.dart +++ b/lib/controllers/search_group_controller.dart @@ -5,33 +5,62 @@ import '../service/community_service.dart'; class GroupSearchController extends GetxController { RxList searchResult = [].obs; - FocusNode searchFocusnode = FocusNode(); - TextEditingController searchController = TextEditingController(); + FocusNode searchFocusNode = FocusNode(); + late final TextEditingController textEditingController; + + RxString searchKeyword = "".obs; + RxString imageUrl = "".obs; + RxString communityName = "".obs; + RxInt communityId = 0.obs; CommunityService communityService = CommunityService(); @override void onInit() { super.onInit(); - searchFocusnode.addListener(() { - if (searchFocusnode.hasFocus) { - searchController.selection = TextSelection( - baseOffset: 0, - extentOffset: searchController.text.length, - ); - } - }); + textEditingController = TextEditingController(text: searchKeyword.value); + searchFocusNode.addListener( + () { + if (searchFocusNode.hasFocus) { + textEditingController.selection = TextSelection( + baseOffset: 0, + extentOffset: textEditingController.text.length, + ); + } + }, + ); } @override - void onClose() { - searchFocusnode.dispose(); + Future onClose() async { + await textDispose(); super.onClose(); } + Future textDispose() async { + textEditingController.dispose(); + searchFocusNode.dispose(); + } + void getSearchedGroup(keyword) async { List getInstance = await communityService.getSearchCommunities(searchKeyword: keyword); searchResult.assignAll(getInstance); } + + void updateKeyword(String value) { + print('1111 ${value}'); + searchKeyword.value = value; + if (textEditingController.text.isNotEmpty) { + getSearchedGroup(value); + }else{ + searchResult.clear(); + } + } + + void updateCommunityInfo(dynamic communityInfo){ + imageUrl.value = communityInfo.backgroundImageUrl; + communityName.value = communityInfo.name; + communityId.value = communityInfo.id; + } } diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index e4040abf..b5e13bf0 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -9,7 +9,6 @@ import '../widgets/community/community_list.dart'; class SearchGroupScreen extends StatelessWidget { const SearchGroupScreen({super.key}); - @override Widget build(BuildContext context) { final GroupSearchController groupSearchController = @@ -52,28 +51,26 @@ class SearchGroupScreen extends StatelessWidget { Expanded( child: Padding( padding: const EdgeInsets.symmetric( - vertical: 10, horizontal: 5,), + vertical: 10, + horizontal: 5, + ), child: TextField( - controller: groupSearchController.searchController, + controller: + groupSearchController.textEditingController, autofocus: false, - focusNode: groupSearchController.searchFocusnode, - onChanged: (value) { - if (groupSearchController - .searchController.text.isNotEmpty) { - groupSearchController.getSearchedGroup( - groupSearchController.searchController.text, - ); - } - }, + focusNode: groupSearchController.searchFocusNode, + onChanged: groupSearchController.updateKeyword, + onSubmitted: groupSearchController.updateKeyword, decoration: InputDecoration( - hintText: '그룹을 검색해주세요', - hintStyle: TextStyle( - color: AppColors.textPrimary, - fontSize: 11, - ), - border: InputBorder.none, - contentPadding: - EdgeInsets.symmetric(vertical: 11),), + hintText: '그룹을 검색해주세요', + hintStyle: TextStyle( + color: AppColors.textPrimary, + fontSize: 11, + ), + border: InputBorder.none, + contentPadding: EdgeInsets.symmetric( + vertical: 11, horizontal: 7), + ), style: TextStyle( fontSize: 17.0, color: AppColors.textPrimary, @@ -84,7 +81,7 @@ class SearchGroupScreen extends StatelessWidget { IconButton( onPressed: () { String keyword = - groupSearchController.searchController.text; + groupSearchController.textEditingController.text; if (keyword.isNotEmpty) { groupSearchController.getSearchedGroup(keyword); } @@ -104,108 +101,121 @@ class SearchGroupScreen extends StatelessWidget { ), body: Column( children: [ - Expanded( - child: groupSearchController.searchController.text.isEmpty - ? Padding( - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '상위 랭킹 그룹', - style: TextStyle( + Obx( + () => Expanded( + child: groupSearchController.searchKeyword.value=="" + ? Padding( + padding: const EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '상위 랭킹 그룹', + style: TextStyle( fontSize: 22, fontWeight: FontWeight.w500, - color: AppColors.textPrimary,), - ), - SizedBox(height: 10), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(16)), - color: AppColors.boxColor, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, vertical: 17,), - child: Column( - children: [ - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '1등 그룹', - communityId: 1, - isSearched: 1, - ), - Divider( - thickness: 1, - color: AppColors.subLineColor, - height: betweenLine, - ), - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '2등 그룹', - communityId: 2, - isSearched: 2, - ), - Divider( - thickness: 1, - color: AppColors.subLineColor, - height: betweenLine, - ), - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '2등 그룹', - communityId: 3, - isSearched: 3, - ), - ], + color: AppColors.textPrimary, ), ), - ), - ], - ), - ) - : groupSearchController.searchResult.isEmpty - ? Center( - child: Text( - '그룹이 없습니다!', - style: TextStyle(color: AppColors.textPrimary), - ), - ) - : ListView.builder( - itemCount: groupSearchController.searchResult.length, - itemBuilder: (context, index) { - return Column( - children: [ - ListTile( - title: CommunityList( - imageUrl: groupSearchController - .searchResult[index].backgroundImageUrl, - communityName: groupSearchController - .searchResult[index].name, - communityId: groupSearchController - .searchResult[index].id, - isSearched: 0, - ), + SizedBox(height: 10), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(16)), + color: AppColors.boxColor, + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20, + vertical: 17, ), - if (index < - groupSearchController.searchResult.length - - 1) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Divider( - thickness: 1, // 선의 두께 + child: Column( + children: [ + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '1등 그룹', + communityId: 1, + isSearched: 1, + ), + Divider( + thickness: 1, color: AppColors.subLineColor, - height: 1,// 선의 색상 + height: betweenLine, ), - ), - ], - ); - }, + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '2등 그룹', + communityId: 2, + isSearched: 2, + ), + Divider( + thickness: 1, + color: AppColors.subLineColor, + height: betweenLine, + ), + CommunityList( + imageUrl: + 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', + communityName: '2등 그룹', + communityId: 3, + isSearched: 3, + ), + ], + ), + ), + ), + ], ), + ) + : Obx(() { + if (groupSearchController.searchResult.isEmpty) { + return Center( + child: Text( + '그룹이 없습니다!', + style: TextStyle(color: AppColors.textPrimary), + ), + ); + } else { + return ListView.builder( + itemCount: groupSearchController.searchResult.length, + itemBuilder: (context, index) { + groupSearchController.updateCommunityInfo( + groupSearchController.searchResult[index]); + + return Column( + children: [ + ListTile( + title: CommunityList( + imageUrl: + groupSearchController.imageUrl.value, + communityName: groupSearchController + .communityName.value, + communityId: + groupSearchController.communityId.value, + isSearched: 0, + ), + ), + if (index < + groupSearchController.searchResult.length - + 1) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 25), + child: Divider( + thickness: 1, // 선의 두께 + color: AppColors.subLineColor, + height: 1, // 선의 색상 + ), + ), + ], + ); + }, + ); + } + }), + ), ), ], ), From 097b9d8d4364931ad0ce71c7eac0c983511158c6 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:54:44 +0900 Subject: [PATCH 11/14] M3-337 Feat : dart fix --- lib/controllers/search_group_controller.dart | 1 - lib/screens/search_group_screen.dart | 24 ++++++++++++-------- lib/service/community_service.dart | 1 - 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/controllers/search_group_controller.dart b/lib/controllers/search_group_controller.dart index 5dc891e8..957befe7 100644 --- a/lib/controllers/search_group_controller.dart +++ b/lib/controllers/search_group_controller.dart @@ -49,7 +49,6 @@ class GroupSearchController extends GetxController { } void updateKeyword(String value) { - print('1111 ${value}'); searchKeyword.value = value; if (textEditingController.text.isNotEmpty) { getSearchedGroup(value); diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index b5e13bf0..ab83e573 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -69,7 +69,9 @@ class SearchGroupScreen extends StatelessWidget { ), border: InputBorder.none, contentPadding: EdgeInsets.symmetric( - vertical: 11, horizontal: 7), + vertical: 11, + horizontal: 7, + ), ), style: TextStyle( fontSize: 17.0, @@ -102,8 +104,8 @@ class SearchGroupScreen extends StatelessWidget { body: Column( children: [ Obx( - () => Expanded( - child: groupSearchController.searchKeyword.value=="" + () => Expanded( + child: groupSearchController.searchKeyword.value == "" ? Padding( padding: const EdgeInsets.all(15), child: Column( @@ -179,10 +181,12 @@ class SearchGroupScreen extends StatelessWidget { ); } else { return ListView.builder( - itemCount: groupSearchController.searchResult.length, + itemCount: + groupSearchController.searchResult.length, itemBuilder: (context, index) { groupSearchController.updateCommunityInfo( - groupSearchController.searchResult[index]); + groupSearchController.searchResult[index], + ); return Column( children: [ @@ -192,17 +196,19 @@ class SearchGroupScreen extends StatelessWidget { groupSearchController.imageUrl.value, communityName: groupSearchController .communityName.value, - communityId: - groupSearchController.communityId.value, + communityId: groupSearchController + .communityId.value, isSearched: 0, ), ), if (index < - groupSearchController.searchResult.length - + groupSearchController + .searchResult.length - 1) Padding( padding: const EdgeInsets.symmetric( - horizontal: 25), + horizontal: 25, + ), child: Divider( thickness: 1, // 선의 두께 color: AppColors.subLineColor, diff --git a/lib/service/community_service.dart b/lib/service/community_service.dart index f073115d..7550dacf 100644 --- a/lib/service/community_service.dart +++ b/lib/service/community_service.dart @@ -26,7 +26,6 @@ class CommunityService { '/communities', queryParameters: {'searchKeyword': searchKeyword}, ); - print('2222 ${response.data['data']}'); return SearchGroupResult.listFromJson(response.data['data']); } } From 76cc2e6a50e9a3df2ba5b8f55d05746b1aad9bc3 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Mon, 9 Sep 2024 00:28:46 +0900 Subject: [PATCH 12/14] M3-337 Feat : name refactor --- ....dart => search_community_controller.dart} | 2 +- lib/screens/search_group_screen.dart | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) rename lib/controllers/{search_group_controller.dart => search_community_controller.dart} (96%) diff --git a/lib/controllers/search_group_controller.dart b/lib/controllers/search_community_controller.dart similarity index 96% rename from lib/controllers/search_group_controller.dart rename to lib/controllers/search_community_controller.dart index 957befe7..932c3b7c 100644 --- a/lib/controllers/search_group_controller.dart +++ b/lib/controllers/search_community_controller.dart @@ -3,7 +3,7 @@ import 'package:get/get.dart'; import '../service/community_service.dart'; -class GroupSearchController extends GetxController { +class SearchCommunityController extends GetxController { RxList searchResult = [].obs; FocusNode searchFocusNode = FocusNode(); late final TextEditingController textEditingController; diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_group_screen.dart index ab83e573..3284f618 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_group_screen.dart @@ -3,7 +3,7 @@ import 'package:get/get.dart'; import 'package:intl/intl.dart'; import '../constants/app_colors.dart'; -import '../controllers/search_group_controller.dart'; +import '../controllers/search_community_controller.dart'; import '../widgets/community/community_list.dart'; class SearchGroupScreen extends StatelessWidget { @@ -11,8 +11,8 @@ class SearchGroupScreen extends StatelessWidget { @override Widget build(BuildContext context) { - final GroupSearchController groupSearchController = - Get.put(GroupSearchController()); + final SearchCommunityController searchCommunityController = + Get.put(SearchCommunityController()); const double betweenLine = 15; @@ -56,11 +56,11 @@ class SearchGroupScreen extends StatelessWidget { ), child: TextField( controller: - groupSearchController.textEditingController, + searchCommunityController.textEditingController, autofocus: false, - focusNode: groupSearchController.searchFocusNode, - onChanged: groupSearchController.updateKeyword, - onSubmitted: groupSearchController.updateKeyword, + focusNode: searchCommunityController.searchFocusNode, + onChanged: searchCommunityController.updateKeyword, + onSubmitted: searchCommunityController.updateKeyword, decoration: InputDecoration( hintText: '그룹을 검색해주세요', hintStyle: TextStyle( @@ -83,9 +83,9 @@ class SearchGroupScreen extends StatelessWidget { IconButton( onPressed: () { String keyword = - groupSearchController.textEditingController.text; + searchCommunityController.textEditingController.text; if (keyword.isNotEmpty) { - groupSearchController.getSearchedGroup(keyword); + searchCommunityController.getSearchedGroup(keyword); } }, icon: Icon( @@ -105,7 +105,7 @@ class SearchGroupScreen extends StatelessWidget { children: [ Obx( () => Expanded( - child: groupSearchController.searchKeyword.value == "" + child: searchCommunityController.searchKeyword.value == "" ? Padding( padding: const EdgeInsets.all(15), child: Column( @@ -172,7 +172,7 @@ class SearchGroupScreen extends StatelessWidget { ), ) : Obx(() { - if (groupSearchController.searchResult.isEmpty) { + if (searchCommunityController.searchResult.isEmpty) { return Center( child: Text( '그룹이 없습니다!', @@ -182,10 +182,10 @@ class SearchGroupScreen extends StatelessWidget { } else { return ListView.builder( itemCount: - groupSearchController.searchResult.length, + searchCommunityController.searchResult.length, itemBuilder: (context, index) { - groupSearchController.updateCommunityInfo( - groupSearchController.searchResult[index], + searchCommunityController.updateCommunityInfo( + searchCommunityController.searchResult[index], ); return Column( @@ -193,16 +193,16 @@ class SearchGroupScreen extends StatelessWidget { ListTile( title: CommunityList( imageUrl: - groupSearchController.imageUrl.value, - communityName: groupSearchController + searchCommunityController.imageUrl.value, + communityName: searchCommunityController .communityName.value, - communityId: groupSearchController + communityId: searchCommunityController .communityId.value, isSearched: 0, ), ), if (index < - groupSearchController + searchCommunityController .searchResult.length - 1) Padding( From 38f1dbf4c68be4596a6ab6c793c4f11196d538d8 Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:54:52 +0900 Subject: [PATCH 13/14] =?UTF-8?q?M3-337=20Feat=20:=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20pr=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search_community_controller.dart | 2 +- ...up.dart => search_community_response.dart} | 12 +-- lib/screens/no_community_screen.dart | 4 +- ...reen.dart => search_community_screen.dart} | 75 +------------------ lib/service/community_service.dart | 6 +- lib/widgets/community/community_list.dart | 16 ---- 6 files changed, 15 insertions(+), 100 deletions(-) rename lib/models/{search_group.dart => search_community_response.dart} (68%) rename lib/screens/{search_group_screen.dart => search_community_screen.dart} (65%) diff --git a/lib/controllers/search_community_controller.dart b/lib/controllers/search_community_controller.dart index 932c3b7c..b649f452 100644 --- a/lib/controllers/search_community_controller.dart +++ b/lib/controllers/search_community_controller.dart @@ -13,7 +13,7 @@ class SearchCommunityController extends GetxController { RxString communityName = "".obs; RxInt communityId = 0.obs; - CommunityService communityService = CommunityService(); + final CommunityService communityService = CommunityService(); @override void onInit() { diff --git a/lib/models/search_group.dart b/lib/models/search_community_response.dart similarity index 68% rename from lib/models/search_group.dart rename to lib/models/search_community_response.dart index 6ab5f503..9a26a671 100644 --- a/lib/models/search_group.dart +++ b/lib/models/search_community_response.dart @@ -1,16 +1,16 @@ -class SearchGroupResult { +class SearchCommunityResponse { String name; String backgroundImageUrl; String communityColor; int id; - SearchGroupResult( + SearchCommunityResponse( {required this.name, required this.backgroundImageUrl, required this.communityColor, required this.id,}); - factory SearchGroupResult.fromJson(Map json) { + factory SearchCommunityResponse.fromJson(Map json) { return switch (json) { { 'name': var name, @@ -18,7 +18,7 @@ class SearchGroupResult { 'communityColor': var communityColor, 'id': var id } => - SearchGroupResult( + SearchCommunityResponse( name: name, backgroundImageUrl: backgroundImageUrl, communityColor: communityColor, @@ -28,10 +28,10 @@ class SearchGroupResult { }; } - static List listFromJson(List jsonList) { + static List listFromJson(List jsonList) { return [ for (var element in jsonList) - if (element != null) SearchGroupResult.fromJson(element), + if (element != null) SearchCommunityResponse.fromJson(element), ]; } } diff --git a/lib/screens/no_community_screen.dart b/lib/screens/no_community_screen.dart index f28282cf..e4a4511a 100644 --- a/lib/screens/no_community_screen.dart +++ b/lib/screens/no_community_screen.dart @@ -3,7 +3,7 @@ import 'package:get/get.dart'; import '../constants/app_colors.dart'; import '../constants/text_styles.dart'; -import 'search_group_screen.dart'; +import 'search_community_screen.dart'; class NoCommunityScreen extends StatelessWidget { const NoCommunityScreen({super.key}); @@ -36,7 +36,7 @@ class NoCommunityScreen extends StatelessWidget { InkWell( borderRadius: BorderRadius.all(Radius.circular(16)), onTap: () { - Get.to(SearchGroupScreen()); + Get.to(SearchCommunityScreen()); }, child: Ink( decoration: BoxDecoration( diff --git a/lib/screens/search_group_screen.dart b/lib/screens/search_community_screen.dart similarity index 65% rename from lib/screens/search_group_screen.dart rename to lib/screens/search_community_screen.dart index 3284f618..20cb3ad0 100644 --- a/lib/screens/search_group_screen.dart +++ b/lib/screens/search_community_screen.dart @@ -6,8 +6,8 @@ import '../constants/app_colors.dart'; import '../controllers/search_community_controller.dart'; import '../widgets/community/community_list.dart'; -class SearchGroupScreen extends StatelessWidget { - const SearchGroupScreen({super.key}); +class SearchCommunityScreen extends StatelessWidget { + const SearchCommunityScreen({super.key}); @override Widget build(BuildContext context) { @@ -106,71 +106,7 @@ class SearchGroupScreen extends StatelessWidget { Obx( () => Expanded( child: searchCommunityController.searchKeyword.value == "" - ? Padding( - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '상위 랭킹 그룹', - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.w500, - color: AppColors.textPrimary, - ), - ), - SizedBox(height: 10), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(16)), - color: AppColors.boxColor, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 17, - ), - child: Column( - children: [ - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '1등 그룹', - communityId: 1, - isSearched: 1, - ), - Divider( - thickness: 1, - color: AppColors.subLineColor, - height: betweenLine, - ), - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '2등 그룹', - communityId: 2, - isSearched: 2, - ), - Divider( - thickness: 1, - color: AppColors.subLineColor, - height: betweenLine, - ), - CommunityList( - imageUrl: - 'https://ground-flip-s3.s3.ap-northeast-2.amazonaws.com/university_logo/ads+%EC%9D%B4%EB%AF%B8%EC%A7%802.png', - communityName: '2등 그룹', - communityId: 3, - isSearched: 3, - ), - ], - ), - ), - ), - ], - ), - ) + ? Container() : Obx(() { if (searchCommunityController.searchResult.isEmpty) { return Center( @@ -239,9 +175,4 @@ class SearchGroupScreen extends StatelessWidget { return ''; } } - - String formatNumber(int number) { - final formatter = NumberFormat('#,###'); - return formatter.format(number); - } } diff --git a/lib/service/community_service.dart b/lib/service/community_service.dart index 7550dacf..6cdcdb33 100644 --- a/lib/service/community_service.dart +++ b/lib/service/community_service.dart @@ -1,7 +1,7 @@ import 'package:dio/dio.dart'; import '../models/community.dart'; -import '../models/search_group.dart'; +import '../models/search_community_response.dart'; import '../utils/dio_service.dart'; class CommunityService { @@ -19,13 +19,13 @@ class CommunityService { return Community.fromJson(response.data['data']); } - Future> getSearchCommunities({ + Future> getSearchCommunities({ required String searchKeyword, }) async { var response = await dio.get( '/communities', queryParameters: {'searchKeyword': searchKeyword}, ); - return SearchGroupResult.listFromJson(response.data['data']); + return SearchCommunityResponse.listFromJson(response.data['data']); } } diff --git a/lib/widgets/community/community_list.dart b/lib/widgets/community/community_list.dart index 053ef0b0..f3ae5585 100644 --- a/lib/widgets/community/community_list.dart +++ b/lib/widgets/community/community_list.dart @@ -50,22 +50,6 @@ class CommunityList extends StatelessWidget { color: AppColors.textPrimary, ), ), - Row( - children: [ - Text( - '${formatNumber(1122)}px', - style: TextStyle(color: AppColors.primary), - ), - Text( - 'ㆍ', - style: TextStyle(color: AppColors.textForth), - ), - Text( - '누적 ${formatNumber(2222)}px', - style: TextStyle(color: AppColors.textForth), - ), - ], - ), ], ), Spacer(), From b2e4a5a4573e5c47424472718ff2137c8e85933c Mon Sep 17 00:00:00 2001 From: cha-imag <100341870+tkdals802@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:36:13 +0900 Subject: [PATCH 14/14] M3-337 Feat : dart fix --- lib/screens/search_community_screen.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/screens/search_community_screen.dart b/lib/screens/search_community_screen.dart index 20cb3ad0..62b7326a 100644 --- a/lib/screens/search_community_screen.dart +++ b/lib/screens/search_community_screen.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:intl/intl.dart'; import '../constants/app_colors.dart'; import '../controllers/search_community_controller.dart'; @@ -14,8 +13,6 @@ class SearchCommunityScreen extends StatelessWidget { final SearchCommunityController searchCommunityController = Get.put(SearchCommunityController()); - const double betweenLine = 15; - return GestureDetector( onTap: () { FocusScope.of(context).unfocus(); @@ -61,7 +58,8 @@ class SearchCommunityScreen extends StatelessWidget { focusNode: searchCommunityController.searchFocusNode, onChanged: searchCommunityController.updateKeyword, onSubmitted: searchCommunityController.updateKeyword, - decoration: InputDecoration( + cursorColor: AppColors.primary, + decoration: InputDecoration( hintText: '그룹을 검색해주세요', hintStyle: TextStyle( color: AppColors.textPrimary,