From 842f69ebc97a0160dcc8cc5dffee26b144684fba Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Tue, 8 Sep 2026 16:31:01 +0200 Subject: [PATCH] Web mobile : le clavier ne s'ouvrait pas sur l'ecran de login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit web/index.html n'avait aucune balise . Les navigateurs mobiles appliquaient donc un viewport virtuel de ~980px et dezoomaient la page, ce qui decalait les DOM caches par lesquels Flutter web gere la saisie : le tap donnait bien le focus cote Flutter, mais le navigateur n'ouvrait pas le clavier et tentait de zoomer sur l'element — l'ecran semblait juste se rafraichir. Effet de bord, le LayoutBuilder du login voyait maxWidth ~980, donc isMobile etait toujours faux et la mise en page mobile ne s'appliquait jamais. maximum-scale=1.0 evite en plus le zoom automatique de Safari iOS au focus. Au passage : - suppression de window.flutterWebRenderer = "html", sans effet depuis que le renderer HTML a ete retire de Flutter (3.29, on est en 3.44) ; - badge de version sur l'ecran de login. kGitSha est injecte au build (--dart-define=GIT_SHA) et affiche a cote du numero de pubspec, pour relier un bundle deploye au commit exact qui l'a produit ; - la Future de PackageInfo etait recreee a chaque build() du login, ce qui faisait clignoter le libelle : elle est desormais construite une seule fois. Co-Authored-By: Claude Opus 5 (1M context) --- Dockerfile | 6 +++++- lib/Screens/login_screen.dart | 5 +++-- lib/constants.dart | 7 +++++++ pubspec.yaml | 2 +- web/index.html | 4 +--- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 39f74fd..c5615b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,14 @@ FROM ghcr.io/cirruslabs/flutter:3.44.0 AS build # docker build --build-arg API_BASE_URL=https://api.mymuseum.be -t ... . ARG API_BASE_URL=http://localhost:5000 +# Empreinte du commit, affichee sur l'ecran de login (voir kGitSha). +# docker build --build-arg GIT_SHA=$(git rev-parse --short HEAD) ... +ARG GIT_SHA=dev + WORKDIR /app COPY . . RUN flutter pub get -RUN flutter build web --release --dart-define=API_BASE_URL=$API_BASE_URL +RUN flutter build web --release --dart-define=API_BASE_URL=$API_BASE_URL --dart-define=GIT_SHA=$GIT_SHA FROM nginx:1.27-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/lib/Screens/login_screen.dart b/lib/Screens/login_screen.dart index d11215d..ad39466 100644 --- a/lib/Screens/login_screen.dart +++ b/lib/Screens/login_screen.dart @@ -42,6 +42,7 @@ class _LoginScreenState extends State { String? instanceId; String? pinCode; Storage localStorage = window.localStorage; + late final Future appVersion = getAppVersion(); void authenticateTRY(AppContext appContext, bool fromClick) async { clientAPI = Client(this.host!); @@ -290,7 +291,7 @@ class _LoginScreenState extends State { textAlign: TextAlign.center, ), FutureBuilder( - future: getAppVersion(), + future: appVersion, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) { @@ -389,6 +390,6 @@ class _LoginScreenState extends State { Future getAppVersion() async { PackageInfo packageInfo = await PackageInfo.fromPlatform(); - return packageInfo.version; + return 'v${packageInfo.version} \u00b7 $kGitSha'; } } diff --git a/lib/constants.dart b/lib/constants.dart index 20dfcb8..dc4bc38 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -23,6 +23,13 @@ const kSuccess = Color(0xFF8bc34a); const kApiBaseUrl = String.fromEnvironment('API_BASE_URL', defaultValue: 'http://localhost:5000'); +// Empreinte du build, injectee elle aussi au build : +// --dart-define=GIT_SHA=$(git rev-parse --short HEAD) +// Elle est affichee sous le titre de l'ecran de login et sert a relier un +// bundle deploye au commit exact qui l'a produit : le numero de version du +// pubspec ne suffisait pas, il ne bougeait pas d'un deploiement a l'autre. +const kGitSha = String.fromEnvironment('GIT_SHA', defaultValue: 'dev'); + // Responsive const kBreakpointMobile = 850.0; diff --git a/pubspec.yaml b/pubspec.yaml index 0d4c32d..a044ba8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.0.0+10 +version: 3.1.3+11 environment: sdk: ">=3.1.0 <4.0.0" diff --git a/web/index.html b/web/index.html index b36c14f..f57bb26 100644 --- a/web/index.html +++ b/web/index.html @@ -14,6 +14,7 @@ + @@ -112,9 +113,6 @@ loadMainDartJs(); } -