Skip to content

Commit

Permalink
Merge pull request #1068 from nextcloud/fix/neon/notch-clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Nov 1, 2023
2 parents 212a6c6 + b5d18b6 commit b617373
Show file tree
Hide file tree
Showing 17 changed files with 360 additions and 326 deletions.
10 changes: 6 additions & 4 deletions packages/neon/neon/lib/src/pages/account_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ class AccountSettingsPage extends StatelessWidget {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: appBar,
body: Center(
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: body,
body: SafeArea(
child: Center(
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: body,
),
),
),
);
Expand Down
4 changes: 3 additions & 1 deletion packages/neon/neon/lib/src/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ class _HomePageState extends State<HomePage> {
return const SizedBox();
}

return activeAppIDSnapshot.requireData.page;
return SafeArea(
child: activeAppIDSnapshot.requireData.page,
);
},
);
},
Expand Down
116 changes: 59 additions & 57 deletions packages/neon/neon/lib/src/pages/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,72 +51,74 @@ class _LoginPageState extends State<LoginPage> {
leading: const CloseButton(),
)
: null,
body: Center(
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: SingleChildScrollView(
padding: const EdgeInsets.all(10),
primary: true,
child: Column(
children: [
ExcludeSemantics(
child: branding.logo,
),
Text(
branding.name,
style: Theme.of(context).textTheme.titleLarge,
),
if (branding.showLoginWithNextcloud) ...[
const SizedBox(
height: 10,
),
Text(NeonLocalizations.of(context).loginWorksWith),
const SizedBox(
height: 10,
body: SafeArea(
child: Center(
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: SingleChildScrollView(
padding: const EdgeInsets.all(10),
primary: true,
child: Column(
children: [
ExcludeSemantics(
child: branding.logo,
),
Semantics(
label: NeonLocalizations.of(context).nextcloud,
child: const NextcloudLogo(),
Text(
branding.name,
style: Theme.of(context).textTheme.titleLarge,
),
],
const SizedBox(
height: 50,
),
Form(
key: _formKey,
child: TextFormField(
focusNode: _focusNode,
controller: _controller,
decoration: InputDecoration(
hintText: 'https://...',
labelText: NeonLocalizations.of(context).loginUsingServerAddress,
suffixIcon: IconButton(
icon: const Icon(Icons.arrow_forward),
onPressed: () {
login(_controller.text);
},
),
if (branding.showLoginWithNextcloud) ...[
const SizedBox(
height: 10,
),
keyboardType: TextInputType.url,
validator: (final input) => validateHttpUrl(context, input),
onFieldSubmitted: login,
autofillHints: const [AutofillHints.url],
),
),
if (NeonPlatform.instance.canUseCamera) ...[
Text(NeonLocalizations.of(context).loginWorksWith),
const SizedBox(
height: 10,
),
Semantics(
label: NeonLocalizations.of(context).nextcloud,
child: const NextcloudLogo(),
),
],
const SizedBox(
height: 50,
),
IconButton(
tooltip: NeonLocalizations.of(context).loginUsingQRcode,
icon: const Icon(
Icons.qr_code_scanner_rounded,
size: 60,
Form(
key: _formKey,
child: TextFormField(
focusNode: _focusNode,
controller: _controller,
decoration: InputDecoration(
hintText: 'https://...',
labelText: NeonLocalizations.of(context).loginUsingServerAddress,
suffixIcon: IconButton(
icon: const Icon(Icons.arrow_forward),
onPressed: () {
login(_controller.text);
},
),
),
keyboardType: TextInputType.url,
validator: (final input) => validateHttpUrl(context, input),
onFieldSubmitted: login,
autofillHints: const [AutofillHints.url],
),
onPressed: () => const LoginQRcodeRoute().go(context),
),
if (NeonPlatform.instance.canUseCamera) ...[
const SizedBox(
height: 50,
),
IconButton(
tooltip: NeonLocalizations.of(context).loginUsingQRcode,
icon: const Icon(
Icons.qr_code_scanner_rounded,
size: 60,
),
onPressed: () => const LoginQRcodeRoute().go(context),
),
],
],
],
),
),
),
),
Expand Down
94 changes: 48 additions & 46 deletions packages/neon/neon/lib/src/pages/login_check_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,57 +54,59 @@ class _LoginCheckAccountPageState extends State<LoginCheckAccountPage> {
@override
Widget build(final BuildContext context) => Scaffold(
appBar: AppBar(),
body: Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: ResultBuilder.behaviorSubject(
subject: bloc.state,
builder: (final context, final state) => Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
Builder(
builder: (final context) {
final details = NeonError.getDetails(state.error);
return NeonValidationTile(
title: details.isUnauthorized
? NeonLocalizations.of(context).errorCredentialsForAccountNoLongerMatch
: details.getText(context),
state: ValidationState.failure,
);
},
),
],
_buildAccountTile(state),
Align(
alignment: Alignment.bottomRight,
child: ElevatedButton(
onPressed: state.hasData
? () {
NeonProvider.of<AccountsBloc>(context)
..updateAccount(state.requireData)
..setActiveAccount(state.requireData);
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: ResultBuilder.behaviorSubject(
subject: bloc.state,
builder: (final context, final state) => Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
Builder(
builder: (final context) {
final details = NeonError.getDetails(state.error);
return NeonValidationTile(
title: details.isUnauthorized
? NeonLocalizations.of(context).errorCredentialsForAccountNoLongerMatch
: details.getText(context),
state: ValidationState.failure,
);
},
),
],
_buildAccountTile(state),
Align(
alignment: Alignment.bottomRight,
child: ElevatedButton(
onPressed: state.hasData
? () {
NeonProvider.of<AccountsBloc>(context)
..updateAccount(state.requireData)
..setActiveAccount(state.requireData);

const HomeRoute().go(context);
}
: () {
if (state.hasError && NeonError.getDetails(state.error).isUnauthorized) {
Navigator.pop(context);
return;
const HomeRoute().go(context);
}
: () {
if (state.hasError && NeonError.getDetails(state.error).isUnauthorized) {
Navigator.pop(context);
return;
}

unawaited(bloc.refresh());
},
child: Text(
state.hasData
? NeonLocalizations.of(context).actionContinue
: NeonLocalizations.of(context).actionRetry,
unawaited(bloc.refresh());
},
child: Text(
state.hasData
? NeonLocalizations.of(context).actionContinue
: NeonLocalizations.of(context).actionRetry,
),
),
),
),
],
],
),
),
),
),
Expand Down
68 changes: 35 additions & 33 deletions packages/neon/neon/lib/src/pages/login_check_server_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,41 +51,43 @@ class _LoginCheckServerStatusPageState extends State<LoginCheckServerStatusPage>
@override
Widget build(final BuildContext context) => Scaffold(
appBar: AppBar(),
body: Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: ResultBuilder.behaviorSubject(
subject: bloc.state,
builder: (final context, final state) {
final success = state.hasData && state.requireData.isSupported && !state.requireData.maintenance;

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
NeonValidationTile(
title: NeonError.getDetails(state.error).getText(context),
state: ValidationState.failure,
),
],
_buildServerVersionTile(state),
_buildMaintenanceModeTile(state),
Align(
alignment: Alignment.bottomRight,
child: ElevatedButton(
onPressed: success ? _onContinue : bloc.refresh,
child: Text(
success
? NeonLocalizations.of(context).actionContinue
: NeonLocalizations.of(context).actionRetry,
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.all(10),
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: ResultBuilder.behaviorSubject(
subject: bloc.state,
builder: (final context, final state) {
final success = state.hasData && state.requireData.isSupported && !state.requireData.maintenance;

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (state.hasError) ...[
NeonValidationTile(
title: NeonError.getDetails(state.error).getText(context),
state: ValidationState.failure,
),
],
_buildServerVersionTile(state),
_buildMaintenanceModeTile(state),
Align(
alignment: Alignment.bottomRight,
child: ElevatedButton(
onPressed: success ? _onContinue : bloc.refresh,
child: Text(
success
? NeonLocalizations.of(context).actionContinue
: NeonLocalizations.of(context).actionRetry,
),
),
),
),
],
);
},
],
);
},
),
),
),
),
Expand Down
Loading

0 comments on commit b617373

Please sign in to comment.