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

[General]: When decoration is disabled, form field is enabled #1455

Open
7 tasks done
deandreamatias opened this issue Jan 5, 2025 · 0 comments
Open
7 tasks done
Labels
bug Something isn't working

Comments

@deandreamatias
Copy link
Collaborator

deandreamatias commented Jan 5, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

9.7.0

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

Flutter doctor
[✓] Flutter (Channel stable, 3.27.1, on Ubuntu 24.04.1 LTS 6.8.0-51-generic, locale en_US.UTF-8)
    • Flutter version 3.27.1 on channel stable at /home/matias/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (3 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
    • Android SDK at /home/matias/Android/Sdk
    • Platform android-35, build-tools 35.0.0-rc4
    • Java binary at: /home/matias/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2024.1)
    • Android Studio at /home/matias/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 81.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.96.1)
    • VS Code at /snap/code/current/usr/share/code
    • Flutter extension version 3.102.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 24.04.1 LTS 6.8.0-51-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 110.0.5481.177

[✓] Network resources
    • All expected network resources are available.

Minimal code example

Code sample
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:form_builder_validators/form_builder_validators.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter FormBuilder Example',
      debugShowCheckedModeBanner: false,
      localizationsDelegates: const [
        FormBuilderLocalizations.delegate,
        ...GlobalMaterialLocalizations.delegates,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: FormBuilderLocalizations.supportedLocales,
      home: const _ExamplePage(),
    );
  }
}

class _ExamplePage extends StatefulWidget {
  const _ExamplePage();

  @override
  State<_ExamplePage> createState() => _ExamplePageState();
}

class _ExamplePageState extends State<_ExamplePage> {
  final _formKey = GlobalKey<FormBuilderState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FormBuilder(
        key: _formKey,
        child: Column(
          children: [
            FormBuilderFilterChip<String>(
              decoration: const InputDecoration(
                labelText: 'The language of my people',
                enabled: false, // <--- Property changed
              ),
              name: 'languages_filter',
              selectedColor: Colors.red,
              options: const [
                FormBuilderChipOption(
                  value: 'Dart',
                  avatar: CircleAvatar(child: Text('D')),
                ),
                FormBuilderChipOption(
                  value: 'Kotlin',
                  avatar: CircleAvatar(child: Text('K')),
                ),
                FormBuilderChipOption(
                  value: 'Java',
                  avatar: CircleAvatar(child: Text('J')),
                ),
                FormBuilderChipOption(
                  value: 'Swift',
                  avatar: CircleAvatar(child: Text('S')),
                ),
                FormBuilderChipOption(
                  value: 'Objective-C',
                  avatar: CircleAvatar(child: Text('O')),
                ),
              ],
              validator: FormBuilderValidators.compose([
                FormBuilderValidators.minLength(1),
                FormBuilderValidators.maxLength(3),
              ]),
            ),
            const SizedBox(height: 10),
            ElevatedButton(
              onPressed: () {
                _formKey.currentState?.saveAndValidate();
                debugPrint(_formKey.currentState?.value.toString());
              },
              child: const Text('Print'),
            )
          ],
        ),
      ),
    );
  }
}

Current Behavior

When set a decoration property with a InputDecoration(enabled: false), the field still enabled

Expected Behavior

When set a decoration property with a InputDecoration(enabled: false), the field will be disabled and maintain consistency with field property enabled and form builder property enabled

Steps To Reproduce

  1. Run example
  2. See the field enabled or focus the field

Aditional information

Error discovered when implement changes on #1453

@deandreamatias deandreamatias added the bug Something isn't working label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant