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/_classes/herald/app_locale.dart';
5 : import 'package:app_finance/_configs/screen_helper.dart';
6 : import 'package:app_finance/_configs/theme_helper.dart';
7 : import 'package:app_finance/pages/_interfaces/abstract_page_state.dart';
8 : import 'package:app_finance/pages/_interfaces/interface_page_inject.dart';
9 : import 'package:app_finance/pages/automation/widgets/payments_tab.dart';
10 : import 'package:app_finance/pages/automation/widgets/sync_tab.dart';
11 : import 'package:app_finance/design/wrapper/tab_widget.dart';
12 : //import 'package:app_finance/pages/automation/widgets/notification_tab.dart';
13 : import 'package:material_ui/material_ui.dart';
14 :
15 : class AutomationPage extends StatefulWidget {
16 1 : const AutomationPage({super.key});
17 :
18 0 : @override
19 0 : AutomationPageState createState() => AutomationPageState();
20 : }
21 :
22 : class AutomationPageState extends AbstractPageState<AutomationPage> with TickerProviderStateMixin {
23 : PageInject? inject;
24 :
25 0 : @override
26 0 : String getTitle() => inject?.title ?? AppLocale.labels.automationHeadline;
27 :
28 0 : @override
29 0 : String getButtonName() => inject?.buttonName ?? '';
30 :
31 0 : @override
32 : Widget buildButton(BuildContext context, BoxConstraints constraints) =>
33 0 : inject?.buildButton(context, constraints) ?? ThemeHelper.emptyBox;
34 :
35 0 : void update(PageInject data) {
36 0 : if (data != inject) {
37 0 : WidgetsBinding.instance.addPostFrameCallback((_) => setState(() => inject = data));
38 : }
39 : }
40 :
41 0 : @override
42 : Widget buildContent(BuildContext context, BoxConstraints constraints) {
43 0 : final isLeft = ScreenHelper.state().isLeftBar;
44 0 : return Column(
45 0 : children: [
46 0 : Expanded(
47 0 : child: TabWidget(
48 : type: TabType.secondary,
49 : isLeft: isLeft,
50 0 : tabs: [
51 0 : Tab(icon: const Icon(Icons.free_cancellation_rounded), text: AppLocale.labels.paymentsHeadline),
52 0 : Tab(icon: const Icon(Icons.sync), text: AppLocale.labels.syncHeadline),
53 : // if (Platform.isAndroid)
54 : // Tab(icon: const Icon(Icons.message), text: AppLocale.labels.notifyHeadline),
55 : ],
56 0 : children: [
57 0 : PaymentsTab(callback: update, state: state),
58 0 : SyncTab(callback: update),
59 : //if (Platform.isAndroid) NotificationTab(),
60 : ],
61 : ),
62 : ),
63 : ],
64 : );
65 : }
66 : }
|