import 'dart:math';
import 'package:flutter/material.dart';
class UiTabBar extends StatefulWidget {
UiTabBar({
Key? key,
this.width,
this.height,
this.padding = const EdgeInsets.symmetric(horizontal: 8),
this.direction = Axis.horizontal,
this.physics = const BouncingScrollPhysics(),
this.style,
this.unselectedStyle,
required this.tabs,
required this.currentIndex,
}) : super(key: key);
final List<UiTab> tabs;
final Axis? direction;
final double? height;
final double? width;
final EdgeInsets? padding;
final TextStyle? style;
final TextStyle? unselectedStyle;
final ScrollPhysics physics;
final int currentIndex;
@override
_UiTabBarState createState() => _UiTabBarState();
}
class _UiTabBarState extends State<UiTabBar> with TickerProviderStateMixin {
ScrollController _scroll = ScrollController();
late AnimationController _animation;
late Point _size;
@override
void initState() {
supe
自定义Flutter Tabbar
最新推荐文章于 2024-08-13 10:51:12 发布
本文详细介绍了如何在Flutter中创建自定义TabBar,通过使用TabController和CustomPaint组件,实现TabBar的样式和交互效果的完全定制。内容涵盖了TabBar的基础用法,自定义Tab的绘制以及与页面切换的联动。通过对Widget的灵活组合和布局,读者可以掌握构建复杂UI组件的方法。
摘要由CSDN通过智能技术生成