Skip to content

Commit

Permalink
feat: dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
internetova committed Mar 27, 2024
1 parent 41ec3f6 commit 0220360
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
5 changes: 3 additions & 2 deletions example/lib/screens/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ class _ExampleBodyWidget extends StatelessWidget {

final SwipeRefreshStyle style;


@override
Widget build(BuildContext context) {
return Container(
color: _getColor(style),
height: 100,
child: Center(
child: Text(
style == SwipeRefreshStyle.material ? 'Material example' : 'Cupertino example',
style == SwipeRefreshStyle.material
? 'Material example'
: 'Cupertino example',
style: const TextStyle(color: white),
),
),
Expand Down
7 changes: 4 additions & 3 deletions lib/src/cupertino_swipe_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class CupertinoSwipeRefresh extends SwipeRefreshBase {
SwipeRefreshBaseState createState() => _CupertinoSwipeRefreshState();
}

class _CupertinoSwipeRefreshState extends SwipeRefreshBaseState<CupertinoSwipeRefresh> {
class _CupertinoSwipeRefreshState
extends SwipeRefreshBaseState<CupertinoSwipeRefresh> {
late final ScrollController _scrollController;

@override
Expand All @@ -102,8 +103,8 @@ class _CupertinoSwipeRefreshState extends SwipeRefreshBaseState<CupertinoSwipeRe
shrinkWrap: widget.shrinkWrap,
controller: _scrollController,
scrollBehavior: scrollBehavior,
keyboardDismissBehavior:
widget.keyboardDismissBehavior ?? ScrollViewKeyboardDismissBehavior.onDrag,
keyboardDismissBehavior: widget.keyboardDismissBehavior ??
ScrollViewKeyboardDismissBehavior.onDrag,
physics: widget.physics == null
? const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
Expand Down
11 changes: 6 additions & 5 deletions lib/src/material_swipe_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class MaterialSwipeRefresh extends SwipeRefreshBase {
SwipeRefreshBaseState createState() => _MaterialSwipeRefreshState();
}

class _MaterialSwipeRefreshState extends SwipeRefreshBaseState<MaterialSwipeRefresh> {
class _MaterialSwipeRefreshState
extends SwipeRefreshBaseState<MaterialSwipeRefresh> {
@override
Widget buildRefresher(
Key key,
Expand All @@ -107,17 +108,17 @@ class _MaterialSwipeRefreshState extends SwipeRefreshBaseState<MaterialSwipeRefr
padding: widget.padding,
controller: widget.scrollController ?? ScrollController(),
physics: AlwaysScrollableScrollPhysics(parent: widget.physics),
keyboardDismissBehavior:
widget.keyboardDismissBehavior ?? ScrollViewKeyboardDismissBehavior.manual,
keyboardDismissBehavior: widget.keyboardDismissBehavior ??
ScrollViewKeyboardDismissBehavior.manual,
children: children,
)
: ListView.custom(
shrinkWrap: widget.shrinkWrap,
padding: widget.padding,
childrenDelegate: widget.childrenDelegate!,
controller: widget.scrollController ?? ScrollController(),
keyboardDismissBehavior:
widget.keyboardDismissBehavior ?? ScrollViewKeyboardDismissBehavior.manual,
keyboardDismissBehavior: widget.keyboardDismissBehavior ??
ScrollViewKeyboardDismissBehavior.manual,
physics: AlwaysScrollableScrollPhysics(parent: widget.physics),
),
),
Expand Down
11 changes: 6 additions & 5 deletions lib/src/swipe_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ class SwipeRefresh extends StatelessWidget {
RefreshControlIndicatorBuilder? indicatorBuilder,
PlatformWrapper? platform,
}) : backgroundColor = backgroundColor ?? const Color(0xFFFFFFFF),
refreshTriggerPullDistance =
refreshTriggerPullDistance ?? CupertinoSwipeRefresh.defaultRefreshTriggerPullDistance,
refreshIndicatorExtent =
refreshIndicatorExtent ?? CupertinoSwipeRefresh.defaultRefreshIndicatorExtent,
indicatorBuilder = indicatorBuilder ?? CupertinoSliverRefreshControl.buildRefreshIndicator,
refreshTriggerPullDistance = refreshTriggerPullDistance ??
CupertinoSwipeRefresh.defaultRefreshTriggerPullDistance,
refreshIndicatorExtent = refreshIndicatorExtent ??
CupertinoSwipeRefresh.defaultRefreshIndicatorExtent,
indicatorBuilder = indicatorBuilder ??
CupertinoSliverRefreshControl.buildRefreshIndicator,
_platform = platform ?? const PlatformWrapper(),
super(key: key);

Expand Down
5 changes: 3 additions & 2 deletions lib/src/swipe_refresh_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ abstract class SwipeRefreshBase extends StatefulWidget {
SwipeRefreshBaseState createState();
}

abstract class SwipeRefreshBaseState<T extends SwipeRefreshBase> extends State<T> {
abstract class SwipeRefreshBaseState<T extends SwipeRefreshBase>
extends State<T> {
@protected
final GlobalKey refreshKey = GlobalKey();

Expand All @@ -79,7 +80,7 @@ abstract class SwipeRefreshBaseState<T extends SwipeRefreshBase> extends State<T
}

_stateSubscription = widget.stateStream.listen(_updateState);
scrollBehavior = _getScrollBehavior();
scrollBehavior = _getScrollBehavior();
}

void _updateState(SwipeRefreshState newState) {
Expand Down
2 changes: 1 addition & 1 deletion test/swipe_refresh_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void main() {
final testWidget = makeTestableWidget(
SwipeRefresh.builder(
stateStream: stream,
onRefresh: () {
onRefresh: () {
onRefresh().ignore();
},
itemCount: listColors.length,
Expand Down
3 changes: 2 additions & 1 deletion test/swipe_refresh_material_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ void main() {
);

final findSwipeRefresh = find.byType(SwipeRefresh);
final findRefreshProgressIndicator = find.byType(RefreshProgressIndicator);
final findRefreshProgressIndicator =
find.byType(RefreshProgressIndicator);

await tester.pumpWidget(materialSwipeRefresh);
await tester.drag(
Expand Down

0 comments on commit 0220360

Please sign in to comment.