flutter-form-builder-ecosystem / flutter-form-builder-ecosystem/flutter_form_builder

FormBuilder and Tabbed/Paged forms

Open
#1,426 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Dart
Stars
1.6k
Forks
561
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Package/Plugin version

9.4.1

### Platforms

- [X] Android
- [X] iOS
- [X] Linux
- [X] MacOS
- [X] Web
- [X] Windows

### Flutter doctor

Flutter doctor

```bash
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.5 23F79 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.86.1) - but I use vim
```

### Minimal code example
```dart
FormBuilder(
key: _formKey,
initialValue: widget.initialValues,
autovalidateMode: AutovalidateMode.disabled,
child: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
bottom: const TabBar(
tabs: myTabs,
),
),
body: TabBarView(
children: myTabs.map((Tab tab) {
return _buildFieldsForTab(tab);
}).toList(),
),
),
);
```

### Current Behavior

The issue is well described here: https://github.com/flutter-form-builder-ecosystem/flutter_form_builder/issues/462

As form grows, it's natural to split fields into few tabs/pages. As soon as it's happens (using default Flutter widgets), fields in the "hidden" tabs/pages aren't initialized. When form is submitted, these fields are absent, which is incorrect behavior.

### Expected Behavior

There is a solution to use tabbed forms with FormBuilder.

It's more likely could be another way to initialize fields with initial values.

### Steps To Reproduce

Run code as described

### Aditional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.