/
app_builder.dart
107 lines (99 loc) · 2.89 KB
/
app_builder.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Flutter imports:
import 'package:flutter/material.dart';
class AppBuilder extends StatefulWidget {
const AppBuilder({Key? key, this.builder}) : super(key: key);
final Function(BuildContext)? builder;
@override
AppBuilderState createState() => new AppBuilderState();
static AppBuilderState? of(BuildContext context) {
return context.findAncestorStateOfType<AppBuilderState>();
}
}
class AppBuilderState extends State<AppBuilder> {
void rebuild() {
setState(() {});
}
void runCommand(BuildContext context) {
/*
final store = StoreProvider.of<AppState>(context);
final company = store.state.company;
const force = true;
dynamic action;
switch (_command) {
case 'gd':
action = ViewDashboard(context: context, force: force);
break;
case 'lc':
action = ViewClientList(force: force);
break;
case 'nc':
action =
EditClient(client: ClientEntity(), force: force);
break;
case 'lr':
action = ViewProductList(context: context, force: force);
break;
case 'nr':
action = EditProduct(
context: context, product: ProductEntity(), force: force);
break;
case 'li':
action = ViewInvoiceList(context: context, force: force);
break;
case 'ni':
action = EditInvoice(
context: context,
invoice: InvoiceEntity(company: company),
force: force);
break;
case 'lp':
action = ViewPaymentList(context: context, force: force);
break;
case 'np':
action = EditPayment(
context: context,
payment: PaymentEntity(company: company),
force: force);
break;
case 'lq':
action = ViewQuoteList(context: context, force: force);
break;
case 'nq':
action = EditQuote(
context: context,
quote: InvoiceEntity(company: company, isQuote: force));
break;
case 'lt':
action = ViewTaskList(context: context);
break;
case 'nt':
action = EditTask(context: context, task: TaskEntity(), force: force);
break;
case 'lv':
action = ViewVendorList(context: context);
break;
case 'nv':
action =
EditVendor(context: context, vendor: VendorEntity(), force: force);
break;
case 'le':
viewEntitiesByType(context: context, entityType: EntityType.expense);
break;
case 'ne':
action = EditExpense(
context: context,
expense: ExpenseEntity(company: company),
force: force);
break;
}
if (action != null) {
store.dispatch(action);
SystemChannels.textInput.invokeMethod<String>('TextInput.hide');
}
*/
}
@override
Widget build(BuildContext context) {
return widget.builder!(context);
}
}