基础组件库
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

37 lignes
1.0 KiB

  1. import 'package:flutter/material.dart';
  2. class HomeGoodsDelegate extends SliverPersistentHeaderDelegate {
  3. @override
  4. Widget build(
  5. BuildContext context, double shrinkOffset, bool overlapsContent) {
  6. // print(shrinkOffset.toString());
  7. return Container(
  8. color: Colors.red,
  9. alignment: Alignment.center,
  10. child: TabBar(
  11. controller: TabController(initialIndex: 0, length: 6, vsync: ScrollableState()),
  12. isScrollable: true,
  13. tabs: <Widget>[
  14. Tab(icon: Icon(Icons.local_florist)),
  15. Tab(icon: Icon(Icons.change_history)),
  16. Tab(icon: Icon(Icons.directions_bike)),
  17. Tab(icon: Icon(Icons.local_florist)),
  18. Tab(icon: Icon(Icons.change_history)),
  19. Tab(icon: Icon(Icons.directions_bike)),
  20. ],
  21. ),
  22. );
  23. }
  24. @override
  25. double get maxExtent => 64.0;
  26. @override
  27. double get minExtent => 64.0;
  28. @override
  29. bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =>
  30. false; // 如果内容需要更新,设置为true
  31. }