Web mobile : le clavier ne s'ouvrait pas sur l'ecran de login
web/index.html n'avait aucune balise <meta name="viewport">. Les navigateurs mobiles appliquaient donc un viewport virtuel de ~980px et dezoomaient la page, ce qui decalait les <input> 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) <noreply@anthropic.com>
This commit is contained in:
parent
0054122829
commit
842f69ebc9
@ -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 ... .
|
# docker build --build-arg API_BASE_URL=https://api.mymuseum.be -t ... .
|
||||||
ARG API_BASE_URL=http://localhost:5000
|
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
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN flutter pub get
|
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
|
FROM nginx:1.27-alpine
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
String? instanceId;
|
String? instanceId;
|
||||||
String? pinCode;
|
String? pinCode;
|
||||||
Storage localStorage = window.localStorage;
|
Storage localStorage = window.localStorage;
|
||||||
|
late final Future<String> appVersion = getAppVersion();
|
||||||
|
|
||||||
void authenticateTRY(AppContext appContext, bool fromClick) async {
|
void authenticateTRY(AppContext appContext, bool fromClick) async {
|
||||||
clientAPI = Client(this.host!);
|
clientAPI = Client(this.host!);
|
||||||
@ -290,7 +291,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: getAppVersion(),
|
future: appVersion,
|
||||||
builder: (context, AsyncSnapshot<String> snapshot) {
|
builder: (context, AsyncSnapshot<String> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done &&
|
if (snapshot.connectionState == ConnectionState.done &&
|
||||||
snapshot.data != null) {
|
snapshot.data != null) {
|
||||||
@ -389,6 +390,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
|
|
||||||
Future<String> getAppVersion() async {
|
Future<String> getAppVersion() async {
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
return packageInfo.version;
|
return 'v${packageInfo.version} \u00b7 $kGitSha';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,13 @@ const kSuccess = Color(0xFF8bc34a);
|
|||||||
const kApiBaseUrl = String.fromEnvironment('API_BASE_URL',
|
const kApiBaseUrl = String.fromEnvironment('API_BASE_URL',
|
||||||
defaultValue: 'http://localhost:5000');
|
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
|
// Responsive
|
||||||
const kBreakpointMobile = 850.0;
|
const kBreakpointMobile = 850.0;
|
||||||
|
|
||||||
|
|||||||
@ -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.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 3.0.0+10
|
version: 3.1.3+11
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.1.0 <4.0.0"
|
sdk: ">=3.1.0 <4.0.0"
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
<base href="/">
|
<base href="/">
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||||
<meta name="description" content="A new Flutter application.">
|
<meta name="description" content="A new Flutter application.">
|
||||||
|
|
||||||
@ -112,9 +113,6 @@
|
|||||||
loadMainDartJs();
|
loadMainDartJs();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
|
||||||
window.flutterWebRenderer = "html";
|
|
||||||
</script>
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
// Import the functions you need from the SDKs you need
|
// Import the functions you need from the SDKs you need
|
||||||
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
|
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user