riverscuomo / public-bug-hunt

A place to file bug reports for all of my apps
GNU General Public License v3.0
7 stars 0 forks source link

bundles and playlist obscured on small profile #58

Closed riverscuomo closed 1 year ago

riverscuomo commented 1 year ago

had to wrap in column in listview!!??

also, moving away from slivers, but that's besides the point.


Widget _buildSmallBody(ProfileState state) {
    logger.i('profile_buildSmallBody');
    // final profileBloc = BlocProvider.of<ProfileBloc>(context);
    final screenSize = MediaQuery.of(context).size;
    final crossAxisCount = getCrossAxisCount(screenSize.width);
    final playlistRowsHeight =
        getSmallSectionHeight(state.userPlaylists.length);
    final bundleRowsHeight = getSmallSectionHeight(state.bundles.length);
    final badgesRowsHeight = getSmallSectionHeight(state.badges.length);
    final beveledRectangleBorder = BeveledRectangleBorder(
      side: BorderSide(
        color: Core.appColor.primary,
        width: .3,
      ),
    );
    switch (state.status) {
      case ProfileStatus.loading:
        return circularProgressIndicator;
      default:
        return ListView(children: [
          Column(
            key: const Key('profile_buildSmallBody'),
            children: [
              // ADMIN CONTROLS BUTTON
              if (state.viewer.admin)
                Row(
riverscuomo commented 1 year ago

Glad you resolved the issue!

Wrapping a Column in a ListView widget changed the layout rules.

In the Flutter Widget tree, parent widgets dictate the rules for their children. By default, a Column widget will take all the available vertical space, and it positions its children based on the mainAxisAlignment and crossAxisAlignment properties. If these properties are not specified, the children end up being positioned at the start of the column (top for mainAxisAlignment and left for crossAxisAlignment).

But once you wrap the Column with a ListView, its constraints change. A ListView widget does not enforce its children to take up all the available space. Instead, it makes its children to occupy only what they need, allowing the rest of the widgets to move up, effectively reducing or removing the space. Furthermore, ListView itself is scrollable, adding a functionality that didn't exist in Column.

But be cautious with ListView, especially when nesting ListView inside another ListView, or inside any scrollable widget, as it may cause confusion with gesture detection leading to undesired scrolling behavior. Always test your UI thoroughly to make sure it's working as you expect.