mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Adapt initialize widget
This commit is contained in:
		@@ -2,6 +2,7 @@ import 'dart:io';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import 'package:comunic/main.dart';
 | 
					import 'package:comunic/main.dart';
 | 
				
			||||||
import 'package:comunic/models/config.dart';
 | 
					import 'package:comunic/models/config.dart';
 | 
				
			||||||
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Forez development configuration
 | 
					/// Forez development configuration
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
@@ -24,6 +25,8 @@ void main() {
 | 
				
			|||||||
    apiServerUri: "/",
 | 
					    apiServerUri: "/",
 | 
				
			||||||
    apiServerSecure: false,
 | 
					    apiServerSecure: false,
 | 
				
			||||||
    clientName: "ForezFlutter",
 | 
					    clientName: "ForezFlutter",
 | 
				
			||||||
 | 
					    splashBackgroundColor: Colors.green.shade900,
 | 
				
			||||||
 | 
					    appName: "#Forez",
 | 
				
			||||||
  ));
 | 
					  ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HttpOverrides.global = new MyHttpOverride();
 | 
					  HttpOverrides.global = new MyHttpOverride();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ class Config {
 | 
				
			|||||||
  final bool apiServerSecure;
 | 
					  final bool apiServerSecure;
 | 
				
			||||||
  final String clientName;
 | 
					  final String clientName;
 | 
				
			||||||
  final Color splashBackgroundColor;
 | 
					  final Color splashBackgroundColor;
 | 
				
			||||||
 | 
					  final String appName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const Config({
 | 
					  const Config({
 | 
				
			||||||
    @required this.apiServerName,
 | 
					    @required this.apiServerName,
 | 
				
			||||||
@@ -22,11 +23,13 @@ class Config {
 | 
				
			|||||||
    @required this.apiServerSecure,
 | 
					    @required this.apiServerSecure,
 | 
				
			||||||
    @required this.clientName,
 | 
					    @required this.clientName,
 | 
				
			||||||
    this.splashBackgroundColor = defaultColor,
 | 
					    this.splashBackgroundColor = defaultColor,
 | 
				
			||||||
 | 
					    this.appName = "Comunic",
 | 
				
			||||||
  })  : assert(apiServerName != null),
 | 
					  })  : assert(apiServerName != null),
 | 
				
			||||||
        assert(apiServerUri != null),
 | 
					        assert(apiServerUri != null),
 | 
				
			||||||
        assert(apiServerSecure != null),
 | 
					        assert(apiServerSecure != null),
 | 
				
			||||||
        assert(clientName != null),
 | 
					        assert(clientName != null),
 | 
				
			||||||
        assert(splashBackgroundColor != null);
 | 
					        assert(splashBackgroundColor != null),
 | 
				
			||||||
 | 
					        assert(appName != null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// Get and set static configuration
 | 
					  /// Get and set static configuration
 | 
				
			||||||
  static Config _config;
 | 
					  static Config _config;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ import 'package:comunic/ui/routes/main_route/main_route.dart';
 | 
				
			|||||||
import 'package:comunic/ui/routes/main_route/smartphone_route.dart';
 | 
					import 'package:comunic/ui/routes/main_route/smartphone_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/main_route/tablet_route.dart';
 | 
					import 'package:comunic/ui/routes/main_route/tablet_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/welcome_route.dart';
 | 
					import 'package:comunic/ui/routes/welcome_route.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/ui/widgets/login_routes_theme.dart';
 | 
				
			||||||
import 'package:comunic/ui/widgets/safe_state.dart';
 | 
					import 'package:comunic/ui/widgets/safe_state.dart';
 | 
				
			||||||
import 'package:comunic/utils/flutter_utils.dart';
 | 
					import 'package:comunic/utils/flutter_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
@@ -113,38 +114,40 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /// Build loading widget
 | 
					  /// Build loading widget
 | 
				
			||||||
  Widget _buildNonReadyWidget() {
 | 
					  Widget _buildNonReadyWidget() {
 | 
				
			||||||
    return Scaffold(
 | 
					    return LoginRoutesTheme(
 | 
				
			||||||
      backgroundColor: config().splashBackgroundColor,
 | 
					      child: Scaffold(
 | 
				
			||||||
      body: Center(
 | 
					        backgroundColor: config().splashBackgroundColor,
 | 
				
			||||||
        child: Material(
 | 
					        body: Center(
 | 
				
			||||||
          color: Colors.transparent,
 | 
					          child: Material(
 | 
				
			||||||
          textStyle: TextStyle(color: Colors.white),
 | 
					            color: Colors.transparent,
 | 
				
			||||||
          child: Column(
 | 
					            textStyle: TextStyle(color: Colors.white),
 | 
				
			||||||
            mainAxisAlignment: MainAxisAlignment.center,
 | 
					            child: Column(
 | 
				
			||||||
            crossAxisAlignment: CrossAxisAlignment.center,
 | 
					              mainAxisAlignment: MainAxisAlignment.center,
 | 
				
			||||||
            children: <Widget>[
 | 
					              crossAxisAlignment: CrossAxisAlignment.center,
 | 
				
			||||||
              Spacer(
 | 
					              children: <Widget>[
 | 
				
			||||||
                flex: 4,
 | 
					                Spacer(
 | 
				
			||||||
              ),
 | 
					                  flex: 4,
 | 
				
			||||||
              Text(
 | 
					                ),
 | 
				
			||||||
                tr("Comunic"),
 | 
					                Text(
 | 
				
			||||||
                style: TextStyle(fontSize: 50),
 | 
					                  config().appName,
 | 
				
			||||||
              ),
 | 
					                  style: TextStyle(fontSize: 50),
 | 
				
			||||||
              Spacer(
 | 
					                ),
 | 
				
			||||||
                flex: 2,
 | 
					                Spacer(
 | 
				
			||||||
              ),
 | 
					                  flex: 2,
 | 
				
			||||||
              _error ? _buildErrorWidget() : _buildConnectingWidget(),
 | 
					                ),
 | 
				
			||||||
              Spacer(
 | 
					                _error ? _buildErrorWidget() : _buildConnectingWidget(),
 | 
				
			||||||
                flex: 2,
 | 
					                Spacer(
 | 
				
			||||||
              ),
 | 
					                  flex: 2,
 | 
				
			||||||
              !isWeb
 | 
					                ),
 | 
				
			||||||
                  ? Text(tr("Version %version% - Build %build%", args: {
 | 
					                !isWeb
 | 
				
			||||||
                      "version": VersionHelper.info.version.toString(),
 | 
					                    ? Text(tr("Version %version% - Build %build%", args: {
 | 
				
			||||||
                      "build": VersionHelper.info.buildNumber.toString()
 | 
					                        "version": VersionHelper.info.version.toString(),
 | 
				
			||||||
                    }))
 | 
					                        "build": VersionHelper.info.buildNumber.toString()
 | 
				
			||||||
                  : Container(),
 | 
					                      }))
 | 
				
			||||||
              Spacer(flex: 1),
 | 
					                    : Container(),
 | 
				
			||||||
            ],
 | 
					                Spacer(flex: 1),
 | 
				
			||||||
 | 
					              ],
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
      ),
 | 
					      ),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user