|
- import 'package:flutter/material.dart';
-
- class HomeGoodsDelegate extends SliverPersistentHeaderDelegate {
- final TabController controller;
-
- HomeGoodsDelegate(this.controller);
-
- @override
- Widget build(
- BuildContext context, double shrinkOffset, bool overlapsContent) {
- // print(shrinkOffset.toString());
- return Container(
- color: Colors.red,
- alignment: Alignment.center,
- child: TabBar(
- controller: controller,
- isScrollable: true,
- tabs: <Widget>[
- Tab(icon: Icon(Icons.local_florist)),
- Tab(icon: Icon(Icons.change_history)),
- Tab(icon: Icon(Icons.directions_bike)),
- Tab(icon: Icon(Icons.local_florist)),
- Tab(icon: Icon(Icons.change_history)),
- Tab(icon: Icon(Icons.directions_bike)),
- ],
- ),
- );
- }
-
- @override
- double get maxExtent => 60.0;
-
- @override
- double get minExtent => 60.0;
-
- @override
- bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =>
- false; // 如果内容需要更新,设置为true
- }
|