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:material_ui/material_ui.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 1 : 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 : super.onTap,
25 1 : }) : super(
26 : controller: tabController,
27 : mouseCursor: SystemMouseCursors.click,
28 : tabs: tabList,
29 : dividerColor: Colors.transparent,
30 : );
31 :
32 1 : @override
33 7 : get tabs => tabList.map((tab) => SizedBox(width: indent, height: indent)).toList();
34 :
35 1 : @override
36 1 : get padding => EdgeInsets.only(
37 9 : left: (width - (tabList.length - 1) * 2 * indent) / 2,
38 11 : right: (width - (tabList.length - 1) * 2 * indent) / 2 + (ThemeHelper.isWearable ? 32 : 0),
39 : );
40 :
41 1 : @override
42 1 : get indicator => DotsIndicatorDecoration(
43 1 : controller: pageController,
44 2 : itemCount: tabList.length,
45 1 : color: color,
46 1 : dotSize: indent,
47 : );
48 : }
|