Skip to content

[FormBuilderSearchableDropdown]: Default dropdownSearchTextStyle default TeextStyle schould be Theme.of(context).textTheme.titleMedium #99

@abibiano

Description

@abibiano

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

10.1.0

Platforms

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

Flutter doctor

Flutter doctor
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-ES)
    • Flutter version 3.16.5 on channel stable at /Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (3 weeks ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/abibiano/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.2

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

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

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

[✓] Connected device (3 available)
    • iPhone @abibiano (mobile) • 00008110-00094516219B801E • ios            • iOS 17.2.1 21C66
    • macOS (desktop)           • macos                     • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (web)              • chrome                    • web-javascript • Google Chrome 119.0.6045.123

[✓] 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:form_builder_extra_fields/form_builder_extra_fields.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: const Text('Test App'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Row(
            children: [
              Expanded(
                child: FormBuilderTextField(
                  name: 'testField1',
                  initialValue: 'Test field 1',
                  enabled: true,
                  decoration: const InputDecoration(
                    labelText: 'Test 1',
                  ),
                  textInputAction: TextInputAction.next,
                ),
              ),
              const SizedBox(width: 16),
              Expanded(
                child: FormBuilderSearchableDropdown<String>(
                  name: 'testField2',
                  initialValue: 'Item2',
                  enabled: true,
                  decoration: const InputDecoration(
                    labelText: 'Test 2',
                  ),
                  items: const [
                    'Item1',
                    'Item2',
                    'Item3',
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Current Behavior

The size/style of the FormBuilderSearchableDropdown value is not the same as the size used on the normal FormBuilderTextField.

Applying the Theme.of(context).textTheme.titleMedium to the dropdownSearchTextStyle property solves the problem, but I think this has to be the default style for FormBuilderSearchableDropdown as it's for TextField in Flutter.

Expected Behavior

dropdownSearchTextStyle property FormBuilderSearchableDropdown has to be the same by default a TextField style.

Steps To Reproduce

  1. Run the sample code

Aditional information

CleanShot 2024-01-12 at 14 51 52@2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions