|
1 | | -import 'package:stream_feeds/stream_feeds.dart'; |
2 | | -import 'demo_app_config.dart'; |
3 | | - |
4 | | -class UserCredentials { |
5 | | - const UserCredentials({required this.user, required this.token}); |
6 | | - |
7 | | - final User user; |
8 | | - final String token; |
9 | | - |
10 | | - // Individual user credentials |
11 | | - static final luke = UserCredentials( |
12 | | - user: const User( |
13 | | - id: 'luke_skywalker', |
14 | | - name: 'Luke Skywalker', |
15 | | - image: |
16 | | - 'https://vignette.wikia.nocookie.net/starwars/images/2/20/LukeTLJ.jpg', |
17 | | - ), |
18 | | - token: DemoAppConfig.current.tokenForUser('luke_skywalker'), |
19 | | - ); |
20 | | - |
21 | | - static final martin = UserCredentials( |
22 | | - user: const User( |
23 | | - id: 'martin', |
24 | | - name: 'Martin', |
25 | | - image: |
26 | | - 'https://getstream.io/static/2796a305dd07651fcceb4721a94f4505/802d2/martin-mitrevski.webp', |
27 | | - ), |
28 | | - token: DemoAppConfig.current.tokenForUser('martin'), |
29 | | - ); |
30 | | - |
31 | | - static final tommaso = UserCredentials( |
32 | | - user: const User( |
33 | | - id: 'tommaso', |
34 | | - name: 'Tommaso', |
35 | | - image: |
36 | | - 'https://getstream.io/static/712bb5c0bd5ed8d3fa6e5842f6cfbeed/c59de/tommaso.webp', |
37 | | - ), |
38 | | - token: DemoAppConfig.current.tokenForUser('tommaso'), |
39 | | - ); |
40 | | - |
41 | | - static final thierry = UserCredentials( |
42 | | - user: const User( |
43 | | - id: 'thierry', |
44 | | - name: 'Thierry', |
45 | | - image: |
46 | | - 'https://getstream.io/static/237f45f28690696ad8fff92726f45106/c59de/thierry.webp', |
47 | | - ), |
48 | | - token: DemoAppConfig.current.tokenForUser('thierry'), |
49 | | - ); |
50 | | - |
51 | | - static final marcelo = UserCredentials( |
52 | | - user: const User( |
53 | | - id: 'marcelo', |
54 | | - name: 'Marcelo', |
55 | | - image: |
56 | | - 'https://getstream.io/static/aaf5fb17dcfd0a3dd885f62bd21b325a/802d2/marcelo-pires.webp', |
57 | | - ), |
58 | | - token: DemoAppConfig.current.tokenForUser('marcelo'), |
59 | | - ); |
60 | | - |
61 | | - static final kanat = UserCredentials( |
62 | | - user: const User(id: 'kanat', name: 'Kanat'), |
63 | | - token: DemoAppConfig.current.tokenForUser('kanat'), |
64 | | - ); |
65 | | - |
66 | | - static final toomas = UserCredentials( |
67 | | - user: const User(id: 'toomas', name: 'Toomas'), |
68 | | - token: DemoAppConfig.current.tokenForUser('toomas'), |
69 | | - ); |
70 | | - |
71 | | - // Built-in list sorted by name |
72 | | - static List<UserCredentials> get builtIn => [ |
73 | | - luke, |
74 | | - martin, |
75 | | - tommaso, |
76 | | - thierry, |
77 | | - marcelo, |
78 | | - kanat, |
79 | | - toomas, |
80 | | - ]..sort( |
81 | | - (a, b) => |
82 | | - a.user.name.toLowerCase().compareTo(b.user.name.toLowerCase()), |
83 | | - ); |
84 | | - |
85 | | - // Helper method to get feed ID |
86 | | - String get fid => 'user:${user.id}'; |
87 | | - |
88 | | - // Helper method to get credentials by ID |
89 | | - static UserCredentials credentialsFor(String id) { |
90 | | - final found = |
91 | | - builtIn.where((credentials) => credentials.user.id == id).firstOrNull; |
92 | | - return found ?? tommaso; |
93 | | - } |
94 | | -} |
| 1 | +// import 'package:stream_feeds/stream_feeds.dart'; |
| 2 | +// import 'demo_app_config.dart'; |
| 3 | +// |
| 4 | +// class UserCredentials { |
| 5 | +// const UserCredentials({required this.user, required this.token}); |
| 6 | +// |
| 7 | +// final User user; |
| 8 | +// final String token; |
| 9 | +// |
| 10 | +// // Individual user credentials |
| 11 | +// static final luke = UserCredentials( |
| 12 | +// user: const User( |
| 13 | +// id: 'luke_skywalker', |
| 14 | +// name: 'Luke Skywalker', |
| 15 | +// image: |
| 16 | +// 'https://vignette.wikia.nocookie.net/starwars/images/2/20/LukeTLJ.jpg', |
| 17 | +// ), |
| 18 | +// token: DemoAppConfig.current.tokenForUser('luke_skywalker'), |
| 19 | +// ); |
| 20 | +// |
| 21 | +// static final martin = UserCredentials( |
| 22 | +// user: const User( |
| 23 | +// id: 'martin', |
| 24 | +// name: 'Martin', |
| 25 | +// image: |
| 26 | +// 'https://getstream.io/static/2796a305dd07651fcceb4721a94f4505/802d2/martin-mitrevski.webp', |
| 27 | +// ), |
| 28 | +// token: DemoAppConfig.current.tokenForUser('martin'), |
| 29 | +// ); |
| 30 | +// |
| 31 | +// static final tommaso = UserCredentials( |
| 32 | +// user: const User( |
| 33 | +// id: 'tommaso', |
| 34 | +// name: 'Tommaso', |
| 35 | +// image: |
| 36 | +// 'https://getstream.io/static/712bb5c0bd5ed8d3fa6e5842f6cfbeed/c59de/tommaso.webp', |
| 37 | +// ), |
| 38 | +// token: DemoAppConfig.current.tokenForUser('tommaso'), |
| 39 | +// ); |
| 40 | +// |
| 41 | +// static final thierry = UserCredentials( |
| 42 | +// user: const User( |
| 43 | +// id: 'thierry', |
| 44 | +// name: 'Thierry', |
| 45 | +// image: |
| 46 | +// 'https://getstream.io/static/237f45f28690696ad8fff92726f45106/c59de/thierry.webp', |
| 47 | +// ), |
| 48 | +// token: DemoAppConfig.current.tokenForUser('thierry'), |
| 49 | +// ); |
| 50 | +// |
| 51 | +// static final marcelo = UserCredentials( |
| 52 | +// user: const User( |
| 53 | +// id: 'marcelo', |
| 54 | +// name: 'Marcelo', |
| 55 | +// image: |
| 56 | +// 'https://getstream.io/static/aaf5fb17dcfd0a3dd885f62bd21b325a/802d2/marcelo-pires.webp', |
| 57 | +// ), |
| 58 | +// token: DemoAppConfig.current.tokenForUser('marcelo'), |
| 59 | +// ); |
| 60 | +// |
| 61 | +// static final kanat = UserCredentials( |
| 62 | +// user: const User(id: 'kanat', name: 'Kanat'), |
| 63 | +// token: DemoAppConfig.current.tokenForUser('kanat'), |
| 64 | +// ); |
| 65 | +// |
| 66 | +// static final toomas = UserCredentials( |
| 67 | +// user: const User(id: 'toomas', name: 'Toomas'), |
| 68 | +// token: DemoAppConfig.current.tokenForUser('toomas'), |
| 69 | +// ); |
| 70 | +// |
| 71 | +// // Built-in list sorted by name |
| 72 | +// static List<UserCredentials> get builtIn => [ |
| 73 | +// luke, |
| 74 | +// martin, |
| 75 | +// tommaso, |
| 76 | +// thierry, |
| 77 | +// marcelo, |
| 78 | +// kanat, |
| 79 | +// toomas, |
| 80 | +// ]..sort( |
| 81 | +// (a, b) => |
| 82 | +// a.user.name.toLowerCase().compareTo(b.user.name.toLowerCase()), |
| 83 | +// ); |
| 84 | +// |
| 85 | +// // Helper method to get feed ID |
| 86 | +// String get fid => 'user:${user.id}'; |
| 87 | +// |
| 88 | +// // Helper method to get credentials by ID |
| 89 | +// static UserCredentials credentialsFor(String id) { |
| 90 | +// final found = |
| 91 | +// builtIn.where((credentials) => credentials.user.id == id).firstOrNull; |
| 92 | +// return found ?? tommaso; |
| 93 | +// } |
| 94 | +// } |
0 commit comments