Skip to content

Commit

Permalink
fix: Added the ability to setPathUrlStrategy to Masamune.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Feb 5, 2023
1 parent 5e2146c commit bad12a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/masamune/lib/src/masamune_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const kDefaultLocales = [Locale("en", "US")];
///
/// The debug banner can be displayed with [debugShowCheckedModeBanner] and the performance overlay can be displayed with [showPerformanceOverlay].
///
/// Set [setPathUrlStrategy] to `true` to remove `#` in the web path.
///
/// Masamune Framework用の[MaterialApp][runApp]で実行するためのファンクション。
/// [runApp]の代わりにこちらを用いても構いません。
///
Expand All @@ -58,6 +60,8 @@ const kDefaultLocales = [Locale("en", "US")];
/// [title][onGenerateTitle]でアプリタイトルを設定することが可能です。
///
/// [debugShowCheckedModeBanner]でデバッグ用のバナーを表示することができ、[showPerformanceOverlay]でパフォーマンスのオーバーレイを表示することができます。
///
/// [setPathUrlStrategy]`true`にするとWebのパス中の`#`を取り除くことができます。
Future<void> runMasamuneApp({
Key? key,
List<MasamuneAdapter> masamuneAdapters = const [],
Expand All @@ -69,6 +73,7 @@ Future<void> runMasamuneApp({
StorageAdapter? storageAdapter,
FunctionsAdapter? functionsAdapter,
RouterConfig<Object>? routerConfig,
bool setPathUrlStrategy = true,
GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
bool debugShowCheckedModeBanner = true,
bool showPerformanceOverlay = false,
Expand All @@ -87,6 +92,9 @@ Future<void> runMasamuneApp({
List<Widget Function(BuildContext context, Widget app)>? onBuildAppFilters,
}) async {
final useRunZonedGuarded = masamuneAdapters.any((e) => e.runZonedGuarded);
if (setPathUrlStrategy) {
AppRouter.setPathUrlStrategy();
}
if (useRunZonedGuarded) {
runZonedGuarded(() async {
for (final adapter in masamuneAdapters) {
Expand Down

0 comments on commit bad12a1

Please sign in to comment.