@@ -4,6 +4,7 @@ import 'package:intl/intl.dart';
44
55import '../../../../../core/theme/app_colors.dart' ;
66import '../../../../../core/theme/app_tokens.dart' ;
7+ import '../../../../../shared/widgets/app_pill_switch.dart' ;
78import '../../../data/models/account_model.dart' ;
89import '../../provider/account_providers.dart' ;
910import '../../provider/expense_providers.dart' ;
@@ -33,82 +34,10 @@ class AccountsToolsTabView extends StatelessWidget {
3334}
3435
3536/// Two-option pill toggle used for the Accounts / Tools tab.
36- class AccountsPillSwitch extends StatelessWidget {
37- const AccountsPillSwitch ({
38- super .key,
39- required this .leftLabel,
40- required this .rightLabel,
41- required this .isRightSelected,
42- required this .onChanged,
43- });
44-
45- final String leftLabel;
46- final String rightLabel;
47- final bool isRightSelected;
48- final ValueChanged <bool > onChanged;
49-
50- @override
51- Widget build (BuildContext context) {
52- return Container (
53- padding: const EdgeInsets .all (4 ),
54- decoration: BoxDecoration (
55- color: AppColors .backgroundLight,
56- borderRadius: BorderRadius .circular (22 ),
57- ),
58- child: Row (
59- children: < Widget > [
60- _AccountsSwitchOption (
61- label: leftLabel,
62- isSelected: ! isRightSelected,
63- onTap: () => onChanged (false ),
64- ),
65- _AccountsSwitchOption (
66- label: rightLabel,
67- isSelected: isRightSelected,
68- onTap: () => onChanged (true ),
69- ),
70- ],
71- ),
72- );
73- }
74- }
75-
76- class _AccountsSwitchOption extends StatelessWidget {
77- const _AccountsSwitchOption ({
78- required this .label,
79- required this .isSelected,
80- required this .onTap,
81- });
82-
83- final String label;
84- final bool isSelected;
85- final VoidCallback onTap;
86-
87- @override
88- Widget build (BuildContext context) {
89- return Expanded (
90- child: GestureDetector (
91- onTap: onTap,
92- child: Container (
93- padding: const EdgeInsets .symmetric (vertical: 14 ),
94- decoration: BoxDecoration (
95- color: isSelected ? AppColors .primaryBlue : Colors .transparent,
96- borderRadius: BorderRadius .circular (18 ),
97- ),
98- child: Text (
99- label,
100- textAlign: TextAlign .center,
101- style: TextStyle (
102- color: isSelected ? Colors .white : AppColors .textMuted,
103- fontWeight: FontWeight .w800,
104- fontSize: 16 ,
105- ),
106- ),
107- ),
108- ),
109- );
110- }
111- }
37+ ///
38+ /// Thin wrapper around the shared [AppPillSwitch] that preserves the
39+ /// existing call-site API.
40+ typedef AccountsPillSwitch = AppPillSwitch ;
11241
11342/// A labelled summary chip shown in the net-worth hero card.
11443class AccountsSummaryChip extends StatelessWidget {
0 commit comments