Apologies for the confusion. If you're specifically looking for a widget that displays a tree structure with dropdowns for each group in Flutter, you can use the flutter_treeview package. This package provides a TreeView widget that allows you to create hierarchical tree structures with expandable and collapsible nodes.

To use the flutter_treeview package, follow these steps:

Add the package to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_treeview: ^0.5.1

Run flutter pub get to fetch the package. Import the necessary libraries:

import 'package:flutter/material.dart';
import 'package:flutter_treeview/flutter_treeview.dart';
Create your tree data structure. Each node in the tree should have a unique identifier, a label, and a list of child nodes (if any):

class TreeNode {
  final String id;
  final String label;
  final List<TreeNode> children;

  TreeNode(this.id, this.label, {this.children = const []});
}
Build the tree using the TreeView widget:

class GroupedDropdownTreeWidget extends StatelessWidget {
  final List<TreeNode> groups;

  GroupedDropdownTreeWidget(this.groups);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Grouped Dropdown Tree'),
      ),
      body: TreeView(
        nodes: _buildNodes(groups),
        allowParentSelect: true,
        onExpansionChanged: (node, expanded) {
          // Handle expansion changes if needed
        },
        onNodeTap: (node) {
          // Handle node tap if needed
        },
      ),
    );
  }

  List<TreeViewNode> _buildNodes(List<TreeNode> nodes) {
    return nodes.map((node) {
      return TreeViewNode(
        key: Key(node.id),
        label: node.label,
        children: _buildNodes(node.children),
      );
    }).toList();
  }
}
Use the GroupedDropdownTreeWidget and pass your tree data to it:

dart
Copy code
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final groups = [
      TreeNode('1', 'Group 1', [
        TreeNode('1.1', 'Item 1'),
        TreeNode('1.2', 'Item 2'),
        TreeNode('1.3', 'Item 3'),
      ]),
      TreeNode('2', 'Group 2', [
        TreeNode('2.1', 'Item 4'),
        TreeNode('2.2', 'Item 5'),
        TreeNode('2.3', 'Item 6'),
      ]),
    ];

    return MaterialApp(
      title: 'Flutter TreeView',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: GroupedDropdownTreeWidget(groups),
    );
  }
}
The TreeView widget provided by flutter_treeview will render a tree structure with expandable/collapsible nodes for each group, and you can handle expansion changes or node taps by providing appropriate callbacks.

Remember to update your pubspec.yaml file and run flutter pub get after adding the flutter_treeview package.
/* -----codeの行番号----- */