flutter-sliver

Make SliverAppBar have an image as a background instead of a color

放肆的年华 提交于 2020-07-21 04:27:33
问题 I have a SliverAppBar with a background image. When collapsed it has a blue color as a background: But instead of the blue color I want it to show the background image when collapsed: How can I achieve this? I've already tried to give the app bar a transparent background color, but it did not work. Code: void main() => runApp(MyApp()); class MyApp extends StatelessWidget { var scrollController = ScrollController(); @override Widget build(BuildContext context) { return MaterialApp( title:

How to get the SliverPersistentHeader to “overgrow”

与世无争的帅哥 提交于 2020-05-24 15:55:11
问题 I'm using a SliverPersistentHeader in my CustomScrollView to have a persistent header that shrinks and grows when the user scrolls, but when it reaches its maximum size it feels a bit stiff since it doesn't "overgrow". Here is a video of the behaviour I want (from the Spotify app) and the behaviour I have: . 回答1: While looking for a solution for this problem, I came across three different ways to solve it: Create a Stack that contains the CustomScrollView and a header widget (overlaid on top

How to get the SliverPersistentHeader to “overgrow”

余生长醉 提交于 2020-05-24 15:54:07
问题 I'm using a SliverPersistentHeader in my CustomScrollView to have a persistent header that shrinks and grows when the user scrolls, but when it reaches its maximum size it feels a bit stiff since it doesn't "overgrow". Here is a video of the behaviour I want (from the Spotify app) and the behaviour I have: . 回答1: While looking for a solution for this problem, I came across three different ways to solve it: Create a Stack that contains the CustomScrollView and a header widget (overlaid on top

Flutter:Scrolling To Bottom Automatically when the screen opens

我的未来我决定 提交于 2020-05-10 06:37:30
问题 I'm using onpressed() to scroll down to bottom of the List view, but i want to achieve that without Pressing the botton, It must autoscroll for every screen opening. I tried to put it inside initState() its not working but if i press the button it wokrks How to make it autoScroll? Working code: floatingActionButton: new FloatingActionButton(child: Icon(Icons.arrow_downward),onPressed:_hola,) _hola(){ print("inti state started successfully"); controller1.animateTo( controller1.position

Flutter Exception: ScrollController attached to multiple scroll views

旧时模样 提交于 2020-02-20 06:17:10
问题 My Flutter application is throwing an exception (ScrollController attached to multiple scroll views) when navigating away from a page that has a ScrollController to control a NestedScrollView and I am not sure what I am doing wrong. I have recreated the exception with a simple example below. I can navigate from FirstPage to SecondPage (and optionally back) just fine, but when I navigate from SecondPage to ThirdPage the exception is thrown. The SecondPage is the page that contains my custom

Flutter Exception: ScrollController attached to multiple scroll views

女生的网名这么多〃 提交于 2020-02-20 06:16:20
问题 My Flutter application is throwing an exception (ScrollController attached to multiple scroll views) when navigating away from a page that has a ScrollController to control a NestedScrollView and I am not sure what I am doing wrong. I have recreated the exception with a simple example below. I can navigate from FirstPage to SecondPage (and optionally back) just fine, but when I navigate from SecondPage to ThirdPage the exception is thrown. The SecondPage is the page that contains my custom

Allow GridView to overlap SliverAppBar

一笑奈何 提交于 2020-01-23 01:08:11
问题 I am trying to reproduce the following example from the earlier Material design specifications (open for animated demo): Until now I was able to produce the scrolling effect, but the overlap of the content is still missing. I couldn't find out how to do this properly. import 'package:flutter/material.dart'; class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( slivers: <Widget>[ SliverAppBar( title: Text('Title'),

Scaling content on drag down in Flutter

我们两清 提交于 2020-01-22 03:31:06
问题 I want ot achieve this behavior in Flutter. Do you know if there is a built-in widget in Flutter that provides that fuctionality out of the box? 回答1: try this CustomScrollView : LayoutBuilder( builder: (context, constraints) { return CustomScrollView( slivers: <Widget>[ SliverPersistentHeader( pinned: true, delegate: Delegate(), ), SliverToBoxAdapter( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(30)), border: Border.all( width: 2.0, color: Colors

How to implement a SliverAppBar with a collapsable search bar

六眼飞鱼酱① 提交于 2020-01-04 14:02:31
问题 This is what I'm trying to do, it's a pretty common Widget on iOS. This is my code: return Scaffold( backgroundColor: Colors.white, body: CustomScrollView( slivers: <Widget>[ SliverAppBar( automaticallyImplyLeading: false, pinned: true, titleSpacing: 0, backgroundColor: Colors.white, elevation: 1.0, title: Container( width: double.infinity, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisSize: MainAxisSize.max, children:

Flutter SliverAppBar with Tabs overlays content

我是研究僧i 提交于 2020-01-04 09:19:42
问题 I have followed this tutorial (https://medium.com/@diegoveloper/flutter-collapsing-toolbar-sliver-app-bar-14b858e87abe) to create a CollapsingToolbar with a TabBar. The problem is that when I scroll the content of the body overlays the tabBar. Here is the code: @override Widget build(BuildContext context) { return Scaffold( body: DefaultTabController( length: 2, child: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { return <Widget>[ SliverAppBar(