Skip to content

Commit

Permalink
Fix dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
AcarFurkan committed May 28, 2024
1 parent 819d29d commit 34572b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
33 changes: 21 additions & 12 deletions lib/src/modal_page/sliver_wolt_modal_sheet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ class SliverWoltModalSheetPage {
this.resizeToAvoidBottomInset,
}) : assert(!(topBar != null && hasTopBarLayer == false),
"When topBar is provided, hasTopBarLayer must not be false"),
assert((mainContentSlivers != null) ^ (mainContentSliversBuilder != null),
assert(
(mainContentSlivers != null) ^ (mainContentSliversBuilder != null),
"Either mainContentSlivers or mainContentSliversBuilder must be provided, but not both");

SliverWoltModalSheetPage copyWith({
Expand Down Expand Up @@ -289,8 +290,10 @@ class SliverWoltModalSheetPage {
topBarTitle: topBarTitle ?? this.topBarTitle,
topBar: topBar ?? this.topBar,
hasTopBarLayer: hasTopBarLayer ?? this.hasTopBarLayer,
isTopBarLayerAlwaysVisible: isTopBarLayerAlwaysVisible ?? this.isTopBarLayerAlwaysVisible,
mainContentSliversBuilder: mainContentSliversBuilder ?? this.mainContentSliversBuilder,
isTopBarLayerAlwaysVisible:
isTopBarLayerAlwaysVisible ?? this.isTopBarLayerAlwaysVisible,
mainContentSliversBuilder:
mainContentSliversBuilder ?? this.mainContentSliversBuilder,
heroImage: heroImage ?? this.heroImage,
heroImageHeight: heroImageHeight ?? this.heroImageHeight,
backgroundColor: backgroundColor ?? this.backgroundColor,
Expand All @@ -304,7 +307,8 @@ class SliverWoltModalSheetPage {
sabGradientColor: sabGradientColor ?? this.sabGradientColor,
leadingNavBarWidget: leadingNavBarWidget ?? this.leadingNavBarWidget,
trailingNavBarWidget: trailingNavBarWidget ?? this.trailingNavBarWidget,
resizeToAvoidBottomInset: resizeToAvoidBottomInset ?? this.resizeToAvoidBottomInset,
resizeToAvoidBottomInset:
resizeToAvoidBottomInset ?? this.resizeToAvoidBottomInset,
);
}

Expand Down Expand Up @@ -343,8 +347,11 @@ class SliverWoltModalSheetPage {
topBarTitle: topBarTitle ?? this.topBarTitle,
topBar: topBar ?? this.topBar,
hasTopBarLayer: hasTopBarLayer ?? this.hasTopBarLayer,
isTopBarLayerAlwaysVisible: isTopBarLayerAlwaysVisible ?? this.isTopBarLayerAlwaysVisible,
mainContentSliversBuilder: child == null ? mainContentSliversBuilder : _mainContentBuilderFromChild(child),
isTopBarLayerAlwaysVisible:
isTopBarLayerAlwaysVisible ?? this.isTopBarLayerAlwaysVisible,
mainContentSliversBuilder: child == null
? mainContentSliversBuilder
: _mainContentBuilderFromChild(child),
heroImage: heroImage ?? this.heroImage,
heroImageHeight: heroImageHeight ?? this.heroImageHeight,
backgroundColor: backgroundColor ?? this.backgroundColor,
Expand All @@ -358,19 +365,21 @@ class SliverWoltModalSheetPage {
sabGradientColor: sabGradientColor ?? this.sabGradientColor,
leadingNavBarWidget: leadingNavBarWidget ?? this.leadingNavBarWidget,
trailingNavBarWidget: trailingNavBarWidget ?? this.trailingNavBarWidget,
resizeToAvoidBottomInset: resizeToAvoidBottomInset ?? this.resizeToAvoidBottomInset,
resizeToAvoidBottomInset:
resizeToAvoidBottomInset ?? this.resizeToAvoidBottomInset,
);
}

List<Widget> Function(BuildContext context)? _mainContentBuilderFromChild(Widget child) {
List<Widget> Function(BuildContext context)? _mainContentBuilderFromChild(
Widget child) {
if (this is WoltModalSheetPage) {
return (_) => [
SliverToBoxAdapter(child: child),
];
SliverToBoxAdapter(child: child),
];
} else if (this is NonScrollingWoltModalSheetPage) {
return (_) => [
SliverFillViewport(delegate: SliverChildListDelegate([child])),
];
SliverFillViewport(delegate: SliverChildListDelegate([child])),
];
} else {
return mainContentSliversBuilder;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/src/wolt_modal_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,9 @@ class WoltModalSheetState extends State<WoltModalSheet> {
///
/// Returns:
/// None.
void updateCurrentPage(SliverWoltModalSheetPage Function(SliverWoltModalSheetPage) updateFunction) {
void updateCurrentPage(
SliverWoltModalSheetPage Function(SliverWoltModalSheetPage)
updateFunction) {
setState(() {
_pages[_currentPageIndex] = updateFunction(_pages[_currentPageIndex]);
});
Expand Down

0 comments on commit 34572b0

Please sign in to comment.