Browse Source

Merge pull request #925 from nextcloud/style/neon/remove-inferred-generic-arguments

style(neon): Remove automatically inferred generic type arguments
pull/927/head
Kate 1 year ago committed by GitHub
parent
commit
64c5649d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/neon/neon/lib/src/blocs/accounts.dart
  2. 12
      packages/neon/neon/lib/src/blocs/apps.dart
  3. 6
      packages/neon/neon/lib/src/blocs/capabilities.dart
  4. 2
      packages/neon/neon/lib/src/blocs/login_flow.dart
  5. 6
      packages/neon/neon/lib/src/blocs/user_details.dart
  6. 3
      packages/neon/neon/lib/src/blocs/user_statuses.dart
  7. 4
      packages/neon/neon/lib/src/pages/home.dart
  8. 5
      packages/neon/neon/lib/src/pages/settings.dart
  9. 4
      packages/neon/neon/lib/src/utils/global_options.dart
  10. 4
      packages/neon/neon/lib/src/widgets/app_bar.dart
  11. 2
      packages/neon/neon/lib/src/widgets/image.dart
  12. 2
      packages/neon/neon/lib/src/widgets/user_avatar.dart

2
packages/neon/neon/lib/src/blocs/accounts.dart

@ -140,7 +140,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]); BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]);
@override @override
BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>(); BehaviorSubject<Account?> activeAccount = BehaviorSubject();
@override @override
void addAccount(final Account account) { void addAccount(final Account account) {

12
packages/neon/neon/lib/src/blocs/apps.dart

@ -175,18 +175,17 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
} }
@override @override
BehaviorSubject<AppImplementation> activeApp = BehaviorSubject<AppImplementation>(); BehaviorSubject<AppImplementation> activeApp = BehaviorSubject();
@override @override
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppOptions>>>> appImplementations = BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppOptions>>>> appImplementations =
BehaviorSubject<Result<Iterable<AppImplementation>>>(); BehaviorSubject();
@override @override
BehaviorSubject<Result<List<CoreNavigationEntry>>> apps = BehaviorSubject<Result<List<CoreNavigationEntry>>>(); BehaviorSubject<Result<List<CoreNavigationEntry>>> apps = BehaviorSubject();
@override @override
BehaviorSubject<Result<NotificationsAppInterface?>> notificationsAppImplementation = BehaviorSubject<Result<NotificationsAppInterface?>> notificationsAppImplementation = BehaviorSubject();
BehaviorSubject<Result<NotificationsAppInterface?>>();
@override @override
BehaviorSubject<void> openNotifications = BehaviorSubject(); BehaviorSubject<void> openNotifications = BehaviorSubject();
@ -196,8 +195,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
@override @override
Future<void> refresh() async { Future<void> refresh() async {
await RequestManager.instance await RequestManager.instance.wrapNextcloud(
.wrapNextcloud<List<CoreNavigationEntry>, CoreNavigationGetAppsNavigationResponseApplicationJson, void>(
_account.id, _account.id,
'apps-apps', 'apps-apps',
apps, apps,

6
packages/neon/neon/lib/src/blocs/capabilities.dart

@ -33,13 +33,11 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents
} }
@override @override
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> capabilities = BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> capabilities = BehaviorSubject();
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>>();
@override @override
Future<void> refresh() async { Future<void> refresh() async {
await RequestManager.instance.wrapNextcloud<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data, await RequestManager.instance.wrapNextcloud(
CoreOcsGetCapabilitiesResponseApplicationJson, void>(
_account.id, _account.id,
'capabilities', 'capabilities',
capabilities, capabilities,

2
packages/neon/neon/lib/src/blocs/login_flow.dart

@ -43,7 +43,7 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi
} }
@override @override
BehaviorSubject<Result<CoreLoginFlowV2>> init = BehaviorSubject<Result<CoreLoginFlowV2>>(); BehaviorSubject<Result<CoreLoginFlowV2>> init = BehaviorSubject();
@override @override
late Stream<CoreLoginFlowV2Credentials> result = _resultController.stream.asBroadcastStream(); late Stream<CoreLoginFlowV2Credentials> result = _resultController.stream.asBroadcastStream();

6
packages/neon/neon/lib/src/blocs/user_details.dart

@ -33,13 +33,11 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents,
} }
@override @override
BehaviorSubject<Result<ProvisioningApiUserDetails>> userDetails = BehaviorSubject<Result<ProvisioningApiUserDetails>> userDetails = BehaviorSubject();
BehaviorSubject<Result<ProvisioningApiUserDetails>>();
@override @override
Future<void> refresh() async { Future<void> refresh() async {
await RequestManager.instance await RequestManager.instance.wrapNextcloud(
.wrapNextcloud<ProvisioningApiUserDetails, ProvisioningApiUsersGetCurrentUserResponseApplicationJson, void>(
_account.id, _account.id,
'user-details', 'user-details',
userDetails, userDetails,

3
packages/neon/neon/lib/src/blocs/user_statuses.dart

@ -41,8 +41,7 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents
} }
@override @override
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> statuses = BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> statuses = BehaviorSubject();
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>>();
@override @override
Future<void> refresh() async { Future<void> refresh() async {

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

@ -148,7 +148,7 @@ class _HomePageState extends State<HomePage> {
); );
} }
return StreamBuilder<AppImplementation>( return StreamBuilder(
stream: _appsBloc.activeApp, stream: _appsBloc.activeApp,
builder: (final context, final activeAppIDSnapshot) { builder: (final context, final activeAppIDSnapshot) {
if (!activeAppIDSnapshot.hasData) { if (!activeAppIDSnapshot.hasData) {
@ -163,7 +163,7 @@ class _HomePageState extends State<HomePage> {
}, },
); );
final body = ValueListenableBuilder<global_options.NavigationMode>( final body = ValueListenableBuilder(
valueListenable: _globalOptions.navigationMode, valueListenable: _globalOptions.navigationMode,
builder: (final context, final navigationMode, final _) { builder: (final context, final navigationMode, final _) {
final drawerAlwaysVisible = navigationMode == global_options.NavigationMode.drawerAlwaysVisible; final drawerAlwaysVisible = navigationMode == global_options.NavigationMode.drawerAlwaysVisible;

5
packages/neon/neon/lib/src/pages/settings.dart

@ -4,7 +4,6 @@ import 'package:flutter_material_design_icons/flutter_material_design_icons.dart
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:neon/l10n/localizations.dart'; import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_implementation.dart'; import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/platform/platform.dart';
import 'package:neon/src/router.dart'; import 'package:neon/src/router.dart';
@ -82,14 +81,14 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
], ],
); );
final body = StreamBuilder<List<Account>>( final body = StreamBuilder(
stream: accountsBloc.accounts, stream: accountsBloc.accounts,
initialData: accountsBloc.accounts.valueOrNull, initialData: accountsBloc.accounts.valueOrNull,
builder: ( builder: (
final context, final context,
final accountsSnapshot, final accountsSnapshot,
) => ) =>
ValueListenableBuilder<bool>( ValueListenableBuilder(
valueListenable: globalOptions.pushNotificationsEnabled, valueListenable: globalOptions.pushNotificationsEnabled,
builder: ( builder: (
final context, final context,

4
packages/neon/neon/lib/src/utils/global_options.dart

@ -114,7 +114,7 @@ class GlobalOptions extends OptionsCollection {
} }
} }
late final themeMode = SelectOption<ThemeMode>( late final themeMode = SelectOption(
storage: storage, storage: storage,
key: GlobalOptionKeys.themeMode, key: GlobalOptionKeys.themeMode,
label: (final context) => AppLocalizations.of(context).globalOptionsThemeMode, label: (final context) => AppLocalizations.of(context).globalOptionsThemeMode,
@ -202,7 +202,7 @@ class GlobalOptions extends OptionsCollection {
values: {}, values: {},
); );
late final navigationMode = SelectOption<NavigationMode>( late final navigationMode = SelectOption(
storage: storage, storage: storage,
key: GlobalOptionKeys.navigationMode, key: GlobalOptionKeys.navigationMode,
label: (final context) => AppLocalizations.of(context).globalOptionsNavigationMode, label: (final context) => AppLocalizations.of(context).globalOptionsNavigationMode,

4
packages/neon/neon/lib/src/widgets/app_bar.dart

@ -64,9 +64,9 @@ class _NeonAppBarState extends State<NeonAppBar> {
@override @override
Widget build(final BuildContext context) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject( Widget build(final BuildContext context) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject(
stream: appsBloc.appImplementations, stream: appsBloc.appImplementations,
builder: (final context, final appImplementations) => StreamBuilder<AppImplementation>( builder: (final context, final appImplementations) => StreamBuilder(
stream: appsBloc.activeApp, stream: appsBloc.activeApp,
builder: (final context, final activeAppSnapshot) => StreamBuilder<bool>( builder: (final context, final activeAppSnapshot) => StreamBuilder(
stream: unifiedSearchBloc.enabled, stream: unifiedSearchBloc.enabled,
builder: (final context, final unifiedSearchEnabledSnapshot) { builder: (final context, final unifiedSearchEnabledSnapshot) {
final unifiedSearchEnabled = unifiedSearchEnabledSnapshot.data ?? false; final unifiedSearchEnabled = unifiedSearchEnabledSnapshot.data ?? false;

2
packages/neon/neon/lib/src/widgets/image.dart

@ -177,7 +177,7 @@ class NeonCachedImage extends StatefulWidget {
class _NeonCachedImageState extends State<NeonCachedImage> { class _NeonCachedImageState extends State<NeonCachedImage> {
@override @override
Widget build(final BuildContext context) => Center( Widget build(final BuildContext context) => Center(
child: FutureBuilder<Uint8List>( child: FutureBuilder(
future: widget.image, future: widget.image,
builder: (final context, final fileSnapshot) { builder: (final context, final fileSnapshot) {
if (fileSnapshot.hasError) { if (fileSnapshot.hasError) {

2
packages/neon/neon/lib/src/widgets/user_avatar.dart

@ -82,7 +82,7 @@ class _UserAvatarState extends State<NeonUserAvatar> {
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
avatar, avatar,
ResultBuilder<UserStatusPublicInterface?>( ResultBuilder(
stream: _userStatusBloc.statuses.mapNotNull((final statuses) => statuses[widget.username]), stream: _userStatusBloc.statuses.mapNotNull((final statuses) => statuses[widget.username]),
builder: _userStatusIconBuilder, builder: _userStatusIconBuilder,
), ),

Loading…
Cancel
Save