From 442f20b9898ee2d752256e31c7bbfccaf49beebe Mon Sep 17 00:00:00 2001 From: Mateo MARTINEZ Date: Tue, 12 Mar 2024 15:27:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(web):=20add=20kIsWeb=20befor?= =?UTF-8?q?e=20Platform=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/ui/about/detail/about_file_screen.dart | 13 +++++++++---- app/lib/ui/components/textfields/textfield.dart | 5 +++-- .../components/textfields/textfield_password.dart | 5 +++-- .../typography/guideline_typography_screen.dart | 3 ++- .../components/sheets_bottom/ods_sheets_bottom.dart | 3 ++- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/lib/ui/about/detail/about_file_screen.dart b/app/lib/ui/about/detail/about_file_screen.dart index bdd94935..d2a9dcc9 100644 --- a/app/lib/ui/about/detail/about_file_screen.dart +++ b/app/lib/ui/about/detail/about_file_screen.dart @@ -13,6 +13,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:markdown/markdown.dart' as md; @@ -317,10 +318,14 @@ String convertToHtml( var result = ""; result += head; - if (Platform.isIOS) { - result += cssApple; - } else if (Platform.isAndroid) { - result += cssAndroid; + if (!kIsWeb) { + if (Platform.isIOS) { + result += cssApple; + } else { + if (Platform.isAndroid) { + result += cssAndroid; + } + } } result += ""; diff --git a/app/lib/ui/components/textfields/textfield.dart b/app/lib/ui/components/textfields/textfield.dart index 882af35f..0e0df2f6 100644 --- a/app/lib/ui/components/textfields/textfield.dart +++ b/app/lib/ui/components/textfields/textfield.dart @@ -13,6 +13,7 @@ import 'dart:io'; import 'dart:math'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart'; import 'package:ods_flutter/components/chips/ods_choice_chips.dart'; @@ -130,7 +131,7 @@ class _BodyState extends State<_Body> { ///Keyboard action switch (customizationState?.selectedKeyboardAction) { case KeyboardActionEnum.none: - if (Platform.isAndroid) { + if (kIsWeb || Platform.isAndroid) { keyboardAction = TextInputAction.none; } else if (Platform.isIOS) { keyboardAction = TextInputAction.unspecified; @@ -152,7 +153,7 @@ class _BodyState extends State<_Body> { keyboardAction = TextInputAction.send; break; case KeyboardActionEnum.previous: - if (Platform.isAndroid) { + if (kIsWeb || Platform.isAndroid) { keyboardAction = TextInputAction.previous; } break; diff --git a/app/lib/ui/components/textfields/textfield_password.dart b/app/lib/ui/components/textfields/textfield_password.dart index 4ab80f27..29233417 100644 --- a/app/lib/ui/components/textfields/textfield_password.dart +++ b/app/lib/ui/components/textfields/textfield_password.dart @@ -13,6 +13,7 @@ import 'dart:io'; import 'dart:math'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart'; import 'package:ods_flutter/components/chips/ods_choice_chips.dart'; @@ -129,7 +130,7 @@ class _BodyState extends State<_Body> { ///Keyboard action switch (customizationState?.selectedKeyboardAction) { case KeyboardActionEnum.none: - if (Platform.isAndroid) { + if (kIsWeb || Platform.isAndroid) { keyboardAction = TextInputAction.none; } else if (Platform.isIOS) { keyboardAction = TextInputAction.unspecified; @@ -151,7 +152,7 @@ class _BodyState extends State<_Body> { keyboardAction = TextInputAction.send; break; case KeyboardActionEnum.previous: - if (Platform.isAndroid) { + if (!kIsWeb && Platform.isAndroid) { keyboardAction = TextInputAction.previous; } break; diff --git a/app/lib/ui/guidelines/typography/guideline_typography_screen.dart b/app/lib/ui/guidelines/typography/guideline_typography_screen.dart index 6d0779ef..ae1dabc8 100644 --- a/app/lib/ui/guidelines/typography/guideline_typography_screen.dart +++ b/app/lib/ui/guidelines/typography/guideline_typography_screen.dart @@ -12,6 +12,7 @@ import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/ods_flutter_app_localizations.dart'; import 'package:ods_flutter/components/divider/ods_divider.dart'; @@ -85,7 +86,7 @@ class GuidelineTypographyScreen extends StatelessWidget { padding: EdgeInsets.all(spacingM), child: Column( children: [ - Platform.isAndroid + kIsWeb || Platform.isAndroid ? Text( AppLocalizations.of(context)! .guidelinesTypographyAndroidDescription, diff --git a/library/lib/components/sheets_bottom/ods_sheets_bottom.dart b/library/lib/components/sheets_bottom/ods_sheets_bottom.dart index ae7e3dcc..f291ed26 100644 --- a/library/lib/components/sheets_bottom/ods_sheets_bottom.dart +++ b/library/lib/components/sheets_bottom/ods_sheets_bottom.dart @@ -12,6 +12,7 @@ import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:ods_flutter/guidelines/spacings.dart'; @@ -45,7 +46,7 @@ class _OdsSheetsBottomState extends State { @override Widget build(BuildContext context) { - double collapsedHeight = Platform.isAndroid ? 80 : 91; + double collapsedHeight = !kIsWeb && Platform.isAndroid ? 80 : 91; return Container( decoration: BoxDecoration(