Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create CustomRefreshIndicator - edited for upgrade #246

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
11 changes: 4 additions & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
- FlutterMacOS
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.9):
Expand Down Expand Up @@ -57,7 +57,6 @@ PODS:
- FlutterMacOS
- permission_handler_apple (9.3.0):
- Flutter
- ReachabilitySwift (5.2.3)
- quill_native_bridge (0.0.1):
- Flutter
- SDWebImage (5.19.2):
Expand All @@ -81,7 +80,7 @@ PODS:
- FlutterMacOS

DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
Expand All @@ -105,13 +104,12 @@ SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- ReachabilitySwift
- SDWebImage
- SwiftyGif

EXTERNAL SOURCES:
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
Expand Down Expand Up @@ -150,7 +148,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
connectivity_plus: 4c41c08fc6d7c91f63bc7aec70ffe3730b04f563
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
Expand All @@ -164,7 +162,6 @@ SPEC CHECKSUMS:
irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979
quill_native_bridge: e5afa7d49c08cf68c52a5e23bc272eba6925c622
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:new_ara_app/pages/bulletin_search_page.dart';
import 'package:new_ara_app/providers/connectivity_provider.dart';
import 'package:new_ara_app/translations/locale_keys.g.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';

import 'package:new_ara_app/constants/board_type.dart';
Expand Down Expand Up @@ -450,14 +451,14 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
_isLoading[10] ||
_isLoading[11]
? const LoadingIndicator()
: RefreshIndicator.adaptive(
displacement: 0.0,
color: ColorsInfo.newara,
: CustomRefreshIndicator(
onRefresh: () async {
//api를 호출 후 최신 데이터로 갱신
await _refreshAllPosts();
},
child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: Column(
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/notification_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:new_ara_app/translations/locale_keys.g.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';

import 'package:dio/dio.dart';
Expand Down Expand Up @@ -195,8 +196,7 @@ class _NotificationPageState extends State<NotificationPage> {
width: MediaQuery.of(context).size.width - 40,
// Android, IOS에 따라 당겨서 새로고침 디자인이 다르므로
// adaptive 적용.
child: RefreshIndicator.adaptive(
color: ColorsInfo.newara,
child: CustomRefreshIndicator(
onRefresh: () async {
// 새로고침 시 첫 페이지만 다시 불러옴.
await _initNotificationPage(userProvider);
Expand Down Expand Up @@ -234,6 +234,8 @@ class _NotificationPageState extends State<NotificationPage> {
),
)
: ListView.separated(
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
controller: _listViewController,
itemCount: _modelList.length + 1,
itemBuilder: (context, idx) {
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/post_list_show_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:new_ara_app/pages/bulletin_search_page.dart';
import 'package:new_ara_app/pages/post_write_page.dart';
import 'package:new_ara_app/providers/connectivity_provider.dart';
import 'package:new_ara_app/translations/locale_keys.g.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';

import 'package:new_ara_app/constants/board_type.dart';
Expand Down Expand Up @@ -480,9 +481,7 @@ class _PostListShowPageState extends State<PostListShowPage>
color: const Color(0xFFF0F0F0),
),
Expanded(
child: RefreshIndicator.adaptive(
displacement: 0.0,
color: ColorsInfo.newara,
child: CustomRefreshIndicator(
onRefresh: () async {
// refresh 중에는 LoadingIndicator를 사용하지 않으므로 setState()는 제거함.
// 로직상 isLoading 변수의 값은 상황에 맞게 변경되도록 함.
Expand All @@ -500,7 +499,8 @@ class _PostListShowPageState extends State<PostListShowPage>
child: isLoading
? const LoadingIndicator()
: ListView.separated(
physics: const AlwaysScrollableScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
controller: _scrollController,
itemCount: postPreviewList.length +
(_isLoadingNextPage ? 1 : 0), // 아이템 개수
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/post_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:new_ara_app/providers/connectivity_provider.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';
import 'package:dio/dio.dart';
import 'package:url_launcher/url_launcher.dart';
Expand Down Expand Up @@ -267,8 +268,7 @@ class _PostViewPageState extends State<PostViewPage> {
// article 부분
Expanded(
// Android, iOS 여부에 따라 다른 새로고침
child: RefreshIndicator.adaptive(
color: ColorsInfo.newara,
child: CustomRefreshIndicator(
onRefresh: () async {
userProvider.setIsContentLoaded(false);
_setIsPageLoaded(false);
Expand All @@ -278,8 +278,8 @@ class _PostViewPageState extends State<PostViewPage> {
child: SingleChildScrollView(
// 위젯이 화면을 넘어가지 않더라고 scrollable 처리.
// 새로고침 기능을 위한 physics.
physics:
const AlwaysScrollableScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
controller: _scrollController,
child: Column(
crossAxisAlignment:
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:new_ara_app/translations/locale_keys.g.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';

Expand Down Expand Up @@ -360,8 +361,7 @@ class _UserPageState extends State<UserPage>
Widget _buildPostList(TabType tabType, UserProvider userProvider) {
// build 대상 tab의 article 개수 조회
int itemCount = getItemCount(tabType);
return RefreshIndicator.adaptive(
color: ColorsInfo.newara,
return CustomRefreshIndicator(
onRefresh: () async {
setIsLoaded(false, tabType);
UserProvider userProvider = context.read<UserProvider>();
Expand All @@ -377,7 +377,8 @@ class _UserPageState extends State<UserPage>
child: ListView.separated(
// item의 개수가 화면을 넘어가지 않더라도 scrollable 취급
// 새로고침 기능을 위해 필요한 physics
physics: const AlwaysScrollableScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
// 다음 페이지 호출시에 사용되는 LoadingIndicator로 인해 1 추가
itemCount: itemCount + 1,
controller: scrollControllerList[tabType.index],
Expand Down
7 changes: 4 additions & 3 deletions lib/pages/user_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:new_ara_app/widgets/refresh_indicator.dart';
import 'package:provider/provider.dart';
import 'package:dio/dio.dart';
import 'package:easy_localization/easy_localization.dart';
Expand Down Expand Up @@ -129,8 +130,7 @@ class _UserViewPageState extends State<UserViewPage> {
? const LoadingIndicator()
: SizedBox(
width: MediaQuery.of(context).size.width,
child: RefreshIndicator.adaptive(
color: ColorsInfo.newara,
child: CustomRefreshIndicator(
onRefresh: () async {
_setIsLoaded(false);
await loadAll(userProvider, 1);
Expand Down Expand Up @@ -222,7 +222,8 @@ class _UserViewPageState extends State<UserViewPage> {
width: MediaQuery.of(context).size.width - 40,
child: ListView.separated(
// PullToRefresh를 위해 아래 physics 추가 필요
physics: const AlwaysScrollableScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(
parent: BouncingScrollPhysics()),
controller: _listViewController,
itemCount: _articleList.length + 1,
itemBuilder: (BuildContext context, int idx) {
Expand Down
Loading