1

My flutter web app keeps italicizing my text when I open it with my a mobile web browser, I even tried using a rich text widget but still nothing, but it look normal always on my web browser on my PC

I even tried setting the rich text property of textstyle to normal just to make sure it wasn't using an italicized font, now I just don't know, any ideas please, thanks

Row(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        MouseRegion(
                            cursor: SystemMouseCursors.click,
                            child: GestureDetector(
                                onTap: () {
                                  ref
                                      .read(homepageProvider)
                                      .setShowSearchDrop();
                                  ref.read(homepageProvider).getData();
                                },
                                child: Container(
                                    decoration: BoxDecoration(
                                        color: colorScheme!.primary,
                                        borderRadius:
                                            BorderRadius.circular(100)),
                                    width: 12 / 100 * screenWidth,
                                    height: 5 / 100 * screenWidth,
                                    padding:
                                        EdgeInsets.all(0 / 100 * screenHeight),
                                    child: SvgPicture.asset(
                                      "assets/images/menu_mobile.svg",
                                      semanticsLabel: 'Acme Logo',
                                      color: colorScheme.greyMain,
                                    )))),
                        Spacer(),
                        RichText(
                          // Controls visual overflow
                          //overflow: TextOverflow.fade,

                          // Controls how the text should be aligned horizontally
                          textAlign: TextAlign.center,

                          // Control the text direction
                          // textDirection: TextDirection.ltr,

                          // Whether the text should break at soft line breaks
                          softWrap: false,

                          // Maximum number of lines for the text to span
                          maxLines: 1,

                          // The number of font pixels for each logical pixel
                          textScaleFactor: 0.9,
                          text: TextSpan(
                            text: 'e',
                            style: TextStyle(
                                color: colorScheme.secondary,
                                fontFamily: 'Nordeco',
                                fontSize: 8 / 100 * screenWidth,
                                fontWeight: FontWeight.w900),
                            children: <TextSpan>[
                              TextSpan(
                                  text: 'travella',
                                  style: TextStyle(
                                      color: colorScheme.greyMain!
                                          .withOpacity(0.9),
                                      fontFamily: 'Nordeco',
                                      fontSize: 8 / 100 * screenWidth,
                                      fontWeight: FontWeight.w900)),
                              TextSpan(
                                  text: '.com',
                                  style: TextStyle(
                                      color: colorScheme.secondary,
                                      fontFamily: 'Nordeco',
                                      fontSize: 8 / 100 * screenWidth,
                                      fontWeight: FontWeight.w900))
                            ],
                          ),
                        ),
                        Spacer(),
                        MouseRegion(
                            cursor: SystemMouseCursors.click,
                            child: GestureDetector(
                                onTap: () {},
                                child: Container(
                                    decoration: BoxDecoration(
                                        color: colorScheme.secondary,
                                        borderRadius:
                                            BorderRadius.circular(100)),
                                    width: 8.5 / 100 * screenWidth,
                                    height: 8.5 / 100 * screenWidth,
                                    padding: EdgeInsets.all(
                                        1.2 / 100 * screenHeight),
                                    child: SvgPicture.asset(
                                      "assets/images/search.svg",
                                      semanticsLabel: 'Acme Logo',
                                      color: colorScheme.background,
                                    )))),
                        SizedBox(
                          width: 2 / 100 * screenWidth,
                        )
                      ])),
              Container(
                  padding: EdgeInsets.only(
                      top: 1 / 100 * screenHeight,
                      bottom: 1 / 100 * screenHeight),
                  color: colorScheme.primary,
                  width: screenWidth,
                  height: 9 / 100 * screenHeight,
                  child: ListView(
                      physics: const BouncingScrollPhysics(
                          parent: AlwaysScrollableScrollPhysics()),
                      scrollDirection: Axis.horizontal,
                      padding: EdgeInsets.all(1 / 100 * screenWidth),
                      children: <Widget>[
                        SizedBox(
                          width: 3 / 100 * screenWidth,
                        ),
                        MouseRegion(
                            cursor: SystemMouseCursors.click,
                            child: GestureDetector(
                                onTap: () {},
                                child: Container(
                                    height: 3 / 100 * screenHeight,
                                    width: 22 / 100 * screenWidth,
                                    padding:
                                        EdgeInsets.all(0.1 / 100 * screenWidth),
                                    decoration: BoxDecoration(
                                        border: Border.all(
                                            color: colorScheme.greyMain!
                                                .withOpacity(0.6)),
                                        color: colorScheme.background,
                                        borderRadius:
                                            BorderRadius.circular(30)),
                                    child: Row(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        crossAxisAlignment:
                                            CrossAxisAlignment.center,
                                        children: <Widget>[
                                          RichText(
                                              // Controls visual overflow
                                              //overflow: TextOverflow.fade,

                                              // Controls how the text should be aligned horizontally
                                              textAlign: TextAlign.center,

                                              // Control the text direction
                                              // textDirection: TextDirection.ltr,

                                              // Whether the text should break at soft line breaks
                                              softWrap: false,

                                              // Maximum number of lines for the text to span
                                              maxLines: 1,

                                              // The number of font pixels for each logical pixel
                                              textScaleFactor: 0.9,
                                              text: TextSpan(
                                                  text: ("Hotels"),
                                                  style: TextStyle(
                                                      fontStyle:
                                                          FontStyle.normal,
                                                      color:
                                                          colorScheme.greyMain,
                                                      fontFamily: 'Brasley',
                                                      fontSize:
                                                          4 / 100 * screenWidth,
                                                      fontWeight:
                                                          FontWeight.w600),
                                                  children: <TextSpan>[]))
                                        ])
  • Q: What kind of mobile device are you using? Q: Which browser? Q: How exactly are you deploying your "web app" from your development station so you can view it on your mobile device? Q: Have you tried reproducing the problem with a small Flutter app that does nothing but display "Hello world"? – paulsm4 Dec 24 '22 at 07:00
  • I'm using a oneplus 5T with a chrome browser, but it does the same on a Firefox browser, I'm using flutter build web then deploying it to Firebase hosting, then visiting it on my mobile browser at etravella.com, maybe you could appreciate the problem as well, havnt tried running it as a native mobile app because I'm building a web and mobile app version, even if it worked, I could not use it – Macphail Magwira Dec 24 '22 at 07:05
  • Perhaps, you could share the section of code where you define your text. Also, it would be helpful to have a look at your `flutter doctor` output. The way you are asking your question is vague and it will be hard for the community to reproduce this behavior! So, if you can provide a bit more details (with code snippets) it would help! – Younss AIT MOU Dec 24 '22 at 08:15
  • @YounssAITMOU just added that – Macphail Magwira Dec 24 '22 at 14:56
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Dec 25 '22 at 12:10

1 Answers1

2
flutter build web --web-renderer canvaskit

worked for me

  • Please read "[answer]" and "[Explaining entirely code-based answers](https://meta.stackoverflow.com/q/392712/128421)". It helps more if you supply an explanation why this is the preferred solution and explain how it works. We want to educate, not just provide code. – the Tin Man Mar 21 '23 at 00:07
  • It also fixed my problem which was displaying left to right text as right to left even when I used Directionality. – hamid reza Jul 30 '23 at 08:38