Giter Club home page Giter Club logo

Comments (4)

letsar avatar letsar commented on August 12, 2024 1

Hi.

What you are trying to do with the OrientationBuilder should work, and in fact, I've just tested it and it works, so I don't understand why it doesn't in your case 😕 .

But I don't think StaggeredGridView is the right solution to handle what you're trying to do: When the app is in landscape mode, the contact app only allows you to scroll the fields area. If you use StaggeredGridView to handle your layout, the avatar cell will scroll along with fields area.

I think I have a better solution for your case, if I understood correctly and what you want is something like this:
orientation_test

Do you mind to post a question about how to create the layout of the scenario you want on StackOverflow, and post me the link here? So that I can answer it there, and it will be useful for other people.

from flutter_staggered_grid_view.

efroim102 avatar efroim102 commented on August 12, 2024 1

That's exactly what I want!.

Here you go: https://stackoverflow.com/questions/51463355/how-do-i-create-a-dynamic-flutter-grid-layout-based-on-device-orientation-when-t

Thanks so much, I'm sure I'll get some hate on SO for being too generic, I might update the question at a later point if that's the case. Thanks again.

from flutter_staggered_grid_view.

letsar avatar letsar commented on August 12, 2024 1

Thanks, I posted my answer.

from flutter_staggered_grid_view.

efroim102 avatar efroim102 commented on August 12, 2024

Here's the code I'm using.

      body: OrientationBuilder(
        builder: (context, or) {
          int cac = (or == Orientation.portrait) ? 1 : 2;
          return StaggeredGridView.countBuilder(
            controller: _listViewScrollController,
            itemBuilder: (BuildContext context, int index){
              return _view[index];
            },
            itemCount: 2,
            crossAxisCount: cac,
            staggeredTileBuilder: (int index) {
              return StaggeredTile.fit(cac);
            },
            scrollDirection: Axis.vertical,
          );
        },
      )

Since the form doesn't really have a fixed height (I could figure one out though if need be) I'm using StaggeredTile.fit, Also, since in landscape mode the view height is fixed, with a fixed avatar and scroll-able form the height is technically fixed but it's the full viewport and not some number (or maybe it it?).

from flutter_staggered_grid_view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.