Browse Source

neon: make AppImplementation provide a widget getter as a main page

pull/363/head
Nikolas Rimikis 1 year ago
parent
commit
e0b5dae11e
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 6
      packages/neon/neon/lib/src/pages/home.dart
  2. 2
      packages/neon/neon/lib/src/utils/app_implementation.dart
  3. 2
      packages/neon/neon_files/lib/neon_files.dart
  4. 2
      packages/neon/neon_news/lib/neon_news.dart
  5. 2
      packages/neon/neon_notes/lib/neon_notes.dart
  6. 2
      packages/neon/neon_notifications/lib/neon_notifications.dart

6
packages/neon/neon/lib/src/pages/home.dart

@ -150,7 +150,7 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
), ),
body: app.buildPage(context, _appsBloc), body: app.page,
), ),
), ),
); );
@ -526,9 +526,7 @@ class _HomePageState extends State<HomePage> {
] else ...[ ] else ...[
if (activeAppIDSnapshot.hasData) ...[ if (activeAppIDSnapshot.hasData) ...[
Expanded( Expanded(
child: appImplementations.data! child: appImplementations.data!.find(activeAppIDSnapshot.data!)!.page,
.find(activeAppIDSnapshot.data!)!
.buildPage(context, _appsBloc),
), ),
], ],
], ],

2
packages/neon/neon/lib/src/utils/app_implementation.dart

@ -30,7 +30,7 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppSpecificO
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc); BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc);
Widget buildPage(final BuildContext context, final AppsBloc appsBloc); Widget get page;
Widget buildIcon( Widget buildIcon(
final BuildContext context, { final BuildContext context, {

2
packages/neon/neon_files/lib/neon_files.dart

@ -62,7 +62,7 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
); );
@override @override
Widget buildPage(final BuildContext context, final AppsBloc appsBloc) => const FilesMainPage(); Widget get page => const FilesMainPage();
@override @override
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null; BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null;

2
packages/neon/neon_news/lib/neon_news.dart

@ -68,7 +68,7 @@ class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
); );
@override @override
Widget buildPage(final BuildContext context, final AppsBloc appsBloc) => const NewsMainPage(); Widget get page => const NewsMainPage();
@override @override
BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) => appsBloc.getAppBloc<NewsBloc>(this).unreadCounter; BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) => appsBloc.getAppBloc<NewsBloc>(this).unreadCounter;

2
packages/neon/neon_notes/lib/neon_notes.dart

@ -58,7 +58,7 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
); );
@override @override
Widget buildPage(final BuildContext context, final AppsBloc appsBloc) => const NotesMainPage(); Widget get page => const NotesMainPage();
@override @override
BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null; BehaviorSubject<int>? getUnreadCounter(final AppsBloc appsBloc) => null;

2
packages/neon/neon_notifications/lib/neon_notifications.dart

@ -37,7 +37,7 @@ class NotificationsApp extends NotificationsAppInterface {
); );
@override @override
Widget buildPage(final BuildContext context, final AppsBloc appsBloc) => const NotificationsMainPage(); Widget get page => const NotificationsMainPage();
@override @override
BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) => BehaviorSubject<int> getUnreadCounter(final AppsBloc appsBloc) =>

Loading…
Cancel
Save