From 229245483067eefc0ed144bc122cf665777aba08 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 23 Apr 2021 12:24:35 +0200 Subject: [PATCH] Adapt initialize widget --- lib/main_forez_dev.dart | 3 ++ lib/models/config.dart | 5 ++- lib/ui/widgets/init_widget.dart | 67 +++++++++++++++++---------------- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/lib/main_forez_dev.dart b/lib/main_forez_dev.dart index 2c60d60..115044a 100644 --- a/lib/main_forez_dev.dart +++ b/lib/main_forez_dev.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:comunic/main.dart'; import 'package:comunic/models/config.dart'; +import 'package:flutter/material.dart'; /// Forez development configuration /// @@ -24,6 +25,8 @@ void main() { apiServerUri: "/", apiServerSecure: false, clientName: "ForezFlutter", + splashBackgroundColor: Colors.green.shade900, + appName: "#Forez", )); HttpOverrides.global = new MyHttpOverride(); diff --git a/lib/models/config.dart b/lib/models/config.dart index 5abcd97..91773eb 100644 --- a/lib/models/config.dart +++ b/lib/models/config.dart @@ -15,6 +15,7 @@ class Config { final bool apiServerSecure; final String clientName; final Color splashBackgroundColor; + final String appName; const Config({ @required this.apiServerName, @@ -22,11 +23,13 @@ class Config { @required this.apiServerSecure, @required this.clientName, this.splashBackgroundColor = defaultColor, + this.appName = "Comunic", }) : assert(apiServerName != null), assert(apiServerUri != null), assert(apiServerSecure != null), assert(clientName != null), - assert(splashBackgroundColor != null); + assert(splashBackgroundColor != null), + assert(appName != null); /// Get and set static configuration static Config _config; diff --git a/lib/ui/widgets/init_widget.dart b/lib/ui/widgets/init_widget.dart index 9dbaca1..aa51a87 100644 --- a/lib/ui/widgets/init_widget.dart +++ b/lib/ui/widgets/init_widget.dart @@ -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/tablet_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/utils/flutter_utils.dart'; import 'package:comunic/utils/intl_utils.dart'; @@ -113,38 +114,40 @@ class _InitializeWidgetState extends SafeState { /// Build loading widget Widget _buildNonReadyWidget() { - return Scaffold( - backgroundColor: config().splashBackgroundColor, - body: Center( - child: Material( - color: Colors.transparent, - textStyle: TextStyle(color: Colors.white), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Spacer( - flex: 4, - ), - Text( - tr("Comunic"), - style: TextStyle(fontSize: 50), - ), - Spacer( - flex: 2, - ), - _error ? _buildErrorWidget() : _buildConnectingWidget(), - Spacer( - flex: 2, - ), - !isWeb - ? Text(tr("Version %version% - Build %build%", args: { - "version": VersionHelper.info.version.toString(), - "build": VersionHelper.info.buildNumber.toString() - })) - : Container(), - Spacer(flex: 1), - ], + return LoginRoutesTheme( + child: Scaffold( + backgroundColor: config().splashBackgroundColor, + body: Center( + child: Material( + color: Colors.transparent, + textStyle: TextStyle(color: Colors.white), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Spacer( + flex: 4, + ), + Text( + config().appName, + style: TextStyle(fontSize: 50), + ), + Spacer( + flex: 2, + ), + _error ? _buildErrorWidget() : _buildConnectingWidget(), + Spacer( + flex: 2, + ), + !isWeb + ? Text(tr("Version %version% - Build %build%", args: { + "version": VersionHelper.info.version.toString(), + "build": VersionHelper.info.buildNumber.toString() + })) + : Container(), + Spacer(flex: 1), + ], + ), ), ), ),