|
|
@ -1,5 +1,7 @@ |
|
|
|
part of '../../neon.dart'; |
|
|
|
part of '../../neon.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const kQuickBarWidth = kAvatarSize + 20; |
|
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget { |
|
|
|
class HomePage extends StatefulWidget { |
|
|
|
const HomePage({ |
|
|
|
const HomePage({ |
|
|
|
required this.account, |
|
|
|
required this.account, |
|
|
@ -291,6 +293,14 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future _openSettings() async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => const SettingsPage(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
|
_capabilitiesBloc.dispose(); |
|
|
|
_capabilitiesBloc.dispose(); |
|
|
@ -345,290 +355,420 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe |
|
|
|
final accountsSnapshot, |
|
|
|
final accountsSnapshot, |
|
|
|
final _, |
|
|
|
final _, |
|
|
|
) => |
|
|
|
) => |
|
|
|
WillPopScope( |
|
|
|
OptionBuilder<NavigationMode>( |
|
|
|
onWillPop: () async { |
|
|
|
option: _globalOptions.navigationMode, |
|
|
|
if (_scaffoldKey.currentState!.isDrawerOpen) { |
|
|
|
builder: (final context, final navigationMode) => WillPopScope( |
|
|
|
Navigator.pop(context); |
|
|
|
onWillPop: () async { |
|
|
|
return true; |
|
|
|
if (_scaffoldKey.currentState!.isDrawerOpen) { |
|
|
|
} |
|
|
|
Navigator.pop(context); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_scaffoldKey.currentState!.openDrawer(); |
|
|
|
_scaffoldKey.currentState!.openDrawer(); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Builder( |
|
|
|
child: Builder( |
|
|
|
builder: (final context) { |
|
|
|
builder: (final context) { |
|
|
|
if (accountsSnapshot.hasData) { |
|
|
|
if (accountsSnapshot.hasData) { |
|
|
|
final accounts = accountsSnapshot.data!; |
|
|
|
final accounts = accountsSnapshot.data!; |
|
|
|
final account = accounts.singleWhere((final account) => account.id == widget.account.id); |
|
|
|
final account = accounts.singleWhere((final account) => account.id == widget.account.id); |
|
|
|
return Scaffold( |
|
|
|
|
|
|
|
key: _scaffoldKey, |
|
|
|
final isQuickBar = navigationMode == NavigationMode.quickBar; |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
final drawer = Drawer( |
|
|
|
appBar: AppBar( |
|
|
|
width: isQuickBar ? kQuickBarWidth : null, |
|
|
|
title: Column( |
|
|
|
child: Container( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
padding: isQuickBar ? const EdgeInsets.all(5) : null, |
|
|
|
children: [ |
|
|
|
color: isQuickBar ? Theme.of(context).appBarTheme.backgroundColor : null, |
|
|
|
Row( |
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
if (appsData != null && activeAppIDSnapshot.hasData) ...[ |
|
|
|
Expanded( |
|
|
|
Flexible( |
|
|
|
child: Scrollbar( |
|
|
|
child: Text( |
|
|
|
child: ListView( |
|
|
|
appsData |
|
|
|
// Needed for the drawer header to also render in the statusbar |
|
|
|
.singleWhere((final a) => a.id == activeAppIDSnapshot.data!) |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
.name(context), |
|
|
|
children: [ |
|
|
|
), |
|
|
|
Builder( |
|
|
|
), |
|
|
|
builder: (final context) { |
|
|
|
], |
|
|
|
if (accountsSnapshot.hasData) { |
|
|
|
if (appsError != null) ...[ |
|
|
|
if (isQuickBar) { |
|
|
|
const SizedBox( |
|
|
|
return Column( |
|
|
|
width: 8, |
|
|
|
children: [ |
|
|
|
), |
|
|
|
if (accounts.length != 1) ...[ |
|
|
|
Icon( |
|
|
|
for (final account in accounts) ...[ |
|
|
|
Icons.error_outline, |
|
|
|
Container( |
|
|
|
size: 30, |
|
|
|
margin: const EdgeInsets.symmetric( |
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
vertical: 5, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
child: Tooltip( |
|
|
|
if (appsLoading) ...[ |
|
|
|
message: account.client.humanReadableID, |
|
|
|
const SizedBox( |
|
|
|
child: IconButton( |
|
|
|
width: 8, |
|
|
|
onPressed: () { |
|
|
|
), |
|
|
|
accountsBloc.setActiveAccount(account); |
|
|
|
SizedBox( |
|
|
|
}, |
|
|
|
height: 30, |
|
|
|
icon: IntrinsicHeight( |
|
|
|
width: 30, |
|
|
|
child: AccountAvatar( |
|
|
|
child: CircularProgressIndicator( |
|
|
|
account: account, |
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
), |
|
|
|
strokeWidth: 2, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (accounts.length > 1) ...[ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
account.client.humanReadableID, |
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.bodySmall!, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
actions: [ |
|
|
|
|
|
|
|
if (appsData != null && activeAppIDSnapshot.hasData) ...[ |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: const Icon(Icons.settings), |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => NextcloudAppSpecificSettingsPage( |
|
|
|
|
|
|
|
appImplementation: |
|
|
|
|
|
|
|
appsData.singleWhere((final a) => a.id == activeAppIDSnapshot.data!), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: AccountAvatar( |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
requestManager: _requestManager, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => AccountSpecificSettingsPage( |
|
|
|
|
|
|
|
bloc: accountsBloc, |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
drawer: Drawer( |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: Scrollbar( |
|
|
|
|
|
|
|
child: ListView( |
|
|
|
|
|
|
|
// Needed for the drawer header to also render in the statusbar |
|
|
|
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Builder( |
|
|
|
|
|
|
|
builder: (final context) { |
|
|
|
|
|
|
|
if (accountsSnapshot.hasData) { |
|
|
|
|
|
|
|
return DrawerHeader( |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (capabilitiesData != null) ...[ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
capabilitiesData.capabilities!.theming!.name!, |
|
|
|
|
|
|
|
style: DefaultTextStyle.of(context).style.copyWith( |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if (capabilitiesData.capabilities!.theming!.logo != null) ...[ |
|
|
|
], |
|
|
|
Flexible( |
|
|
|
Container( |
|
|
|
child: CachedURLImage( |
|
|
|
margin: const EdgeInsets.only( |
|
|
|
url: capabilitiesData.capabilities!.theming!.logo!, |
|
|
|
top: 10, |
|
|
|
requestManager: _requestManager, |
|
|
|
), |
|
|
|
client: widget.account.client, |
|
|
|
child: Divider( |
|
|
|
|
|
|
|
height: 5, |
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
] else ...[ |
|
|
|
|
|
|
|
ExceptionWidget( |
|
|
|
|
|
|
|
capabilitiesError, |
|
|
|
|
|
|
|
onRetry: () { |
|
|
|
|
|
|
|
_capabilitiesBloc.refresh(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
CustomLinearProgressIndicator( |
|
|
|
|
|
|
|
visible: capabilitiesLoading, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
if (accountsSnapshot.data!.length != 1) ...[ |
|
|
|
); |
|
|
|
DropdownButtonHideUnderline( |
|
|
|
} |
|
|
|
child: DropdownButton<String>( |
|
|
|
return DrawerHeader( |
|
|
|
isExpanded: true, |
|
|
|
decoration: BoxDecoration( |
|
|
|
dropdownColor: Theme.of(context).colorScheme.primary, |
|
|
|
color: Theme.of(context).appBarTheme.backgroundColor, |
|
|
|
iconEnabledColor: Theme.of(context).colorScheme.onPrimary, |
|
|
|
), |
|
|
|
value: widget.account.id, |
|
|
|
child: Column( |
|
|
|
items: accountsSnapshot.data! |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
.map<DropdownMenuItem<String>>( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
(final account) => DropdownMenuItem<String>( |
|
|
|
children: [ |
|
|
|
value: account.id, |
|
|
|
if (capabilitiesData != null) ...[ |
|
|
|
child: AccountTile( |
|
|
|
Text( |
|
|
|
account: account, |
|
|
|
capabilitiesData.capabilities!.theming!.name!, |
|
|
|
dense: true, |
|
|
|
style: DefaultTextStyle.of(context).style.copyWith( |
|
|
|
textColor: Theme.of(context).colorScheme.onPrimary, |
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (capabilitiesData.capabilities!.theming!.logo != null) ...[ |
|
|
|
|
|
|
|
Flexible( |
|
|
|
|
|
|
|
child: CachedURLImage( |
|
|
|
|
|
|
|
url: capabilitiesData.capabilities!.theming!.logo!, |
|
|
|
|
|
|
|
requestManager: _requestManager, |
|
|
|
|
|
|
|
client: widget.account.client, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
] else ...[ |
|
|
|
|
|
|
|
ExceptionWidget( |
|
|
|
|
|
|
|
capabilitiesError, |
|
|
|
|
|
|
|
onRetry: () { |
|
|
|
|
|
|
|
_capabilitiesBloc.refresh(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
CustomLinearProgressIndicator( |
|
|
|
|
|
|
|
visible: capabilitiesLoading, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
if (accounts.length != 1) ...[ |
|
|
|
|
|
|
|
DropdownButtonHideUnderline( |
|
|
|
|
|
|
|
child: DropdownButton<String>( |
|
|
|
|
|
|
|
isExpanded: true, |
|
|
|
|
|
|
|
dropdownColor: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
|
|
iconEnabledColor: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
value: widget.account.id, |
|
|
|
|
|
|
|
items: accounts |
|
|
|
|
|
|
|
.map<DropdownMenuItem<String>>( |
|
|
|
|
|
|
|
(final account) => DropdownMenuItem<String>( |
|
|
|
|
|
|
|
value: account.id, |
|
|
|
|
|
|
|
child: AccountTile( |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
dense: true, |
|
|
|
|
|
|
|
textColor: |
|
|
|
|
|
|
|
Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
) |
|
|
|
.toList(), |
|
|
|
.toList(), |
|
|
|
onChanged: (final id) { |
|
|
|
onChanged: (final id) { |
|
|
|
for (final account in accounts) { |
|
|
|
for (final account in accountsSnapshot.data!) { |
|
|
|
if (account.id == id) { |
|
|
|
if (account.id == id) { |
|
|
|
accountsBloc.setActiveAccount(account); |
|
|
|
accountsBloc.setActiveAccount(account); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
return Container(); |
|
|
|
return Container(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
ExceptionWidget( |
|
|
|
ExceptionWidget( |
|
|
|
appsError, |
|
|
|
appsError, |
|
|
|
onlyIcon: isQuickBar, |
|
|
|
onRetry: () { |
|
|
|
onRetry: () { |
|
|
|
_appsBloc.refresh(); |
|
|
|
_appsBloc.refresh(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
CustomLinearProgressIndicator( |
|
|
|
CustomLinearProgressIndicator( |
|
|
|
visible: appsLoading, |
|
|
|
visible: appsLoading, |
|
|
|
), |
|
|
|
), |
|
|
|
if (appsData != null) ...[ |
|
|
|
if (appsData != null) ...[ |
|
|
|
for (final appImplementation in appsData) ...[ |
|
|
|
for (final appImplementation in appsData) ...[ |
|
|
|
ListTile( |
|
|
|
StreamBuilder<int>( |
|
|
|
key: Key('app-${appImplementation.id}'), |
|
|
|
|
|
|
|
title: StreamBuilder<int>( |
|
|
|
|
|
|
|
stream: appImplementation.getUnreadCounter(_appsBloc) ?? |
|
|
|
stream: appImplementation.getUnreadCounter(_appsBloc) ?? |
|
|
|
BehaviorSubject<int>.seeded(0), |
|
|
|
BehaviorSubject<int>.seeded(0), |
|
|
|
builder: (final context, final unreadCounterSnapshot) => Row( |
|
|
|
builder: (final context, final unreadCounterSnapshot) { |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
final unreadCount = unreadCounterSnapshot.data ?? 0; |
|
|
|
children: [ |
|
|
|
if (isQuickBar) { |
|
|
|
Text(appImplementation.name(context)), |
|
|
|
return Tooltip( |
|
|
|
if (unreadCounterSnapshot.hasData && |
|
|
|
message: appImplementation.name(context), |
|
|
|
unreadCounterSnapshot.data! > 0) ...[ |
|
|
|
child: IconButton( |
|
|
|
Text( |
|
|
|
onPressed: () { |
|
|
|
unreadCounterSnapshot.data!.toString(), |
|
|
|
_appsBloc.setActiveApp(appImplementation.id); |
|
|
|
style: TextStyle( |
|
|
|
}, |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
icon: Stack( |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
fontSize: 14, |
|
|
|
children: [ |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
margin: const EdgeInsets.all(5), |
|
|
|
|
|
|
|
child: appImplementation.buildIcon( |
|
|
|
|
|
|
|
context, |
|
|
|
|
|
|
|
height: kAvatarSize, |
|
|
|
|
|
|
|
width: kAvatarSize, |
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (unreadCount > 0) ...[ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
unreadCount.toString(), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
], |
|
|
|
} |
|
|
|
), |
|
|
|
return ListTile( |
|
|
|
|
|
|
|
key: Key('app-${appImplementation.id}'), |
|
|
|
|
|
|
|
title: Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text(appImplementation.name(context)), |
|
|
|
|
|
|
|
if (unreadCount > 0) ...[ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
unreadCount.toString(), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
|
|
fontSize: 14, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
leading: appImplementation.buildIcon(context), |
|
|
|
|
|
|
|
minLeadingWidth: 0, |
|
|
|
|
|
|
|
onTap: () { |
|
|
|
|
|
|
|
_appsBloc.setActiveApp(appImplementation.id); |
|
|
|
|
|
|
|
if (navigationMode == NavigationMode.drawer) { |
|
|
|
|
|
|
|
// Don't pop when the drawer is always shown |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
leading: appImplementation.buildIcon(context), |
|
|
|
], |
|
|
|
minLeadingWidth: 0, |
|
|
|
|
|
|
|
onTap: () { |
|
|
|
|
|
|
|
_appsBloc.setActiveApp(appImplementation.id); |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if (isQuickBar) ...[ |
|
|
|
ListTile( |
|
|
|
IconButton( |
|
|
|
key: const Key('settings'), |
|
|
|
icon: Icon( |
|
|
|
title: Text(AppLocalizations.of(context).settings), |
|
|
|
Icons.settings, |
|
|
|
leading: const Icon(Icons.settings), |
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
minLeadingWidth: 0, |
|
|
|
|
|
|
|
onTap: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => const SettingsPage(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
body: Column( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
ServerStatus( |
|
|
|
|
|
|
|
account: widget.account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
ExceptionWidget( |
|
|
|
|
|
|
|
appsError, |
|
|
|
|
|
|
|
onRetry: () { |
|
|
|
|
|
|
|
_appsBloc.refresh(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (appsData != null) ...[ |
|
|
|
|
|
|
|
if (appsData.isEmpty) ...[ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: Center( |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
AppLocalizations.of(context).errorNoCompatibleNextcloudAppsFound, |
|
|
|
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
onPressed: _openSettings, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
] else ...[ |
|
|
|
] else ...[ |
|
|
|
ListTile( |
|
|
|
if (activeAppIDSnapshot.hasData) ...[ |
|
|
|
key: const Key('settings'), |
|
|
|
Expanded( |
|
|
|
title: Text(AppLocalizations.of(context).settings), |
|
|
|
child: appsData |
|
|
|
leading: const Icon(Icons.settings), |
|
|
|
.singleWhere((final a) => a.id == activeAppIDSnapshot.data!) |
|
|
|
minLeadingWidth: 0, |
|
|
|
.buildPage(context, _appsBloc), |
|
|
|
onTap: () async { |
|
|
|
|
|
|
|
if (navigationMode == NavigationMode.drawer) { |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await _openSettings(); |
|
|
|
|
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
|
|
|
|
body: Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (navigationMode == NavigationMode.drawerAlwaysVisible) ...[ |
|
|
|
|
|
|
|
drawer, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: Scaffold( |
|
|
|
|
|
|
|
key: _scaffoldKey, |
|
|
|
|
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
|
|
|
|
drawer: navigationMode == NavigationMode.drawer ? drawer : null, |
|
|
|
|
|
|
|
appBar: AppBar( |
|
|
|
|
|
|
|
scrolledUnderElevation: navigationMode != NavigationMode.drawer ? 0 : null, |
|
|
|
|
|
|
|
automaticallyImplyLeading: navigationMode == NavigationMode.drawer, |
|
|
|
|
|
|
|
leadingWidth: isQuickBar ? kQuickBarWidth : null, |
|
|
|
|
|
|
|
leading: isQuickBar |
|
|
|
|
|
|
|
? Container( |
|
|
|
|
|
|
|
padding: const EdgeInsets.all(5), |
|
|
|
|
|
|
|
child: capabilitiesData?.capabilities?.theming?.logo != null |
|
|
|
|
|
|
|
? CachedURLImage( |
|
|
|
|
|
|
|
url: capabilitiesData!.capabilities!.theming!.logo!, |
|
|
|
|
|
|
|
requestManager: _requestManager, |
|
|
|
|
|
|
|
client: widget.account.client, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
: null, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
: null, |
|
|
|
|
|
|
|
title: Column( |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (appsData != null && activeAppIDSnapshot.hasData) ...[ |
|
|
|
|
|
|
|
Flexible( |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
appsData |
|
|
|
|
|
|
|
.singleWhere((final a) => a.id == activeAppIDSnapshot.data!) |
|
|
|
|
|
|
|
.name(context), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
if (appsError != null) ...[ |
|
|
|
|
|
|
|
const SizedBox( |
|
|
|
|
|
|
|
width: 8, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Icon( |
|
|
|
|
|
|
|
Icons.error_outline, |
|
|
|
|
|
|
|
size: 30, |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.onPrimary, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
if (appsLoading) ...[ |
|
|
|
|
|
|
|
const SizedBox( |
|
|
|
|
|
|
|
width: 8, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: CustomLinearProgressIndicator( |
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.foregroundColor, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (accounts.length > 1) ...[ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
account.client.humanReadableID, |
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.bodySmall!, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
actions: [ |
|
|
|
|
|
|
|
if (appsData != null && activeAppIDSnapshot.hasData) ...[ |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: const Icon(Icons.settings), |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => NextcloudAppSpecificSettingsPage( |
|
|
|
|
|
|
|
appImplementation: appsData |
|
|
|
|
|
|
|
.singleWhere((final a) => a.id == activeAppIDSnapshot.data!), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: IntrinsicWidth( |
|
|
|
|
|
|
|
child: AccountAvatar( |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => AccountSpecificSettingsPage( |
|
|
|
|
|
|
|
bloc: accountsBloc, |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
body: Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (navigationMode == NavigationMode.quickBar) ...[ |
|
|
|
|
|
|
|
drawer, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: Column( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
ServerStatus( |
|
|
|
|
|
|
|
account: widget.account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
ExceptionWidget( |
|
|
|
|
|
|
|
appsError, |
|
|
|
|
|
|
|
onRetry: () { |
|
|
|
|
|
|
|
_appsBloc.refresh(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (appsData != null) ...[ |
|
|
|
|
|
|
|
if (appsData.isEmpty) ...[ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: Center( |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
AppLocalizations.of(context).errorNoCompatibleNextcloudAppsFound, |
|
|
|
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
] else ...[ |
|
|
|
|
|
|
|
if (activeAppIDSnapshot.hasData) ...[ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
child: appsData |
|
|
|
|
|
|
|
.singleWhere((final a) => a.id == activeAppIDSnapshot.data!) |
|
|
|
|
|
|
|
.buildPage(context, _appsBloc), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
return Container(); |
|
|
|
return Container(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|