Browse Source

neon: remove unused builders from HomePage

pull/397/head
Nikolas Rimikis 1 year ago
parent
commit
ed618cab0b
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 32
      packages/neon/neon/lib/src/pages/home.dart

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

@ -11,16 +11,13 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState(); State<HomePage> createState() => _HomePageState();
} }
// ignore: prefer_mixin
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
final _scaffoldKey = GlobalKey<ScaffoldState>(); final _scaffoldKey = GlobalKey<ScaffoldState>();
final drawerScrollController = ScrollController();
late Account _account; late Account _account;
late GlobalOptions _globalOptions; late GlobalOptions _globalOptions;
late AccountsBloc _accountsBloc; late AccountsBloc _accountsBloc;
late AppsBloc _appsBloc; late AppsBloc _appsBloc;
late CapabilitiesBloc _capabilitiesBloc;
@override @override
void initState() { void initState() {
@ -29,7 +26,6 @@ class _HomePageState extends State<HomePage> {
_accountsBloc = Provider.of<AccountsBloc>(context, listen: false); _accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
_account = _accountsBloc.activeAccount.value!; _account = _accountsBloc.activeAccount.value!;
_appsBloc = _accountsBloc.activeAppsBloc; _appsBloc = _accountsBloc.activeAppsBloc;
_capabilitiesBloc = _accountsBloc.activeCapabilitiesBloc;
_appsBloc.appVersions.listen((final values) { _appsBloc.appVersions.listen((final values) {
if (values == null || !mounted) { if (values == null || !mounted) {
@ -98,32 +94,13 @@ class _HomePageState extends State<HomePage> {
} }
@override @override
void dispose() { Widget build(final BuildContext context) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject(
drawerScrollController.dispose();
super.dispose();
}
@override
Widget build(final BuildContext context) => ResultBuilder<Capabilities>.behaviorSubject(
stream: _capabilitiesBloc.capabilities,
builder: (final context, final capabilities) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject(
stream: _appsBloc.appImplementations, stream: _appsBloc.appImplementations,
builder: (final context, final appImplementations) => builder: (final context, final appImplementations) => StreamBuilder<String?>(
ResultBuilder<NotificationsAppInterface?>.behaviorSubject(
stream: _appsBloc.notificationsAppImplementation,
builder: (final context, final notificationsAppImplementation) => StreamBuilder<String?>(
stream: _appsBloc.activeAppID, stream: _appsBloc.activeAppID,
builder: (final context, final activeAppIDSnapshot) => StreamBuilder<List<Account>>( builder: (final context, final activeAppIDSnapshot) => OptionBuilder<NavigationMode>(
stream: _accountsBloc.accounts,
builder: (final context, final accountsSnapshot) => OptionBuilder<NavigationMode>(
option: _globalOptions.navigationMode, option: _globalOptions.navigationMode,
builder: (final context, final navigationMode) { builder: (final context, final navigationMode) {
final accounts = accountsSnapshot.data;
final account = accounts?.find(_account.id);
if (accounts == null || account == null) {
return const Scaffold();
}
final drawerAlwaysVisible = navigationMode == NavigationMode.drawerAlwaysVisible; final drawerAlwaysVisible = navigationMode == NavigationMode.drawerAlwaysVisible;
const drawer = NeonDrawer(); const drawer = NeonDrawer();
@ -191,8 +168,5 @@ class _HomePageState extends State<HomePage> {
}, },
), ),
), ),
),
),
),
); );
} }

Loading…
Cancel
Save