|
|
|
@ -167,69 +167,71 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
: Center( |
|
|
|
|
child: Scrollbar( |
|
|
|
|
interactive: true, |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20), |
|
|
|
|
primary: true, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
SvgPicture.asset( |
|
|
|
|
'assets/logo.svg', |
|
|
|
|
width: 100, |
|
|
|
|
height: 100, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
Provider.of<Branding>(context, listen: false).name, |
|
|
|
|
style: Theme.of(context).textTheme.titleLarge, |
|
|
|
|
), |
|
|
|
|
const SizedBox( |
|
|
|
|
height: 30, |
|
|
|
|
), |
|
|
|
|
Text(AppLocalizations.of(context).loginWorksWith), |
|
|
|
|
const SizedBox( |
|
|
|
|
height: 20, |
|
|
|
|
), |
|
|
|
|
const NextcloudLogo(), |
|
|
|
|
Form( |
|
|
|
|
key: _formKey, |
|
|
|
|
child: TextFormField( |
|
|
|
|
focusNode: _focusNode, |
|
|
|
|
decoration: const InputDecoration( |
|
|
|
|
hintText: 'https://...', |
|
|
|
|
: Builder( |
|
|
|
|
builder: (final context) { |
|
|
|
|
final branding = Provider.of<Branding>(context, listen: false); |
|
|
|
|
return Center( |
|
|
|
|
child: Scrollbar( |
|
|
|
|
interactive: true, |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20), |
|
|
|
|
primary: true, |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
branding.logo, |
|
|
|
|
Text( |
|
|
|
|
branding.name, |
|
|
|
|
style: Theme.of(context).textTheme.titleLarge, |
|
|
|
|
), |
|
|
|
|
keyboardType: TextInputType.url, |
|
|
|
|
initialValue: widget.serverURL, |
|
|
|
|
validator: (final input) => validateHttpUrl(context, input), |
|
|
|
|
onFieldSubmitted: (final input) { |
|
|
|
|
if (_formKey.currentState!.validate()) { |
|
|
|
|
_loginBloc.setServerURL(input); |
|
|
|
|
} else { |
|
|
|
|
_focusNode.requestFocus(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
NeonLinearProgressIndicator( |
|
|
|
|
visible: serverConnectionStateSnapshot.data == ServerConnectionState.loading, |
|
|
|
|
const SizedBox( |
|
|
|
|
height: 30, |
|
|
|
|
), |
|
|
|
|
Text(AppLocalizations.of(context).loginWorksWith), |
|
|
|
|
const SizedBox( |
|
|
|
|
height: 20, |
|
|
|
|
), |
|
|
|
|
const NextcloudLogo(), |
|
|
|
|
Form( |
|
|
|
|
key: _formKey, |
|
|
|
|
child: TextFormField( |
|
|
|
|
focusNode: _focusNode, |
|
|
|
|
decoration: const InputDecoration( |
|
|
|
|
hintText: 'https://...', |
|
|
|
|
), |
|
|
|
|
keyboardType: TextInputType.url, |
|
|
|
|
initialValue: widget.serverURL, |
|
|
|
|
validator: (final input) => validateHttpUrl(context, input), |
|
|
|
|
onFieldSubmitted: (final input) { |
|
|
|
|
if (_formKey.currentState!.validate()) { |
|
|
|
|
_loginBloc.setServerURL(input); |
|
|
|
|
} else { |
|
|
|
|
_focusNode.requestFocus(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
NeonLinearProgressIndicator( |
|
|
|
|
visible: serverConnectionStateSnapshot.data == ServerConnectionState.loading, |
|
|
|
|
), |
|
|
|
|
if (serverConnectionStateSnapshot.data == ServerConnectionState.unreachable) ...[ |
|
|
|
|
NeonException( |
|
|
|
|
AppLocalizations.of(context).errorUnableToReachServer, |
|
|
|
|
onRetry: _loginBloc.refresh, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
if (serverConnectionStateSnapshot.data == |
|
|
|
|
ServerConnectionState.maintenanceMode) ...[ |
|
|
|
|
NeonException( |
|
|
|
|
AppLocalizations.of(context).errorServerInMaintenanceMode, |
|
|
|
|
onRetry: _loginBloc.refresh, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
if (serverConnectionStateSnapshot.data == ServerConnectionState.unreachable) ...[ |
|
|
|
|
NeonException( |
|
|
|
|
AppLocalizations.of(context).errorUnableToReachServer, |
|
|
|
|
onRetry: _loginBloc.refresh, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
if (serverConnectionStateSnapshot.data == ServerConnectionState.maintenanceMode) ...[ |
|
|
|
|
NeonException( |
|
|
|
|
AppLocalizations.of(context).errorServerInMaintenanceMode, |
|
|
|
|
onRetry: _loginBloc.refresh, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|