-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add static method to determine the current modal tyoe
- Loading branch information
Showing
3 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:wolt_modal_sheet/src/theme/wolt_modal_sheet_default_theme_data.dart'; | ||
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart'; | ||
|
||
class WoltModalTypeUtils { | ||
/// Determines the modal type based on the the presence of the modal type builder provided by | ||
/// the [WoltModalSheet] widget, existence of the [WoltModalSheetThemeData.modalTypeBuilder]. | ||
/// If none of these are available, the default modalTypeBuilder from the | ||
/// [WoltModalSheetDefaultThemeData] is used. | ||
static WoltModalType currentModalType( | ||
WoltModalTypeBuilder? modalTypeBuilder, | ||
BuildContext context, | ||
) { | ||
final builder = modalTypeBuilder ?? | ||
Theme.of(context) | ||
.extension<WoltModalSheetThemeData>() | ||
?.modalTypeBuilder ?? | ||
WoltModalSheetDefaultThemeData(context).modalTypeBuilder; | ||
return builder(context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters