Skip to content

Commit

Permalink
🐛 fix(web): add kIsWeb before Platform calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateo MARTINEZ committed Mar 15, 2024
1 parent 974b8c1 commit 442f20b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
13 changes: 9 additions & 4 deletions app/lib/ui/about/detail/about_file_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -317,10 +318,14 @@ String convertToHtml(
var result = "<html>";
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 += "</head>";
Expand Down
5 changes: 3 additions & 2 deletions app/lib/ui/components/textfields/textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions app/lib/ui/components/textfields/textfield_password.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion library/lib/components/sheets_bottom/ods_sheets_bottom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:ods_flutter/guidelines/spacings.dart';

Expand Down Expand Up @@ -45,7 +46,7 @@ class _OdsSheetsBottomState extends State<OdsSheetsBottom> {

@override
Widget build(BuildContext context) {
double collapsedHeight = Platform.isAndroid ? 80 : 91;
double collapsedHeight = !kIsWeb && Platform.isAndroid ? 80 : 91;

return Container(
decoration: BoxDecoration(
Expand Down

0 comments on commit 442f20b

Please sign in to comment.