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

feat: use native navigation instead of getX navigation #6

Merged
merged 11 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion packages/fluorflow/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class MyApp extends StatelessWidget {
initialRoute: AppRoute.homeView.path,
onGenerateRoute: onGenerateRoute,
navigatorKey: NavigationService.navigatorKey,
navigatorObservers: [NavigationService.observer()],
navigatorObservers: [NavigationService.observer],
);
}
4 changes: 4 additions & 0 deletions packages/fluorflow/example/lib/views/detail/detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ final class DetailView extends FluorFlowView<DetailViewModel> {
onPressed: viewModel.back,
child: const Text('Back'),
),
ElevatedButton(
onPressed: viewModel.rootBack,
child: const Text('Root to home view'),
),
ElevatedButton(
onPressed: viewModel.showBottomSheet,
child: const Text('Show Bottom Sheet'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import 'dart:async';

import 'package:example/app.bottom_sheets.dart';
import 'package:fluorflow/fluorflow.dart';

import '../../app.router.dart';

final class DetailViewModel extends DataViewModel<int> {
final _navService = locator<NavigationService>();
final _sheets = locator<BottomSheetService>();

DetailViewModel() : super(0);

void showBottomSheet() =>
_sheets.showGreetingBottomSheet(callback: () {}, onElement: (_) {});
_navService.showGreetingBottomSheet(callback: () {}, onElement: (_) {});

void back() => _navService.back();

void rootBack() => _navService.rootToHomeView();

void addOne() => data += 1;
}
4 changes: 2 additions & 2 deletions packages/fluorflow/example/lib/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class HomeViewModel extends BaseViewModel {
notifyListeners();
}

void showTestDialog() => _dialogService.showRedDialog(elements: []);
void showTestDialog() => _navService.showRedDialog(elements: []);

void showSmallDialog() => _dialogService.showSmallDialog();
void showSmallDialog() => _navService.showSmallDialog();

void goToDetail() => _navService.navigateToDetailView();
}
2 changes: 0 additions & 2 deletions packages/fluorflow/lib/fluorflow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
library fluorflow;

export 'src/bottom_sheets/bottom_sheet.dart';
export 'src/bottom_sheets/bottom_sheet_service.dart';
export 'src/bottom_sheets/simple_bottom_sheet.dart';
export 'src/dialogs/dialog.dart';
export 'src/dialogs/dialog_service.dart';
export 'src/dialogs/simple_dialog.dart';
export 'src/locator/locator.dart';
export 'src/navigation/navigation_service.dart';
Expand Down
10 changes: 7 additions & 3 deletions packages/fluorflow/lib/src/annotations/bottom_sheet_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ class BottomSheetConfig {
/// If set to false, the bottom sheet will be displayed at the bottom third(-ish) of the screen.
final bool defaultFullscreen;

/// Whether the bottom sheet should ignore the safe area and take up the entire screen.
/// Whether the bottom sheet should ignore or use the safe area and take up the entire screen.
/// This is most likely used in combination with [defaultFullscreen].
final bool defaultIgnoreSafeArea;
final bool defaultUseSafeArea;

/// Whether the bottom sheet can be dragged by the user.
final bool defaultDraggable;

/// Whether the bottom sheet should show a drag handle.
final bool defaultShowDragHandle;

/// Decorate a bottom sheet or simple bottomsheet with a [BottomSheetConfig].
const BottomSheetConfig({
this.defaultBarrierColor = 0x80000000,
this.defaultFullscreen = false,
this.defaultIgnoreSafeArea = true,
this.defaultUseSafeArea = false,
this.defaultDraggable = true,
this.defaultShowDragHandle = false,
});
}
43 changes: 0 additions & 43 deletions packages/fluorflow/lib/src/bottom_sheets/bottom_sheet_service.dart

This file was deleted.

39 changes: 0 additions & 39 deletions packages/fluorflow/lib/src/dialogs/dialog_service.dart

This file was deleted.

Loading