1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Can open Term Of Service from Create Account Page.

This commit is contained in:
Pierre HUBERT 2019-11-02 18:16:16 +01:00
parent 0162224b7f
commit 32a32224ca
3 changed files with 28 additions and 13 deletions

View File

@ -7,11 +7,13 @@ import 'package:comunic/models/config.dart';
void main() {
Config.set(Config(
apiServerName: "devweb.local",
apiServerUri: "/comunic/api/",
apiServerSecure: false,
serviceName: "ComunicFlutter",
serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq"));
apiServerName: "devweb.local",
apiServerUri: "/comunic/api/",
apiServerSecure: false,
serviceName: "ComunicFlutter",
serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq",
termOfServicesURL: "http://devweb.local/comunic/current/about.php?cgu",
));
subMain();
}

View File

@ -11,18 +11,21 @@ class Config {
final bool apiServerSecure;
final String serviceName;
final String serviceToken;
final String termOfServicesURL;
const Config(
{@required this.apiServerName,
@required this.apiServerUri,
@required this.apiServerSecure,
@required this.serviceName,
@required this.serviceToken})
: assert(apiServerName != null),
const Config({
@required this.apiServerName,
@required this.apiServerUri,
@required this.apiServerSecure,
@required this.serviceName,
@required this.serviceToken,
@required this.termOfServicesURL,
}) : assert(apiServerName != null),
assert(apiServerUri != null),
assert(apiServerSecure != null),
assert(serviceName != null),
assert(serviceToken != null);
assert(serviceToken != null),
assert(termOfServicesURL != null);
/// Get and set static configuration
static Config _config;

View File

@ -1,6 +1,8 @@
import 'package:comunic/models/config.dart';
import 'package:comunic/utils/input_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
/// Create account route
///
@ -132,6 +134,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
)
: null,
controlAffinity: ListTileControlAffinity.leading,
secondary: IconButton(
icon: Icon(Icons.open_in_new),
onPressed: _openTOS,
),
),
// Submit button
@ -161,6 +167,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
return;
}
}
void _openTOS() {
launch(config().termOfServicesURL);
}
}
class _InputEntry extends StatelessWidget {