Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version of this doesn't work with Streambuilder , but Listview and Gridview work #23

Closed
AlexMoon90 opened this issue Dec 31, 2018 · 6 comments
Assignees

Comments

@AlexMoon90
Copy link

I have been using staggered_grid_view well for months.
Yesterday I found the problem that staggered_grid_view doesn't render as the stream changes in Streambuilder. but listview and griedview work well with same way.
Please, check this issue. I really need staggered_grid_view. thanks.

@AlexMoon90
Copy link
Author

if you build this coding, you would find Listview change counter but Staggered_grid_View don't work.

import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart';
import 'dart:async';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatelessWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
var bloc = Block();

@OverRide
Widget build(BuildContext context) {

return Scaffold(
  appBar: AppBar(
    title: Text(title),
  ),
  body: Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text( 'You have pushed the button this many times:',  ),
        Center(
          child: Container(
            child: StreamBuilder(
              stream : bloc.observe,
              initialData: 0,
              builder: (context, snapshot) {
                return

                 Column(
                   children: <Widget>[
                     Container(
                       height: 30.0,
                       child: ListView.builder(
                           itemCount: 1,
                           itemBuilder: (context, index){
                             return
                             Text("Listview : ${snapshot.data.toString()}");
                           }),
                     ),
                  Container(
                    height: 30.0,

                    child: StaggeredGridView.countBuilder(
                      itemCount: 1,
                      primary: true,
                      crossAxisCount: 1,
                      mainAxisSpacing: 4.0,
                      crossAxisSpacing: 4.0,
                      padding: EdgeInsets.only(left : 8.0, right : 8.0),
                      itemBuilder: (context, index) =>
                      Text("staggerdGridView : ${snapshot.data.toString()}"),
                      staggeredTileBuilder: (index) =>  StaggeredTile.fit(1),
                      ),
                      )

                   ],
                 );

              } ),
          ),
        ),
  ])),
  floatingActionButton: FloatingActionButton(
    onPressed: () => bloc.increment() ,
    tooltip: 'Increment',
    child: Icon(Icons.add),
  ), // This trailing comma makes auto-formatting nicer for build methods.
);

}
}

class Block {

var controlloer = StreamController();
get counter_n => controlloer.stream;
get observe => Observable(controlloer.stream);
int counter =0;

increment () {
controlloer.add(++counter);
}

}

@JordanADavies
Copy link

JordanADavies commented Jan 2, 2019

I'm also having this issue, currently having to use an older version of this package.

@letsar
Copy link
Owner

letsar commented Jan 5, 2019

Hi, can you tell me in which version of this package this work, and in which it doesn't?

@letsar letsar self-assigned this Jan 5, 2019
letsar added a commit that referenced this issue Jan 5, 2019
@letsar
Copy link
Owner

letsar commented Jan 5, 2019

I've found where it comes from. It's available on master (not yet on pub). Let me know if everything is OK for you. Then I will create a new version and publish it.

@JordanADavies
Copy link

Yeah, that fixes it. Thanks a lot!

@letsar
Copy link
Owner

letsar commented Jan 8, 2019

Published in version 0.2.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants