-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcurrent_page.enum.dart
66 lines (61 loc) · 1.57 KB
/
current_page.enum.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
import 'package:flutter/material.dart';
// ignore: camel_case_types
enum CURRENT_PAGE { counter, firefly, terminal, userlist, login }
extension CurrentPageExtension on CURRENT_PAGE {
Icon toIcon() {
switch (this) {
case CURRENT_PAGE.counter:
return const Icon(Icons.home);
case CURRENT_PAGE.firefly:
return const Icon(Icons.fireplace);
case CURRENT_PAGE.terminal:
return const Icon(Icons.terminal);
case CURRENT_PAGE.userlist:
return const Icon(Icons.people);
case CURRENT_PAGE.login:
return const Icon(Icons.login);
}
}
int toIndex() {
switch (this) {
case CURRENT_PAGE.counter:
return 0;
case CURRENT_PAGE.firefly:
return 1;
case CURRENT_PAGE.terminal:
return 2;
case CURRENT_PAGE.userlist:
return 3;
case CURRENT_PAGE.login:
return -1;
}
}
String toPath() {
switch (this) {
case CURRENT_PAGE.counter:
return '/';
case CURRENT_PAGE.firefly:
return '/firefly';
case CURRENT_PAGE.terminal:
return '/terminal';
case CURRENT_PAGE.userlist:
return '/userlist';
case CURRENT_PAGE.login:
return '/login';
}
}
String toTitle() {
switch (this) {
case CURRENT_PAGE.counter:
return 'Counter';
case CURRENT_PAGE.firefly:
return 'Crazy Firefly';
case CURRENT_PAGE.terminal:
return 'Terminal';
case CURRENT_PAGE.userlist:
return 'Users';
case CURRENT_PAGE.login:
return 'Login';
}
}
}