可让您将"sticky headers"放入Flutter应用程序的任何可滚动内容中

网友投稿 1059 2022-10-30 23:14:00

可让您将"sticky headers"放入Flutter应用程序的任何可滚动内容中

Flutter Sticky Headers

Lets you place headers on scrollable content that will stick to the top of the container whilst the content is scrolled.

Usage

You can place a StickyHeader or StickyHeaderBuilder inside any scrollable content, such as: ListView, GridView, CustomScrollView, SingleChildScrollView or similar.

Depend on it:

dependencies: sticky_headers: "^0.1.8"

Import it:

import 'package:sticky_headers/sticky_headers.dart';

Use it:

class Example extends StatelessWidget { @override Widget build(BuildContext context) { return ListView.builder(itemBuilder: (context, index) { return StickyHeader( header: Container( height: 50.0, color: Colors.blueGrey[700], padding: EdgeInsets.symmetric(horizontal: 16.0), alignment: Alignment.centerLeft, child: Text('Header #$index', style: const TextStyle(color: Colors.white), ), ), content: Container( child: Image.network(imageForIndex(index), fit: BoxFit.cover, width: double.infinity, height: 200.0), ), ); }); }}

Examples

Example 1 - Headers and Content

Example 2 - Animated Headers with Content

Example 3 - Headers overlapping the Content

Bugs/Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github and I'll look into it. Pull request are also welcome.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:springboot整合quartz实例demo
下一篇:[LeetCode] Word Search
相关文章