Skip to content

Instantly share code, notes, and snippets.

@nonameden
Last active May 31, 2018 19:03
Show Gist options
  • Save nonameden/7938b3b5cea781d9dd8c57e0f80d47d2 to your computer and use it in GitHub Desktop.
Save nonameden/7938b3b5cea781d9dd8c57e0f80d47d2 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class TestPage2 extends StatefulWidget {
@override
_TestPageState2 createState() => new _TestPageState2();
}
class _TestPageState2 extends State<TestPage2> {
@override
Widget build(BuildContext context) {
return new DefaultTabController(
length: 2,
child: new Scaffold(
body: new NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
new SliverAppBar(
backgroundColor: Colors.black26,
title: new Text('Here title'),
pinned: true,
floating: true,
bottom: new TabBar(
tabs: [
new Tab(text: 'Tab1'),
new Tab(text: 'Tab2'),
]
),
),
];
},
body: new Stack(
children: <Widget>[
new Positioned(
top: 0.0,
left: 0.0,
right: 0.0,
child: new Material(
elevation: 4.0,
color: Colors.white,
child: new Container(
height: 48.0,
child: new Center(
child: const Text('Here my fixed header')),
),
),
),
new Positioned(
top: 48.0,
left: 0.0,
right: 0.0,
bottom: 0.0,
child: new RefreshIndicator(
onRefresh: () {},
child: new ListView.builder(
itemBuilder: _buildItem,
itemCount: 30,
)
),
),
],
),
),
),
);
}
Widget _buildItem(BuildContext context, int index) {
return new ListTile(
title: new Text('Title $index'),
subtitle: new Text('Subtitle $index'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment