Флаттер Регулировка высоты виджета с возможностью перетаскивания и прокрутки листа

#flutter #user-interface #dart

Вопрос:

Я работаю с этим виджетом Dragablescrollesheet в Flutter. Я определяю минимальную высоту, когда перетаскивание выполняется полностью, и максимальную высоту, когда перетаскивание выполняется ВВЕРХ, и начальную высоту. Пока это работает нормально, но мне нужно показать высоту нижнего листа в зависимости от элементов, которые он имеет в представлении списка. Есть какие-нибудь идеи?

     return SafeArea(
      top: true,
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        body: Stack(
          children: [
            GoogleMap(
                mapType: widget.mapType,
                initialCameraPosition: CameraPosition(
                  target: widget.initialCameraPosition,
                  zoom: widget.zoom,
                ),
                markers: _locationModelsToMarkers(_locations),
                myLocationEnabled: true,
                zoomControlsEnabled: false,
                myLocationButtonEnabled: false,
                onMapCreated: (controller) =>
                    _onMapCreated(controller, context),
                onTap: (LatLng newPosition) =>
                    _handleTap(newPosition, context)),
            Align(
              alignment: Alignment.topRight,
              child: Padding(
                padding: const EdgeInsets.only(
                    top: Dimens.layers_button_top_padding,
                    right: Dimens.layers_button_right_padding),
                child: FloatingActionButton(
                  mini: true,
                  child: WidgetIcons.map,
                  foregroundColor: WidgetColors.layers_icon_color,
                  onPressed: () => _toggleMapStyle(widget.mapType),
                  backgroundColor: WidgetColors.layers_icon_bg,
                ),
              ),
            ),
            Align(
              alignment: Alignment.topCenter,
              child: Padding(
                padding: const EdgeInsets.all(Dimens.search_button_padding),
                child: MapSearchButtonWidget(
                  onPressed: () => _predictPlaces(context),
                ),
              ),
            ),
            if (_locations.isNotEmpty)
              Align(
                alignment: Alignment.bottomCenter,
                child: ClipRRect(
                  borderRadius: const BorderRadius.only(
                      topLeft: Radius.circular(25),
                      topRight: Radius.circular(25)),
                  child: DraggableScrollableSheet(
                    maxChildSize: 0.5,
                    initialChildSize: 0.25,
                    minChildSize: 0.20,
                    expand: false,
                    builder: (BuildContext context, scrollController) =>
                        LocationsPanelWidget(
                      scrollController: scrollController,
                      locations: _locations,
                      leadingListTileIcon: WidgetIcons.search_button,
                      trailingListTileIcon: WidgetIcons.delete_point,
                      itemOnTap: (locationModel) =>
                          _moveCamera(locationModel.lat, locationModel.lng),
                      trailingListTileOnPressed: (locations, index) =>
                          _removeLocation(locations, index, context),
                    ),
                  ),
                ),
              )
          ],
        ),
      ),
    );
  }```