Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved. 2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file. 3 : 4 : import 'package:app_finance/_configs/theme_helper.dart'; 5 : import 'package:app_finance/design/wrapper/dots_indicator_decoration.dart'; 6 : import 'package:flutter/material.dart'; 7 : 8 : class DotsTabBarWidget extends TabBar { 9 : final TabController tabController; 10 : final PageController pageController; 11 : final List<Widget> tabList; 12 : final double indent; 13 : final double width; 14 : final Color color; 15 : 16 0 : const DotsTabBarWidget({ 17 : super.key, 18 : required this.tabController, 19 : required this.pageController, 20 : required this.tabList, 21 : required this.indent, 22 : required this.width, 23 : required this.color, 24 : onTap, 25 0 : }) : super( 26 : controller: tabController, 27 : mouseCursor: SystemMouseCursors.click, 28 : onTap: onTap, 29 : tabs: tabList, 30 : dividerColor: Colors.transparent, 31 : ); 32 : 33 0 : @override 34 0 : get tabs => tabList.map((tab) => SizedBox(width: indent, height: indent)).toList(); 35 : 36 0 : @override 37 0 : get padding => EdgeInsets.only( 38 0 : left: (width - (tabList.length - 1) * 2 * indent) / 2, 39 0 : right: (width - (tabList.length - 1) * 2 * indent) / 2 + (ThemeHelper.isWearable ? 32 : 0), 40 : ); 41 : 42 0 : @override 43 0 : get indicator => DotsIndicatorDecoration( 44 0 : controller: pageController, 45 0 : itemCount: tabList.length, 46 0 : color: color, 47 0 : dotSize: indent, 48 : ); 49 : }