Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Marian
@cortexdesign
;)
taylorren
@taylorren
but the output APK is not signed.
And thus can't be installed to my emulator.
I am running under Windows
Brian Blanchard
@briblanch
Is there a best practice on how to scroll to an item in a list or grid view? I see the ScrollController property on the list and grid view and how you could scroll to a provided offset. Just a little lost on how to map the offset given to the scroll controller to a child in the list.
Ian Hickson
@Hixie
if the child is visible at all, you can use ensureVisible
if it's not visible, and the items are fixed height, you can compute its height and animateTo that
if it's not visible, and the items are varying height, then it's hard to predict what it's offset will be
and we don't have a good solution for that yet
Brian Blanchard
@briblanch
Great thanks @Hixie
blehn
@blehn
Are there any more documented examples like this one, of creating nested functions that take certain inputs and build the widget:
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //...

    Column buildButtonColumn(IconData icon, String label) {
      Color color = Theme.of(context).primaryColor;

      return new Column(
        mainAxisSize: MainAxisSize.min,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          new Icon(icon, color: color),
          new Container(
            margin: const EdgeInsets.only(top: 8.0),
            child: new Text(
              label,
              style: new TextStyle(
                fontSize: 12.0,
                fontWeight: FontWeight.w400,
                color: color,

  //...
}
with images and other types of values , for example
Eric Seidel
@eseidelGoogle
That's a very common pattern :)
Well, the alternative is to wrap it in a MyColumn StatelessWidget
blehn
@blehn
yeah i thought so but was having trouble finding more examples in the docs
that would mean making a custom MyColumn widget?
(or "ButtonColumn")
@blehn intellij even has a quick-action (option-enter) for wrapping something in a widget iirc
blehn
@blehn
ok I'll take a look, thanks
speaking of intellij, sometimes tab completion inserts a snippet while simultaneously overwriting a bunch of text below... what's up with that?
Luke
@lukef
can you mask a flutter widget with a shape?
Devon Carew
@devoncarew
@blehn, In IntelliJ, completing with enter will insert, completing with tab will overwrite
so, two different insert modes...
Eric Seidel
@eseidelGoogle
@lukef i'm not sure what you mean. The layout system most widgets use is rectilinear
@lukef but with say a CustomPainter you can paint whatever you like :)
Luke
@lukef
lets say you have 2 views stacked on top of each other and i want to cut a hole in the top one so the bottom one is revealed
Reekdeb Mal
@reekdeb
media-20170426.jpg
Hello! Is there any way to disable auto suggestion for text fields?
Adam Barth
@abarth
@reekdeb please file a bug. that sounds like something we should do automatically when you flip the "obscure text" flag
@lukef You can use a ClipPath to do that
just make a path for the clip that includes everything that's not the hole
Kyle Bradshaw
@Skylled
I'm switching from premade JSON data to Firebase data, with http package. Is there anything special to know about using Futures in widget generation, other than using setState when making changes? I've verified my ListView's list is getting populated with ListTiles, but they're not actually getting displayed.
Adam Barth
@abarth
one tricky thing is that when your await finishes, you probably want to check mounted to see if your widget has been removed from the tree while you were waiting
there's a FutureBuilder widget that helps with that
Kyle Bradshaw
@Skylled
I'll look into FutureBuilder, thanks!
Eric Seidel
@eseidelGoogle
@reekdeb @abarth looks like flutter/flutter#6760 is on file, there may be one for iOS too
@Skylled @collinjackson was working on some helper classes for dealing with firebase, but I'm not sure the status of those
Kyle Bradshaw
@Skylled
@eseidelGoogle I saw those, and I'm very excited. I can't imagine they would be sync instead of async though, so my predicament wouldn't change much. I think flutter/flutter#9553 would have me covered though. I'll focus elsewhere in the meantime.
Eric Seidel
@eseidelGoogle
@Skylled generally the pattern with async widget updates is that you make your request, when it comes back you call setState to tell your widget to rebuild, and it should "just work". build() typically reads directly from your (possibly locally cached) model objects.
@Skylled flutter/flutter#9236 is also requesting more network/json documentation, but some of the linked examples might be helpful to you
Kyle Bradshaw
@Skylled
@eseidelGoogle I've been doing that, I believe. I've been printing when setState gets run, when build() gets run, and the .length of the list being passed to ListView, but only the test object I added before the async code gets displayed.
Eric Seidel
@eseidelGoogle
ah! Are you mutating the list and passing the same list?
Kyle Bradshaw
@Skylled
Exactly that.
Eric Seidel
@eseidelGoogle
Common gotcha. See flutter/flutter#8952
@Skylled https://github.com/flutter/flutter/issues/8952#issuecomment-288837913 is the explanation. List.== is a shallow check. Flutter checks if the arguments passed to the Widget are the same as the last Widget rendered there, and if so skips all further work.
Kyle Bradshaw
@Skylled
Makes sense! I'll work around that now! Even easier than the other options I was looking at.
Kyle Bradshaw
@Skylled
@eseidelGoogle Worked around it by creating a new List in build() and filling it with my other list's items. Solved everything!