flutter-sliver

Can Flutter efficiently layout nested lists?

谁说胖子不能爱 提交于 2019-12-21 22:29:13
问题 Can a layout like this be achieved and rendered efficiently in Flutter? Example: Yellow and blue blocks can both be around 30 elements, so I guess something like ListView.builder should be used. I have tried nesting 2 ListView.builder, the inner with shrinkWrap = true. The yellow block is being built just when is needed, but the blue list, although it has an itemBuilder, it builds all children elements at once, causing performance problems. new ListView.builder( itemCount: 20, itemBuilder:

Flutter sliver container

孤街醉人 提交于 2019-12-21 12:29:14
问题 I'm new to flutter and I'm not able to achieve the layout I want. I have one sliverAppBar with 3 tabs. The content of one of the tabs has to be a ScrollView compound by one container with fixed size(with an image as background) and a ListView. I've tried to do this with a CustomScrollView but I don't know how to create the container as it is not a sliver. Can you point me in the right direction? Regards, Diego. 回答1: You can simply use - SliverToBoxAdapter( child: Container(..) 来源: https:/

Horizontally scrollable cards with Snap effect in flutter

不问归期 提交于 2019-12-17 17:41:03
问题 I want to create a list of cards scrolling horizontally with snap to fit effect when swiped either from left or right. Each card has some spacing between them and fit to screen similar to below image Apart from that these horizontally scrollable list elements should be contained inside a vertically scrollable list. I all I am able to achieve is only displaying a list of horizontal scrolling cards after following example in flutter docs. class SnapCarousel extends StatelessWidget { @override

flutter ListView KeepAlive after some scroll

☆樱花仙子☆ 提交于 2019-12-13 16:08:20
问题 I want to keepAlive my widgets which are already rendered in ListView . I was tried with addAutomaticKeepAlives:true properties which provide by ListView class. Here is my sample code which I was used. Same issue in SliverChildBuilderDelegate delegate which provide by SliverList . ListView.builder( itemBuilder: (context,index){ return Card( child: Container( child: Image.asset("images/${index+1}.jpg",fit: BoxFit.cover,), height: 250.0, ), ); }, addAutomaticKeepAlives: true, itemCount:40 , );

Flutter How to vertically center the AppBar sliver tilte?

拟墨画扇 提交于 2019-12-13 02:39:40
问题 I'm trying to center the title of Sliver AppBar and add a second text below this. I can not do it. Below is the image that is now and how it should be. Can anyone help me? This is my code. import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Slive AppBar', theme: new ThemeData( primarySwatch: Colors.blue, ), debugShowCheckedModeBanner: false, home: new

Adding a “Future” api call to json data as infinate scroll Flutter_gallery example project

谁说我不能喝 提交于 2019-12-12 14:29:18
问题 Attempting to learn the new flutter framework, looks incredibly promising! Gone through all the online demos and I am now attempting to add external data that can infinitely scroll via a new Future data call every 10 items to the flutter_gallery example project in the "pesto" section. ( https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/lib/demo/pesto_demo.dart ) I have been successful in making a "future" call to external data and populating the pesto section of the

ListView inside Column causes 'Vertical viewport was given unbounded height'

风格不统一 提交于 2019-12-12 08:55:49
问题 I am new to flutter and having trouble with layouts. I want something like this: A sticky header and a scroll view below it. I thought of using Column widget with two children - first being the header and second being the ListView. Here is my code Widget build(BuildContext context) { return Material( elevation: 8.0, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.all(16.0), child: Text( title, style: Theme.of(context)

How to create a bounded scrollable TabBarView

谁说胖子不能爱 提交于 2019-12-12 08:48:17
问题 I need to implement the following layout in Flutter. When the user scrolls, I want the entire layout to scroll (hiding the header and tab bar). However, I can't nest a TabBarView inside a ListView since the TabBarView doesn't have a bounded height and ListViews don't provide a bounded height to their children. I've already seen these questions, but all of them have unsatisfactory answers for this use case: How can I have a TabView with variable height content within a Scrollable View with

how to scroll outer scrollview when inner scrollview reaches to the end in flutter?

大憨熊 提交于 2019-12-11 14:52:36
问题 I have a SingleChildScrollView as a child widget inside its parent SingleChildScrollView widget as in the image below, Currently when I scroll down the touching area in the inner scrollview, the inner scrollview scrolls down and nothing moves when it reaches the bottom. But I want the whole screen(outer scrollview) starts scrolling when the inner scrollview reaches the bottom as below. (It doesn't matter if I have to tap again in order to scroll the outer scrollview) How could I achieve the

Remove Index wise CustomWidget from List<Widget> in Flutter

寵の児 提交于 2019-12-11 01:15:27
问题 I have initially empty list of Widget in Column. Now on Other widget click I am adding new Custom Widget in _contactItems Column( children: _contactItems, ) List<Widget> _contactItems = new List<CustomWidget>(); _contactItems.add(newCustomWidget(value)); Now Suppose I have 6 Records (6 Custom Widgets in Column). I am trying to remove index wise records (Example. I am removing 3rd record then 1st record. Column Widgets (dynamic widgets) should be updated as _contactItems updating in setState()