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

Validation error message can not be placed to center #21343

Closed
gibbsvjy007 opened this issue Sep 2, 2018 · 8 comments
Closed

Validation error message can not be placed to center #21343

gibbsvjy007 opened this issue Sep 2, 2018 · 8 comments
Labels
a: quality A truly polished experience a: text input Entering text in a text field or keyboard related problems c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. found in release: 1.19 Found to occur in 1.19 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on r: duplicate Issue is closed as a duplicate of an existing issue

Comments

@gibbsvjy007
Copy link

1

I want to place this error message to center. This is not possible with currently. I tried almost every approach.

  • textAlign: TextAlign.center,

is not helping to move error message to center. It moves the input text and placeholder to center not an error message

We need this in our current design spec. It would be good if you fix it as early as possible.

Thanks.

@gibbsvjy007 gibbsvjy007 changed the title Error message style can not be placed to center Validation error message can not be placed to center Sep 2, 2018
@zoechi zoechi added the framework flutter/packages/flutter repository. See also f: labels. label Sep 3, 2018
@goderbauer goderbauer added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. labels Jan 3, 2019
@DSoftwareArtist
Copy link

Any news about this issue?

@Miloshinjo
Copy link

Did anyone find a workaround for this issue?

@copmorty
Copy link

Still no solution for this?

@TahaTesser TahaTesser added the customer: crowd Affects or could affect many people, though not necessarily a specific customer. label Feb 13, 2020
@TahaTesser
Copy link
Member

TahaTesser commented May 20, 2020

Issue still valid, there is no way customize validation error message location

Code Sample
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final appTitle = 'Form Validation Demo';

    return MaterialApp(
      title: appTitle,
      home: Scaffold(
        appBar: AppBar(
          title: Text(appTitle),
        ),
        body: MyCustomForm(),
      ),
    );
  }
}

// Create a Form widget.
class MyCustomForm extends StatefulWidget {
  @override
  MyCustomFormState createState() {
    return MyCustomFormState();
  }
}

// Create a corresponding State class.
// This class holds data related to the form.
class MyCustomFormState extends State<MyCustomForm> {
  // Create a global key that uniquely identifies the Form widget
  // and allows validation of the form.
  //
  // Note: This is a GlobalKey<FormState>,
  // not a GlobalKey<MyCustomFormState>.
  final _formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    // Build a Form widget using the _formKey created above.
    return Form(
      key: _formKey,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          TextFormField(
            validator: (value) {
              if (value.isEmpty) {
                return 'Please enter some text';
              }
              return null;
            },
          ),
          Padding(
            padding: const EdgeInsets.symmetric(vertical: 16.0),
            child: RaisedButton(
              onPressed: () {
                // Validate returns true if the form is valid, or false
                // otherwise.
                if (_formKey.currentState.validate()) {
                  // If the form is valid, display a Snackbar.
                  Scaffold.of(context)
                      .showSnackBar(SnackBar(content: Text('Processing Data')));
                }
              },
              child: Text('Submit'),
            ),
          ),
        ],
      ),
    );
  }
}

flutter doctor -v
[✓] Flutter (Channel dev, 1.19.0-1.0.pre, on Mac OS X 10.15.4 19E287, locale en-GB)
    • Flutter version 1.19.0-1.0.pre at /Users/tahatesser/Code/flutter_dev
    • Framework revision 456d80b9dd (9 days ago), 2020-05-11 11:45:03 -0400
    • Engine revision d96f962ca2
    • Dart version 2.9.0 (build 2.9.0-7.0.dev 092ed38a87)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/tahatesser/Code/SDK
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Users/tahatesser/Code/SDK
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.9.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[✓] Connected device (5 available)
    • SM M305F      • 32003c30dc19668f          • android-arm64  • Android 10 (API 29)
    • Taha’s iPhone • 00008020-001059882212002E • ios            • iOS 13.4.1
    • macOS         • macOS                     • darwin-x64     • Mac OS X 10.15.4 19E287
    • Web Server    • web-server                • web-javascript • Flutter Tools
    • Chrome        • chrome                    • web-javascript • Google Chrome 81.0.4044.138

• No issues found!

@TahaTesser TahaTesser added a: quality A truly polished experience c: new feature Nothing broken; request for a new capability found in release: 1.19 Found to occur in 1.19 has reproducible steps The issue has been confirmed reproducible and is ready to work on and removed customer: crowd Affects or could affect many people, though not necessarily a specific customer. labels May 20, 2020
@MonkeyDrone
Copy link

Still looking for a fix guys!

@kdsinghapp
Copy link

any fix ?

@TahaTesser
Copy link
Member

duplicate of #11068

@TahaTesser TahaTesser added the r: duplicate Issue is closed as a duplicate of an existing issue label Aug 23, 2021
@github-actions
Copy link

github-actions bot commented Sep 6, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: quality A truly polished experience a: text input Entering text in a text field or keyboard related problems c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. found in release: 1.19 Found to occur in 1.19 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on r: duplicate Issue is closed as a duplicate of an existing issue
Projects
None yet
Development

No branches or pull requests

9 participants