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/_ext/string_ext.dart'; 5 : import 'package:app_finance/components/component_chart.dart'; 6 : import 'package:app_finance/components/component_recent.dart'; 7 : import 'package:app_finance/components/_core/component_data.dart'; 8 : import 'package:app_finance/components/_core/list_component_registry.dart'; 9 : import 'package:flutter/material.dart'; 10 : 11 : class ComponentsBuilderForm extends StatelessWidget { 12 : final ComponentData data; 13 : final Function adjust; 14 : 15 0 : const ComponentsBuilderForm(this.data, {super.key, required this.adjust}); 16 : 17 0 : @override 18 : Widget build(BuildContext context) { 19 0 : final key = (data[componentData.key] as String).toEnum(ComponentRegistry.values); 20 : return switch (key) { 21 0 : ComponentRegistry.recent => ComponentRecentForm(data, adjust: adjust), 22 0 : ComponentRegistry.chart => ComponentChartForm(data, adjust: adjust), 23 : }; 24 : } 25 : }