Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SuperTextField] - Add vertical alignment to SuperTextField #509

Open
lucasarcouto opened this issue Mar 31, 2022 · 2 comments
Open

[SuperTextField] - Add vertical alignment to SuperTextField #509

lucasarcouto opened this issue Mar 31, 2022 · 2 comments

Comments

@lucasarcouto
Copy link

lucasarcouto commented Mar 31, 2022

Note from Matt: This is a feature request, not a bug. The poster would like for SuperTextField to support vertical alignment. It's unclear how that would work in conjunction with viewport sizing, but maybe there's a way.

Steps to reproduce

Code:

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Container(
            color: Colors.black,
            child: const SuperTextField(
              lineHeight: 16,
              minLines: 2,
              textAlign: TextAlign.center,
            ),
          ),
        ),
      ),
    );
  }
}
  • Run the app
  • Tap black rectangle (the text field)
  • Type "abc"

Actual behavior

Text stays at the top of the text field.

5_vertical_alignment_issue.mp4

Expected behavior

If user types less paragraphs than minLines, text should be displayed at the center of the widget.

Platform

Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7e9793dee1 (4 weeks ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2

CC @venkatd

@matthew-carroll
Copy link
Contributor

I think you're confusing vertical and horizontal alignment. TextAlign.center means horizontal center, not vertical center.

As for the horizontal center, can you check the width of your SuperTextField? I can't tell whether horizontal centering is working or not, because I can't see the actual bounds of the text field.

@lucasarcouto
Copy link
Author

lucasarcouto commented Apr 18, 2022

Hi @matthew-carroll! Yes, I'm aware that TextAlign.center means horizontal alignment. I left it there as a reference to show that this is the only option available for text alignment for the SuperTextField widget.

Looks like horizontal alignment is not working as well. As you can see in the screenshot below, the SuperTextField widget has a width of 411.4px, which is the same as the parent Container.

Screen Shot 2022-04-18 at 09 46 02

@matthew-carroll matthew-carroll changed the title [SuperTextField] [iOS] [Android] [Web] Can't center text vertically inside SuperTextEditor [SuperTextField] - Add vertical alignment to SuperTextField Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants