simc / auto_size_text

Flutter widget that automatically resizes text to fit perfectly within its bounds.
https://pub.dev/packages/auto_size_text
MIT License
2.06k stars 241 forks source link

textAlign: TextAlign.justify not working same on all browsers/platforms #62

Open crazedVic opened 4 years ago

crazedVic commented 4 years ago

Steps to Reproduce Please tell me exactly how to reproduce the problem you are running into:

textAlign: TextAlign.justify does not seem to work on Safari Mobile or Mac Desktop. Works as expected on Chrome Mac Desktop and Chrome Android. Does not seem to work on Chrome IOS.

Showing the entire containment of the AutoSizeText in case it might be the underlying cause?

Code sample

Expanded(
                    flex: 1,
                    child: SingleChildScrollView(
                      child: Container(
                        alignment: Alignment.center,
                        padding: EdgeInsets.symmetric(horizontal: 25),
                        child: Column(
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            Container(
                              padding: EdgeInsets.symmetric(vertical: 16),
                              alignment: Alignment.topCenter,
                              child: Image.asset(
                                kLogo,
                                fit: BoxFit.contain,
                                width: 160,
                                // height: constraints.maxHeight * 0.2,
                              ),
                            ),
                            SizedBox(
                              height: 10,
                            ),
                            Container(
                              child: AutoSizeText(
                                LocaleKeys.appText.tr(),
                                textAlign: TextAlign.justify,
                                minFontSize: 18,
                                style: infoTextStyle,
                              ),
                            ),
                            SizedBox(
                              height: 40,
                            ),
                            textInput.TextInput(
                              controller: controller,
                              placeholder: LocaleKeys.name_placeholder.tr(),
                              borderColor: borderColor,
                              onChanged: (val) {
                                setState(() {
                                  borderColor = Colors.black;
                                });
                              },
                              inputFormatters: [
                                WhitelistingTextInputFormatter(
                                    RegExp("[$nameRegExp]"))
                              ],
                            ),
                            borderColor == Colors.red
                                ? Container(
                                    width: maxWidth,
                                    child: Text(
                                      LocaleKeys.first_last_name_required.tr(),
                                      textAlign: TextAlign.end,
                                      style: TextStyle(
                                          fontSize: 12, color: borderColor),
                                    ),
                                  )
                                : SizedBox(),
                            Container(
                              margin: EdgeInsets.fromLTRB(0, 24, 0, 0),
                              alignment: Alignment.bottomRight,
                              height: 60,
                              child: Button(
                                width: 140,
                                text: LocaleKeys.start.tr().toUpperCase(),
                                color: primaryButtonColor,
                                onTap: onTapStart,
                              ),
                            ),
                            SizedBox(
                              height: 30,
                            ),
                          ],
                        ),
                      ),
                    ),
                  )

Screenshots Screen Shot 2020-06-19 at 9 28 03 AM

Version

loic-hamdi commented 3 years ago

Any update on this issue please?

PcolBP commented 2 years ago

It's engine specific. I had same problem when tried to develop page in web-renderer html. Changed to canvaskit and problem with TextAlign doesn't exist any more. Which web-renderer do you use?