Browse Source

Merge pull request #398 from Leptopoda/refactor/drawer

neon: drawer use ResultBuilder
pull/405/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
938d1faef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      packages/neon/neon/lib/src/widgets/drawer.dart

18
packages/neon/neon/lib/src/widgets/drawer.dart

@ -19,15 +19,15 @@ class NeonDrawer extends StatelessWidget {
final accountsBloc = Provider.of<AccountsBloc>(context, listen: false); final accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
final appsBloc = accountsBloc.activeAppsBloc; final appsBloc = accountsBloc.activeAppsBloc;
return StreamBuilder( return ResultBuilder.behaviorSubject(
stream: appsBloc.appImplementations, stream: appsBloc.appImplementations,
builder: (final context, final snapshot) { builder: (final context, final snapshot) {
if (snapshot.data?.data == null) { if (!snapshot.hasData) {
return Container(); return const SizedBox.shrink();
} }
return _NeonDrawer( return _NeonDrawer(
apps: snapshot.data!.data!, apps: snapshot.requireData,
); );
}, },
); );
@ -176,19 +176,19 @@ class NeonDrawerHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if (capabilities.data != null) ...[ if (capabilities.hasData) ...[
if (capabilities.data!.capabilities.theming?.name != null) ...[ if (capabilities.requireData.capabilities.theming?.name != null) ...[
Text( Text(
capabilities.data!.capabilities.theming!.name!, capabilities.requireData.capabilities.theming!.name!,
style: DefaultTextStyle.of(context).style.copyWith( style: DefaultTextStyle.of(context).style.copyWith(
color: Theme.of(context).appBarTheme.foregroundColor, color: Theme.of(context).appBarTheme.foregroundColor,
), ),
), ),
], ],
if (capabilities.data!.capabilities.theming?.logo != null) ...[ if (capabilities.requireData.capabilities.theming?.logo != null) ...[
Flexible( Flexible(
child: NeonCachedUrlImage( child: NeonCachedUrlImage(
url: capabilities.data!.capabilities.theming!.logo!, url: capabilities.requireData.capabilities.theming!.logo!,
), ),
), ),
], ],

Loading…
Cancel
Save