Initial commit
This commit is contained in:
12
lib/core/constants/app_locale_keys.dart
Normal file
12
lib/core/constants/app_locale_keys.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
abstract class AppLocaleKeys {
|
||||
///Storage keys
|
||||
static const String language = 'language';
|
||||
|
||||
static const String fontBold = "fontBold";
|
||||
static const String fontMedium = "fontMedium";
|
||||
static const String fontRegular = "fontRegular";
|
||||
static const String fontLight = "fontLight";
|
||||
|
||||
static const String imageUrl =
|
||||
"https://xsznseejebbai1lj.public.blob.vercel-storage.com/homepage/hero/hero-1.webp";
|
||||
}
|
||||
4
lib/core/constants/constants.dart
Normal file
4
lib/core/constants/constants.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
export 'app_locale_keys.dart';
|
||||
export 'sizes_consts.dart';
|
||||
export 'l10n.dart';
|
||||
export 'time_delay_cons.dart';
|
||||
9
lib/core/constants/l10n.dart
Normal file
9
lib/core/constants/l10n.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'dart:ui';
|
||||
|
||||
abstract class L10n {
|
||||
static List<Locale> locales = const [
|
||||
Locale('en'),
|
||||
Locale('uz'),
|
||||
Locale('ru'),
|
||||
];
|
||||
}
|
||||
803
lib/core/constants/sizes_consts.dart
Normal file
803
lib/core/constants/sizes_consts.dart
Normal file
@@ -0,0 +1,803 @@
|
||||
abstract class SizesCons {
|
||||
|
||||
static const double size_0 = 0.0;
|
||||
|
||||
static const double size_1 = 1.0;
|
||||
|
||||
static const double size_2 = 2.0;
|
||||
|
||||
static const double size_3 = 3.0;
|
||||
|
||||
static const double size_4 = 4.0;
|
||||
|
||||
static const double size_5 = 5.0;
|
||||
|
||||
static const double size_6 = 6.0;
|
||||
|
||||
static const double size_7 = 7.0;
|
||||
|
||||
static const double size_8 = 8.0;
|
||||
|
||||
static const double size_9 = 9.0;
|
||||
|
||||
static const double size_10 = 10.0;
|
||||
|
||||
static const double size_11 = 11.0;
|
||||
|
||||
static const double size_12 = 12.0;
|
||||
|
||||
static const double size_13 = 13.0;
|
||||
|
||||
static const double size_14 = 14.0;
|
||||
|
||||
static const double size_15 = 15.0;
|
||||
|
||||
static const double size_16 = 16.0;
|
||||
|
||||
static const double size_17 = 17.0;
|
||||
|
||||
static const double size_18 = 18.0;
|
||||
|
||||
static const double size_19 = 19.0;
|
||||
|
||||
static const double size_20 = 20.0;
|
||||
|
||||
static const double size_21 = 21.0;
|
||||
|
||||
static const double size_22 = 22.0;
|
||||
|
||||
static const double size_23 = 23.0;
|
||||
|
||||
static const double size_24 = 24.0;
|
||||
|
||||
static const double size_25 = 25.0;
|
||||
|
||||
static const double size_26 = 26.0;
|
||||
|
||||
static const double size_27 = 27.0;
|
||||
|
||||
static const double size_28 = 28.0;
|
||||
|
||||
static const double size_29 = 29.0;
|
||||
|
||||
static const double size_30 = 30.0;
|
||||
|
||||
static const double size_31 = 31.0;
|
||||
|
||||
static const double size_32 = 32.0;
|
||||
|
||||
static const double size_33 = 33.0;
|
||||
|
||||
static const double size_34 = 34.0;
|
||||
|
||||
static const double size_35 = 35.0;
|
||||
|
||||
static const double size_36 = 36.0;
|
||||
|
||||
static const double size_37 = 37.0;
|
||||
|
||||
static const double size_38 = 38.0;
|
||||
|
||||
static const double size_39 = 39.0;
|
||||
|
||||
static const double size_40 = 40.0;
|
||||
|
||||
static const double size_41 = 41.0;
|
||||
|
||||
static const double size_42 = 42.0;
|
||||
|
||||
static const double size_43 = 43.0;
|
||||
|
||||
static const double size_44 = 44.0;
|
||||
|
||||
static const double size_45 = 45.0;
|
||||
|
||||
static const double size_46 = 46.0;
|
||||
|
||||
static const double size_47 = 47.0;
|
||||
|
||||
static const double size_48 = 48.0;
|
||||
|
||||
static const double size_49 = 49.0;
|
||||
|
||||
static const double size_50 = 50.0;
|
||||
|
||||
static const double size_51 = 51.0;
|
||||
|
||||
static const double size_52 = 52.0;
|
||||
|
||||
static const double size_53 = 53.0;
|
||||
|
||||
static const double size_54 = 54.0;
|
||||
|
||||
static const double size_55 = 55.0;
|
||||
|
||||
static const double size_56 = 56.0;
|
||||
|
||||
static const double size_57 = 57.0;
|
||||
|
||||
static const double size_58 = 58.0;
|
||||
|
||||
static const double size_59 = 59.0;
|
||||
|
||||
static const double size_60 = 60.0;
|
||||
|
||||
static const double size_61 = 61.0;
|
||||
|
||||
static const double size_62 = 62.0;
|
||||
|
||||
static const double size_63 = 63.0;
|
||||
|
||||
static const double size_64 = 64.0;
|
||||
|
||||
static const double size_65 = 65.0;
|
||||
|
||||
static const double size_66 = 66.0;
|
||||
|
||||
static const double size_67 = 67.0;
|
||||
|
||||
static const double size_68 = 68.0;
|
||||
|
||||
static const double size_69 = 69.0;
|
||||
|
||||
static const double size_70 = 70.0;
|
||||
|
||||
static const double size_71 = 71.0;
|
||||
|
||||
static const double size_72 = 72.0;
|
||||
|
||||
static const double size_73 = 73.0;
|
||||
|
||||
static const double size_74 = 74.0;
|
||||
|
||||
static const double size_75 = 75.0;
|
||||
|
||||
static const double size_76 = 76.0;
|
||||
|
||||
static const double size_77 = 77.0;
|
||||
|
||||
static const double size_78 = 78.0;
|
||||
|
||||
static const double size_79 = 79.0;
|
||||
|
||||
static const double size_80 = 80.0;
|
||||
|
||||
static const double size_81 = 81.0;
|
||||
|
||||
static const double size_82 = 82.0;
|
||||
|
||||
static const double size_83 = 83.0;
|
||||
|
||||
static const double size_84 = 84.0;
|
||||
|
||||
static const double size_85 = 85.0;
|
||||
|
||||
static const double size_86 = 86.0;
|
||||
|
||||
static const double size_87 = 87.0;
|
||||
|
||||
static const double size_88 = 88.0;
|
||||
|
||||
static const double size_89 = 89.0;
|
||||
|
||||
static const double size_90 = 90.0;
|
||||
|
||||
static const double size_91 = 91.0;
|
||||
|
||||
static const double size_92 = 92.0;
|
||||
|
||||
static const double size_93 = 93.0;
|
||||
|
||||
static const double size_94 = 94.0;
|
||||
|
||||
static const double size_95 = 95.0;
|
||||
|
||||
static const double size_96 = 96.0;
|
||||
|
||||
static const double size_97 = 97.0;
|
||||
|
||||
static const double size_98 = 98.0;
|
||||
|
||||
static const double size_99 = 99.0;
|
||||
|
||||
static const double size_100 = 100.0;
|
||||
|
||||
static const double size_101 = 101.0;
|
||||
|
||||
static const double size_102 = 102.0;
|
||||
|
||||
static const double size_103 = 103.0;
|
||||
|
||||
static const double size_104 = 104.0;
|
||||
|
||||
static const double size_105 = 105.0;
|
||||
|
||||
static const double size_106 = 106.0;
|
||||
|
||||
static const double size_107 = 107.0;
|
||||
|
||||
static const double size_108 = 108.0;
|
||||
|
||||
static const double size_109 = 109.0;
|
||||
|
||||
static const double size_110 = 110.0;
|
||||
|
||||
static const double size_111 = 111.0;
|
||||
|
||||
static const double size_112 = 112.0;
|
||||
|
||||
static const double size_113 = 113.0;
|
||||
|
||||
static const double size_114 = 114.0;
|
||||
|
||||
static const double size_115 = 115.0;
|
||||
|
||||
static const double size_116 = 116.0;
|
||||
|
||||
static const double size_117 = 117.0;
|
||||
|
||||
static const double size_118 = 118.0;
|
||||
|
||||
static const double size_119 = 119.0;
|
||||
|
||||
static const double size_120 = 120.0;
|
||||
|
||||
static const double size_121 = 121.0;
|
||||
|
||||
static const double size_122 = 122.0;
|
||||
|
||||
static const double size_123 = 123.0;
|
||||
|
||||
static const double size_124 = 124.0;
|
||||
|
||||
static const double size_125 = 125.0;
|
||||
|
||||
static const double size_126 = 126.0;
|
||||
|
||||
static const double size_127 = 127.0;
|
||||
|
||||
static const double size_128 = 128.0;
|
||||
|
||||
static const double size_129 = 129.0;
|
||||
|
||||
static const double size_130 = 130.0;
|
||||
|
||||
static const double size_131 = 131.0;
|
||||
|
||||
static const double size_132 = 132.0;
|
||||
|
||||
static const double size_133 = 133.0;
|
||||
|
||||
static const double size_134 = 134.0;
|
||||
|
||||
static const double size_135 = 135.0;
|
||||
|
||||
static const double size_136 = 136.0;
|
||||
|
||||
static const double size_137 = 137.0;
|
||||
|
||||
static const double size_138 = 138.0;
|
||||
|
||||
static const double size_139 = 139.0;
|
||||
|
||||
static const double size_140 = 140.0;
|
||||
|
||||
static const double size_141 = 141.0;
|
||||
|
||||
static const double size_142 = 142.0;
|
||||
|
||||
static const double size_143 = 143.0;
|
||||
|
||||
static const double size_144 = 144.0;
|
||||
|
||||
static const double size_145 = 145.0;
|
||||
|
||||
static const double size_146 = 146.0;
|
||||
|
||||
static const double size_147 = 147.0;
|
||||
|
||||
static const double size_148 = 148.0;
|
||||
|
||||
static const double size_149 = 149.0;
|
||||
|
||||
static const double size_150 = 150.0;
|
||||
|
||||
static const double size_151 = 151.0;
|
||||
|
||||
static const double size_152 = 152.0;
|
||||
|
||||
static const double size_153 = 153.0;
|
||||
|
||||
static const double size_154 = 154.0;
|
||||
|
||||
static const double size_155 = 155.0;
|
||||
|
||||
static const double size_156 = 156.0;
|
||||
|
||||
static const double size_157 = 157.0;
|
||||
|
||||
static const double size_158 = 158.0;
|
||||
|
||||
static const double size_159 = 159.0;
|
||||
|
||||
static const double size_160 = 160.0;
|
||||
|
||||
static const double size_161 = 161.0;
|
||||
|
||||
static const double size_162 = 162.0;
|
||||
|
||||
static const double size_163 = 163.0;
|
||||
|
||||
static const double size_164 = 164.0;
|
||||
|
||||
static const double size_165 = 165.0;
|
||||
|
||||
static const double size_166 = 166.0;
|
||||
|
||||
static const double size_167 = 167.0;
|
||||
|
||||
static const double size_168 = 168.0;
|
||||
|
||||
static const double size_169 = 169.0;
|
||||
|
||||
static const double size_170 = 170.0;
|
||||
|
||||
static const double size_171 = 171.0;
|
||||
|
||||
static const double size_172 = 172.0;
|
||||
|
||||
static const double size_173 = 173.0;
|
||||
|
||||
static const double size_174 = 174.0;
|
||||
|
||||
static const double size_175 = 175.0;
|
||||
|
||||
static const double size_176 = 176.0;
|
||||
|
||||
static const double size_177 = 177.0;
|
||||
|
||||
static const double size_178 = 178.0;
|
||||
|
||||
static const double size_179 = 179.0;
|
||||
|
||||
static const double size_180 = 180.0;
|
||||
|
||||
static const double size_181 = 181.0;
|
||||
|
||||
static const double size_182 = 182.0;
|
||||
|
||||
static const double size_183 = 183.0;
|
||||
|
||||
static const double size_184 = 184.0;
|
||||
|
||||
static const double size_185 = 185.0;
|
||||
|
||||
static const double size_186 = 186.0;
|
||||
|
||||
static const double size_187 = 187.0;
|
||||
|
||||
static const double size_188 = 188.0;
|
||||
|
||||
static const double size_189 = 189.0;
|
||||
|
||||
static const double size_190 = 190.0;
|
||||
|
||||
static const double size_191 = 191.0;
|
||||
|
||||
static const double size_192 = 192.0;
|
||||
|
||||
static const double size_193 = 193.0;
|
||||
|
||||
static const double size_194 = 194.0;
|
||||
|
||||
static const double size_195 = 195.0;
|
||||
|
||||
static const double size_196 = 196.0;
|
||||
|
||||
static const double size_197 = 197.0;
|
||||
|
||||
static const double size_198 = 198.0;
|
||||
|
||||
static const double size_199 = 199.0;
|
||||
|
||||
static const double size_200 = 200.0;
|
||||
|
||||
static const double size_201 = 201.0;
|
||||
|
||||
static const double size_202 = 202.0;
|
||||
|
||||
static const double size_203 = 203.0;
|
||||
|
||||
static const double size_204 = 204.0;
|
||||
|
||||
static const double size_205 = 205.0;
|
||||
|
||||
static const double size_206 = 206.0;
|
||||
|
||||
static const double size_207 = 207.0;
|
||||
|
||||
static const double size_208 = 208.0;
|
||||
|
||||
static const double size_209 = 209.0;
|
||||
|
||||
static const double size_210 = 210.0;
|
||||
|
||||
static const double size_211 = 211.0;
|
||||
|
||||
static const double size_212 = 212.0;
|
||||
|
||||
static const double size_213 = 213.0;
|
||||
|
||||
static const double size_214 = 214.0;
|
||||
|
||||
static const double size_215 = 215.0;
|
||||
|
||||
static const double size_216 = 216.0;
|
||||
|
||||
static const double size_217 = 217.0;
|
||||
|
||||
static const double size_218 = 218.0;
|
||||
|
||||
static const double size_219 = 219.0;
|
||||
|
||||
static const double size_220 = 220.0;
|
||||
|
||||
static const double size_221 = 221.0;
|
||||
|
||||
static const double size_222 = 222.0;
|
||||
|
||||
static const double size_223 = 223.0;
|
||||
|
||||
static const double size_224 = 224.0;
|
||||
|
||||
static const double size_225 = 225.0;
|
||||
|
||||
static const double size_226 = 226.0;
|
||||
|
||||
static const double size_227 = 227.0;
|
||||
|
||||
static const double size_228 = 228.0;
|
||||
|
||||
static const double size_229 = 229.0;
|
||||
|
||||
static const double size_230 = 230.0;
|
||||
|
||||
static const double size_231 = 231.0;
|
||||
|
||||
static const double size_232 = 232.0;
|
||||
|
||||
static const double size_233 = 233.0;
|
||||
|
||||
static const double size_234 = 234.0;
|
||||
|
||||
static const double size_235 = 235.0;
|
||||
|
||||
static const double size_236 = 236.0;
|
||||
|
||||
static const double size_237 = 237.0;
|
||||
|
||||
static const double size_238 = 238.0;
|
||||
|
||||
static const double size_239 = 239.0;
|
||||
|
||||
static const double size_240 = 240.0;
|
||||
|
||||
static const double size_241 = 241.0;
|
||||
|
||||
static const double size_242 = 242.0;
|
||||
|
||||
static const double size_243 = 243.0;
|
||||
|
||||
static const double size_244 = 244.0;
|
||||
|
||||
static const double size_245 = 245.0;
|
||||
|
||||
static const double size_246 = 246.0;
|
||||
|
||||
static const double size_247 = 247.0;
|
||||
|
||||
static const double size_248 = 248.0;
|
||||
|
||||
static const double size_249 = 249.0;
|
||||
|
||||
static const double size_250 = 250.0;
|
||||
|
||||
static const double size_251 = 251.0;
|
||||
|
||||
static const double size_252 = 252.0;
|
||||
|
||||
static const double size_253 = 253.0;
|
||||
|
||||
static const double size_254 = 254.0;
|
||||
|
||||
static const double size_255 = 255.0;
|
||||
|
||||
static const double size_256 = 256.0;
|
||||
|
||||
static const double size_257 = 257.0;
|
||||
|
||||
static const double size_258 = 258.0;
|
||||
|
||||
static const double size_259 = 259.0;
|
||||
|
||||
static const double size_260 = 260.0;
|
||||
|
||||
static const double size_261 = 261.0;
|
||||
|
||||
static const double size_262 = 262.0;
|
||||
|
||||
static const double size_263 = 263.0;
|
||||
|
||||
static const double size_264 = 264.0;
|
||||
|
||||
static const double size_265 = 265.0;
|
||||
|
||||
static const double size_266 = 266.0;
|
||||
|
||||
static const double size_267 = 267.0;
|
||||
|
||||
static const double size_268 = 268.0;
|
||||
|
||||
static const double size_269 = 269.0;
|
||||
|
||||
static const double size_270 = 270.0;
|
||||
|
||||
static const double size_271 = 271.0;
|
||||
|
||||
static const double size_272 = 272.0;
|
||||
|
||||
static const double size_273 = 273.0;
|
||||
|
||||
static const double size_274 = 274.0;
|
||||
|
||||
static const double size_275 = 275.0;
|
||||
|
||||
static const double size_276 = 276.0;
|
||||
|
||||
static const double size_277 = 277.0;
|
||||
|
||||
static const double size_278 = 278.0;
|
||||
|
||||
static const double size_279 = 279.0;
|
||||
|
||||
static const double size_280 = 280.0;
|
||||
|
||||
static const double size_281 = 281.0;
|
||||
|
||||
static const double size_282 = 282.0;
|
||||
|
||||
static const double size_283 = 283.0;
|
||||
|
||||
static const double size_284 = 284.0;
|
||||
|
||||
static const double size_285 = 285.0;
|
||||
|
||||
static const double size_286 = 286.0;
|
||||
|
||||
static const double size_287 = 287.0;
|
||||
|
||||
static const double size_288 = 288.0;
|
||||
|
||||
static const double size_289 = 289.0;
|
||||
|
||||
static const double size_290 = 290.0;
|
||||
|
||||
static const double size_291 = 291.0;
|
||||
|
||||
static const double size_292 = 292.0;
|
||||
|
||||
static const double size_293 = 293.0;
|
||||
|
||||
static const double size_294 = 294.0;
|
||||
|
||||
static const double size_295 = 295.0;
|
||||
|
||||
static const double size_296 = 296.0;
|
||||
|
||||
static const double size_297 = 297.0;
|
||||
|
||||
static const double size_298 = 298.0;
|
||||
|
||||
static const double size_299 = 299.0;
|
||||
|
||||
static const double size_300 = 300.0;
|
||||
|
||||
static const double size_301 = 301.0;
|
||||
|
||||
static const double size_302 = 302.0;
|
||||
|
||||
static const double size_303 = 303.0;
|
||||
|
||||
static const double size_304 = 304.0;
|
||||
|
||||
static const double size_305 = 305.0;
|
||||
|
||||
static const double size_306 = 306.0;
|
||||
|
||||
static const double size_307 = 307.0;
|
||||
|
||||
static const double size_308 = 308.0;
|
||||
|
||||
static const double size_309 = 309.0;
|
||||
|
||||
static const double size_310 = 310.0;
|
||||
|
||||
static const double size_311 = 311.0;
|
||||
|
||||
static const double size_312 = 312.0;
|
||||
|
||||
static const double size_313 = 313.0;
|
||||
|
||||
static const double size_314 = 314.0;
|
||||
|
||||
static const double size_315 = 315.0;
|
||||
|
||||
static const double size_316 = 316.0;
|
||||
|
||||
static const double size_317 = 317.0;
|
||||
|
||||
static const double size_318 = 318.0;
|
||||
|
||||
static const double size_319 = 319.0;
|
||||
|
||||
static const double size_320 = 320.0;
|
||||
|
||||
static const double size_321 = 321.0;
|
||||
|
||||
static const double size_322 = 322.0;
|
||||
|
||||
static const double size_323 = 323.0;
|
||||
|
||||
static const double size_324 = 324.0;
|
||||
|
||||
static const double size_325 = 325.0;
|
||||
|
||||
static const double size_326 = 326.0;
|
||||
|
||||
static const double size_327 = 327.0;
|
||||
|
||||
static const double size_328 = 328.0;
|
||||
|
||||
static const double size_329 = 329.0;
|
||||
|
||||
static const double size_330 = 330.0;
|
||||
|
||||
static const double size_331 = 331.0;
|
||||
|
||||
static const double size_332 = 332.0;
|
||||
|
||||
static const double size_333 = 333.0;
|
||||
|
||||
static const double size_334 = 334.0;
|
||||
|
||||
static const double size_335 = 335.0;
|
||||
|
||||
static const double size_336 = 336.0;
|
||||
|
||||
static const double size_337 = 337.0;
|
||||
|
||||
static const double size_338 = 338.0;
|
||||
|
||||
static const double size_339 = 339.0;
|
||||
|
||||
static const double size_340 = 340.0;
|
||||
|
||||
static const double size_341 = 341.0;
|
||||
|
||||
static const double size_342 = 342.0;
|
||||
|
||||
static const double size_343 = 343.0;
|
||||
|
||||
static const double size_344 = 344.0;
|
||||
|
||||
static const double size_345 = 345.0;
|
||||
|
||||
static const double size_346 = 346.0;
|
||||
|
||||
static const double size_347 = 347.0;
|
||||
|
||||
static const double size_348 = 348.0;
|
||||
|
||||
static const double size_349 = 349.0;
|
||||
|
||||
static const double size_350 = 350.0;
|
||||
|
||||
static const double size_351 = 351.0;
|
||||
|
||||
static const double size_352 = 352.0;
|
||||
|
||||
static const double size_353 = 353.0;
|
||||
|
||||
static const double size_354 = 354.0;
|
||||
|
||||
static const double size_355 = 355.0;
|
||||
|
||||
static const double size_356 = 356.0;
|
||||
|
||||
static const double size_357 = 357.0;
|
||||
|
||||
static const double size_358 = 358.0;
|
||||
|
||||
static const double size_359 = 359.0;
|
||||
|
||||
static const double size_360 = 360.0;
|
||||
|
||||
static const double size_361 = 361.0;
|
||||
|
||||
static const double size_362 = 362.0;
|
||||
|
||||
static const double size_363 = 363.0;
|
||||
|
||||
static const double size_364 = 364.0;
|
||||
|
||||
static const double size_365 = 365.0;
|
||||
|
||||
static const double size_366 = 366.0;
|
||||
|
||||
static const double size_367 = 367.0;
|
||||
|
||||
static const double size_368 = 368.0;
|
||||
|
||||
static const double size_369 = 369.0;
|
||||
|
||||
static const double size_370 = 370.0;
|
||||
|
||||
static const double size_371 = 371.0;
|
||||
|
||||
static const double size_372 = 372.0;
|
||||
|
||||
static const double size_373 = 373.0;
|
||||
|
||||
static const double size_374 = 374.0;
|
||||
|
||||
static const double size_375 = 375.0;
|
||||
|
||||
static const double size_376 = 376.0;
|
||||
|
||||
static const double size_377 = 377.0;
|
||||
|
||||
static const double size_378 = 378.0;
|
||||
|
||||
static const double size_379 = 379.0;
|
||||
|
||||
static const double size_380 = 380.0;
|
||||
|
||||
static const double size_381 = 381.0;
|
||||
|
||||
static const double size_382 = 382.0;
|
||||
|
||||
static const double size_383 = 383.0;
|
||||
|
||||
static const double size_384 = 384.0;
|
||||
|
||||
static const double size_385 = 385.0;
|
||||
|
||||
static const double size_386 = 386.0;
|
||||
|
||||
static const double size_387 = 387.0;
|
||||
|
||||
static const double size_388 = 388.0;
|
||||
|
||||
static const double size_389 = 389.0;
|
||||
|
||||
static const double size_390 = 390.0;
|
||||
|
||||
static const double size_391 = 391.0;
|
||||
|
||||
static const double size_392 = 392.0;
|
||||
|
||||
static const double size_393 = 393.0;
|
||||
|
||||
static const double size_394 = 394.0;
|
||||
|
||||
static const double size_395 = 395.0;
|
||||
|
||||
static const double size_396 = 396.0;
|
||||
|
||||
static const double size_397 = 397.0;
|
||||
|
||||
static const double size_398 = 398.0;
|
||||
|
||||
static const double size_399 = 399.0;
|
||||
/**/
|
||||
}
|
||||
6
lib/core/constants/time_delay_cons.dart
Normal file
6
lib/core/constants/time_delay_cons.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
abstract class TimeDelayConst {
|
||||
static const Duration durationMill300 = Duration(milliseconds: 300);
|
||||
static const Duration durationMill800 = Duration(milliseconds: 800);
|
||||
|
||||
static const Duration duration3 = Duration(seconds: 3);
|
||||
}
|
||||
14
lib/core/core.dart
Normal file
14
lib/core/core.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
export 'router/routes_name.dart';
|
||||
export 'router/app_routes.dart';
|
||||
export 'di/injection_container.dart';
|
||||
export 'di/injection_container.config.dart';
|
||||
export 'constants/constants.dart';
|
||||
export 'theme/theme.dart';
|
||||
export 'helpers/helpers.dart';
|
||||
export 'extensions/extensions.dart';
|
||||
export 'l10n/app_localizations.dart';
|
||||
export 'l10n/app_localizations_en.dart';
|
||||
export 'l10n/app_localizations_ru.dart';
|
||||
export 'l10n/app_localizations_uz.dart';
|
||||
export 'services/services.dart';
|
||||
export 'utils/app_utils.dart';
|
||||
44
lib/core/di/injection_container.config.dart
Normal file
44
lib/core/di/injection_container.config.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// dart format width=80
|
||||
|
||||
// **************************************************************************
|
||||
// InjectableConfigGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:get_it/get_it.dart' as _i174;
|
||||
import 'package:injectable/injectable.dart' as _i526;
|
||||
|
||||
import '../../feature/common/presentation/blocs/language_bloc/language_bloc.dart'
|
||||
as _i942;
|
||||
import '../../feature/home/presentation/blocs/home_bloc/home_bloc.dart'
|
||||
as _i1007;
|
||||
import '../../feature/main/presentation/blocs/main_bloc/main_bloc.dart'
|
||||
as _i580;
|
||||
import '../../feature/on_boarding/presentation/blocs/splash_bloc/splash_bloc.dart'
|
||||
as _i311;
|
||||
import '../../food_delivery_client.dart' as _i321;
|
||||
import '../router/app_routes.dart' as _i152;
|
||||
import '../services/storage_service.dart' as _i306;
|
||||
|
||||
extension GetItInjectableX on _i174.GetIt {
|
||||
// initializes the registration of main-scope dependencies inside of GetIt
|
||||
_i174.GetIt init({
|
||||
String? environment,
|
||||
_i526.EnvironmentFilter? environmentFilter,
|
||||
}) {
|
||||
final gh = _i526.GetItHelper(this, environment, environmentFilter);
|
||||
gh.factory<_i580.MainBloc>(() => _i580.MainBloc());
|
||||
gh.factory<_i311.SplashBloc>(() => _i311.SplashBloc());
|
||||
gh.factory<_i1007.HomeBloc>(() => _i1007.HomeBloc());
|
||||
gh.singleton<_i306.StorageService>(() => _i306.StorageService());
|
||||
gh.singleton<_i152.AppRoutes>(() => _i152.AppRoutes());
|
||||
gh.factory<_i942.LanguageBloc>(
|
||||
() => _i942.LanguageBloc(gh<_i321.StorageService>()),
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
13
lib/core/di/injection_container.dart
Normal file
13
lib/core/di/injection_container.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
@InjectableInit(
|
||||
initializerName: 'init', // default
|
||||
preferRelativeImports: true, // default
|
||||
asExtension: true, // default
|
||||
)
|
||||
Future<void> configureDependencies() async {
|
||||
sl.init();
|
||||
await sl<StorageService>().initialize();
|
||||
}
|
||||
12
lib/core/extensions/build_context_extensions.dart
Normal file
12
lib/core/extensions/build_context_extensions.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/core/l10n/app_localizations.dart';
|
||||
|
||||
extension BuildContextExtensions on BuildContext {
|
||||
MediaQueryData get mq => MediaQuery.of(this);
|
||||
|
||||
double get w => mq.size.width;
|
||||
|
||||
double get h => mq.size.height;
|
||||
|
||||
AppLocalizations get loc => AppLocalizations.of(this)!;
|
||||
}
|
||||
12
lib/core/extensions/color_extensions.dart
Normal file
12
lib/core/extensions/color_extensions.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
extension ColorOpacityExtension on Color {
|
||||
Color newWithOpacity(double amount) {
|
||||
assert(
|
||||
amount >= 0.0 && amount <= 1.0,
|
||||
"Opacity must be between 0.0 and 1.0",
|
||||
);
|
||||
final int alpha = (amount * 255).round();
|
||||
return withAlpha(alpha);
|
||||
}
|
||||
}
|
||||
4
lib/core/extensions/extensions.dart
Normal file
4
lib/core/extensions/extensions.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
export 'build_context_extensions.dart';
|
||||
export 'padding_extensions.dart';
|
||||
export 'color_extensions.dart';
|
||||
export 'size_extensions.dart';
|
||||
43
lib/core/extensions/padding_extensions.dart
Normal file
43
lib/core/extensions/padding_extensions.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
extension WidgetPaddingExtension on Widget {
|
||||
Widget paddingAll(double padding) => Padding(
|
||||
padding: EdgeInsets.all(padding),
|
||||
child: this,
|
||||
);
|
||||
|
||||
Widget paddingSymmetric({
|
||||
double horizontal = 0.0,
|
||||
double vertical = 0.0,
|
||||
}) =>
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: horizontal,
|
||||
vertical: vertical,
|
||||
),
|
||||
child: this,
|
||||
);
|
||||
|
||||
Widget paddingOnly({
|
||||
double left = 0.0,
|
||||
double top = 0.0,
|
||||
double right = 0.0,
|
||||
double bottom = 0.0,
|
||||
}) =>
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: top,
|
||||
left: left,
|
||||
right: right,
|
||||
bottom: bottom,
|
||||
),
|
||||
child: this,
|
||||
);
|
||||
|
||||
Widget get paddingZero => Padding(
|
||||
padding: EdgeInsets.zero,
|
||||
child: this,
|
||||
);
|
||||
}
|
||||
7
lib/core/extensions/size_extensions.dart
Normal file
7
lib/core/extensions/size_extensions.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
extension SizedBoxExtensions on num {
|
||||
SizedBox get verticalSpace => SizedBox(height: toDouble());
|
||||
|
||||
SizedBox get horizontalSpace => SizedBox(width: toDouble());
|
||||
}
|
||||
28
lib/core/helpers/bloc_observer.dart
Normal file
28
lib/core/helpers/bloc_observer.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
class AppBlocObserver extends BlocObserver {
|
||||
@override
|
||||
void onEvent(Bloc bloc, Object? event) {
|
||||
super.onEvent(bloc, event);
|
||||
log('🟢 Event: ${bloc.runtimeType}, $event');
|
||||
}
|
||||
|
||||
@override
|
||||
void onChange(BlocBase bloc, Change change) {
|
||||
super.onChange(bloc, change);
|
||||
log('🟡 Change: ${bloc.runtimeType}, $change');
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
|
||||
log('🔴 Error in ${bloc.runtimeType}: $error');
|
||||
log(stackTrace.toString());
|
||||
super.onError(bloc, error, stackTrace);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTransition(Bloc bloc, Transition transition) {
|
||||
super.onTransition(bloc, transition);
|
||||
log('🔵 Transition: ${bloc.runtimeType}, $transition');
|
||||
}
|
||||
}
|
||||
20
lib/core/helpers/enum_helpers.dart
Normal file
20
lib/core/helpers/enum_helpers.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
enum RequestStatus {
|
||||
initial,
|
||||
loading,
|
||||
loaded,
|
||||
error,
|
||||
warning,
|
||||
loadingMore;
|
||||
|
||||
bool isInitial() => this == RequestStatus.initial;
|
||||
|
||||
bool isLoading() => this == RequestStatus.loading;
|
||||
|
||||
bool isLoaded() => this == RequestStatus.loaded;
|
||||
|
||||
bool isError() => this == RequestStatus.error;
|
||||
|
||||
bool isWarning() => this == RequestStatus.warning;
|
||||
|
||||
bool isLoadingMore() => this == RequestStatus.loadingMore;
|
||||
}
|
||||
2
lib/core/helpers/helpers.dart
Normal file
2
lib/core/helpers/helpers.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'enum_helpers.dart';
|
||||
export 'bloc_observer.dart';
|
||||
366
lib/core/l10n/app_localizations.dart
Normal file
366
lib/core/l10n/app_localizations.dart
Normal file
@@ -0,0 +1,366 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations_en.dart';
|
||||
import 'app_localizations_ru.dart';
|
||||
import 'app_localizations_uz.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// Callers can lookup localized strings with an instance of AppLocalizations
|
||||
/// returned by `AppLocalizations.of(context)`.
|
||||
///
|
||||
/// Applications need to include `AppLocalizations.delegate()` in their app's
|
||||
/// `localizationDelegates` list, and the locales they support in the app's
|
||||
/// `supportedLocales` list. For example:
|
||||
///
|
||||
/// ```dart
|
||||
/// import 'l10n/app_localizations.dart';
|
||||
///
|
||||
/// return MaterialApp(
|
||||
/// localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
/// supportedLocales: AppLocalizations.supportedLocales,
|
||||
/// home: MyApplicationHome(),
|
||||
/// );
|
||||
/// ```
|
||||
///
|
||||
/// ## Update pubspec.yaml
|
||||
///
|
||||
/// Please make sure to update your pubspec.yaml to include the following
|
||||
/// packages:
|
||||
///
|
||||
/// ```yaml
|
||||
/// dependencies:
|
||||
/// # Internationalization support.
|
||||
/// flutter_localizations:
|
||||
/// sdk: flutter
|
||||
/// intl: any # Use the pinned version from flutter_localizations
|
||||
///
|
||||
/// # Rest of dependencies
|
||||
/// ```
|
||||
///
|
||||
/// ## iOS Applications
|
||||
///
|
||||
/// iOS applications define key application metadata, including supported
|
||||
/// locales, in an Info.plist file that is built into the application bundle.
|
||||
/// To configure the locales supported by your app, you’ll need to edit this
|
||||
/// file.
|
||||
///
|
||||
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
|
||||
/// Then, in the Project Navigator, open the Info.plist file under the Runner
|
||||
/// project’s Runner folder.
|
||||
///
|
||||
/// Next, select the Information Property List item, select Add Item from the
|
||||
/// Editor menu, then select Localizations from the pop-up menu.
|
||||
///
|
||||
/// Select and expand the newly-created Localizations item then, for each
|
||||
/// locale your application supports, add a new item and select the locale
|
||||
/// you wish to add from the pop-up menu in the Value field. This list should
|
||||
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
|
||||
/// property.
|
||||
abstract class AppLocalizations {
|
||||
AppLocalizations(String locale)
|
||||
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
||||
|
||||
final String localeName;
|
||||
|
||||
static AppLocalizations? of(BuildContext context) {
|
||||
return Localizations.of<AppLocalizations>(context, AppLocalizations);
|
||||
}
|
||||
|
||||
static const LocalizationsDelegate<AppLocalizations> delegate =
|
||||
_AppLocalizationsDelegate();
|
||||
|
||||
/// A list of this localizations delegate along with the default localizations
|
||||
/// delegates.
|
||||
///
|
||||
/// Returns a list of localizations delegates containing this delegate along with
|
||||
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
|
||||
/// and GlobalWidgetsLocalizations.delegate.
|
||||
///
|
||||
/// Additional delegates can be added by appending to this list in
|
||||
/// MaterialApp. This list does not have to be used at all if a custom list
|
||||
/// of delegates is preferred or required.
|
||||
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
|
||||
<LocalizationsDelegate<dynamic>>[
|
||||
delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
];
|
||||
|
||||
/// A list of this localizations delegate's supported locales.
|
||||
static const List<Locale> supportedLocales = <Locale>[
|
||||
Locale('en'),
|
||||
Locale('ru'),
|
||||
Locale('uz'),
|
||||
];
|
||||
|
||||
/// No description provided for @useYourTAxiAccount.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Use your uber account to get started'**
|
||||
String get useYourTAxiAccount;
|
||||
|
||||
/// No description provided for @enterYourMobileNumber.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter your mobile number'**
|
||||
String get enterYourMobileNumber;
|
||||
|
||||
/// No description provided for @mobileNumber.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Mobile number'**
|
||||
String get mobileNumber;
|
||||
|
||||
/// No description provided for @next.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Next'**
|
||||
String get next;
|
||||
|
||||
/// No description provided for @contestToGetCallAndSms.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'By proceeding, you consent to get calls, Whatsapp or SMS messages, including by automated means, from uber and its affiliates to the number provided.'**
|
||||
String get contestToGetCallAndSms;
|
||||
|
||||
/// No description provided for @continueWithGoogle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Continue with google'**
|
||||
String get continueWithGoogle;
|
||||
|
||||
/// No description provided for @or.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'or'**
|
||||
String get or;
|
||||
|
||||
/// No description provided for @welcomeBack.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Welcome back, John'**
|
||||
String get welcomeBack;
|
||||
|
||||
/// No description provided for @pleaseEnterYourPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Please enter your password'**
|
||||
String get pleaseEnterYourPassword;
|
||||
|
||||
/// No description provided for @iHaveForgotPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I\'ve forgotten my password'**
|
||||
String get iHaveForgotPassword;
|
||||
|
||||
/// No description provided for @iCantSignIn.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I cant sign in'**
|
||||
String get iCantSignIn;
|
||||
|
||||
/// No description provided for @enter4DigitCodeSentYou.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enter the 4-digit code sent to you at {phone}'**
|
||||
String enter4DigitCodeSentYou(String phone);
|
||||
|
||||
/// No description provided for @iHavenRecievedCode.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'I haven’t recieved a code (\${time})'**
|
||||
String iHavenRecievedCode(String time);
|
||||
|
||||
/// No description provided for @delivery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delivery'**
|
||||
String get delivery;
|
||||
|
||||
/// No description provided for @pickUp.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Pickup'**
|
||||
String get pickUp;
|
||||
|
||||
/// No description provided for @dineIn.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dine-in'**
|
||||
String get dineIn;
|
||||
|
||||
/// No description provided for @allCategories.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'All categories'**
|
||||
String get allCategories;
|
||||
|
||||
/// No description provided for @convenience.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Convenience'**
|
||||
String get convenience;
|
||||
|
||||
/// No description provided for @alcohol.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Alcohol'**
|
||||
String get alcohol;
|
||||
|
||||
/// No description provided for @petSupplies.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Pet Supplies'**
|
||||
String get petSupplies;
|
||||
|
||||
/// No description provided for @flowers.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Flowers'**
|
||||
String get flowers;
|
||||
|
||||
/// No description provided for @grocery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Grocery'**
|
||||
String get grocery;
|
||||
|
||||
/// No description provided for @american.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'American'**
|
||||
String get american;
|
||||
|
||||
/// No description provided for @speciality.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Speciality'**
|
||||
String get speciality;
|
||||
|
||||
/// No description provided for @takeout.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Takeout'**
|
||||
String get takeout;
|
||||
|
||||
/// No description provided for @asian.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Asian'**
|
||||
String get asian;
|
||||
|
||||
/// No description provided for @iceCream.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Ice Cream'**
|
||||
String get iceCream;
|
||||
|
||||
/// No description provided for @halal.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Halal'**
|
||||
String get halal;
|
||||
|
||||
/// No description provided for @retails.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Retails'**
|
||||
String get retails;
|
||||
|
||||
/// No description provided for @caribbean.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Caribbean'**
|
||||
String get caribbean;
|
||||
|
||||
/// No description provided for @indian.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Indian'**
|
||||
String get indian;
|
||||
|
||||
/// No description provided for @french.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'French'**
|
||||
String get french;
|
||||
|
||||
/// No description provided for @fastFoods.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Fast Foods'**
|
||||
String get fastFoods;
|
||||
|
||||
/// No description provided for @burger.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Burger'**
|
||||
String get burger;
|
||||
|
||||
/// No description provided for @ride.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Ride'**
|
||||
String get ride;
|
||||
|
||||
/// No description provided for @chinese.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Chinese'**
|
||||
String get chinese;
|
||||
|
||||
/// No description provided for @dessert.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dessert'**
|
||||
String get dessert;
|
||||
|
||||
/// No description provided for @more.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'More'**
|
||||
String get more;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
extends LocalizationsDelegate<AppLocalizations> {
|
||||
const _AppLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
Future<AppLocalizations> load(Locale locale) {
|
||||
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
|
||||
}
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) =>
|
||||
<String>['en', 'ru', 'uz'].contains(locale.languageCode);
|
||||
|
||||
@override
|
||||
bool shouldReload(_AppLocalizationsDelegate old) => false;
|
||||
}
|
||||
|
||||
AppLocalizations lookupAppLocalizations(Locale locale) {
|
||||
// Lookup logic when only language code is specified.
|
||||
switch (locale.languageCode) {
|
||||
case 'en':
|
||||
return AppLocalizationsEn();
|
||||
case 'ru':
|
||||
return AppLocalizationsRu();
|
||||
case 'uz':
|
||||
return AppLocalizationsUz();
|
||||
}
|
||||
|
||||
throw FlutterError(
|
||||
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
|
||||
'an issue with the localizations generation tool. Please file an issue '
|
||||
'on GitHub with a reproducible sample app and the gen-l10n configuration '
|
||||
'that was used.',
|
||||
);
|
||||
}
|
||||
129
lib/core/l10n/app_localizations_en.dart
Normal file
129
lib/core/l10n/app_localizations_en.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for English (`en`).
|
||||
class AppLocalizationsEn extends AppLocalizations {
|
||||
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount => 'Use your uber account to get started';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Enter your mobile number';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Mobile number';
|
||||
|
||||
@override
|
||||
String get next => 'Next';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'By proceeding, you consent to get calls, Whatsapp or SMS messages, including by automated means, from uber and its affiliates to the number provided.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Continue with google';
|
||||
|
||||
@override
|
||||
String get or => 'or';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'Welcome back, John';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Please enter your password';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'I\'ve forgotten my password';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'I cant sign in';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Enter the 4-digit code sent to you at $phone';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'I haven’t recieved a code (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Delivery';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Pickup';
|
||||
|
||||
@override
|
||||
String get dineIn => 'Dine-in';
|
||||
|
||||
@override
|
||||
String get allCategories => 'All categories';
|
||||
|
||||
@override
|
||||
String get convenience => 'Convenience';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Alcohol';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Pet Supplies';
|
||||
|
||||
@override
|
||||
String get flowers => 'Flowers';
|
||||
|
||||
@override
|
||||
String get grocery => 'Grocery';
|
||||
|
||||
@override
|
||||
String get american => 'American';
|
||||
|
||||
@override
|
||||
String get speciality => 'Speciality';
|
||||
|
||||
@override
|
||||
String get takeout => 'Takeout';
|
||||
|
||||
@override
|
||||
String get asian => 'Asian';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Ice Cream';
|
||||
|
||||
@override
|
||||
String get halal => 'Halal';
|
||||
|
||||
@override
|
||||
String get retails => 'Retails';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Caribbean';
|
||||
|
||||
@override
|
||||
String get indian => 'Indian';
|
||||
|
||||
@override
|
||||
String get french => 'French';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Fast Foods';
|
||||
|
||||
@override
|
||||
String get burger => 'Burger';
|
||||
|
||||
@override
|
||||
String get ride => 'Ride';
|
||||
|
||||
@override
|
||||
String get chinese => 'Chinese';
|
||||
|
||||
@override
|
||||
String get dessert => 'Dessert';
|
||||
|
||||
@override
|
||||
String get more => 'More';
|
||||
}
|
||||
130
lib/core/l10n/app_localizations_ru.dart
Normal file
130
lib/core/l10n/app_localizations_ru.dart
Normal file
@@ -0,0 +1,130 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for Russian (`ru`).
|
||||
class AppLocalizationsRu extends AppLocalizations {
|
||||
AppLocalizationsRu([String locale = 'ru']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount =>
|
||||
'Используйте свой аккаунт Uber, чтобы начать';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Введите свой номер телефона';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Номер телефона';
|
||||
|
||||
@override
|
||||
String get next => 'Далее';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'Продолжая, вы соглашаетесь получать звонки, сообщения WhatsApp или SMS, включая автоматические, от Uber и его партнеров на указанный номер.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Продолжить через Google';
|
||||
|
||||
@override
|
||||
String get or => 'или';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'С возвращением, null';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Пожалуйста, введите свой пароль';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'Я забыл пароль';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'Не могу войти в систему';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Введите 4-значный код, отправленный на номер $phone';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'Я не получил код (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Доставка';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Самовывоз';
|
||||
|
||||
@override
|
||||
String get dineIn => 'На месте';
|
||||
|
||||
@override
|
||||
String get allCategories => 'Все категории';
|
||||
|
||||
@override
|
||||
String get convenience => 'Магазин';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Алкоголь';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Для питомцев';
|
||||
|
||||
@override
|
||||
String get flowers => 'Цветы';
|
||||
|
||||
@override
|
||||
String get grocery => 'Продукты';
|
||||
|
||||
@override
|
||||
String get american => 'Американская';
|
||||
|
||||
@override
|
||||
String get speciality => 'Особенная';
|
||||
|
||||
@override
|
||||
String get takeout => 'На вынос';
|
||||
|
||||
@override
|
||||
String get asian => 'Азиатская';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Мороженое';
|
||||
|
||||
@override
|
||||
String get halal => 'Халяль';
|
||||
|
||||
@override
|
||||
String get retails => 'Розница';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Карибская';
|
||||
|
||||
@override
|
||||
String get indian => 'Индийская';
|
||||
|
||||
@override
|
||||
String get french => 'Французская';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Фастфуд';
|
||||
|
||||
@override
|
||||
String get burger => 'Бургер';
|
||||
|
||||
@override
|
||||
String get ride => 'Поездка';
|
||||
|
||||
@override
|
||||
String get chinese => 'Китайская';
|
||||
|
||||
@override
|
||||
String get dessert => 'Десерт';
|
||||
|
||||
@override
|
||||
String get more => 'Ещё';
|
||||
}
|
||||
130
lib/core/l10n/app_localizations_uz.dart
Normal file
130
lib/core/l10n/app_localizations_uz.dart
Normal file
@@ -0,0 +1,130 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// The translations for Uzbek (`uz`).
|
||||
class AppLocalizationsUz extends AppLocalizations {
|
||||
AppLocalizationsUz([String locale = 'uz']) : super(locale);
|
||||
|
||||
@override
|
||||
String get useYourTAxiAccount =>
|
||||
'Boshlash uchun Uber hisobingizdan foydalaning';
|
||||
|
||||
@override
|
||||
String get enterYourMobileNumber => 'Telefon raqamingizni kiriting';
|
||||
|
||||
@override
|
||||
String get mobileNumber => 'Telefon raqami';
|
||||
|
||||
@override
|
||||
String get next => 'Keyingi';
|
||||
|
||||
@override
|
||||
String get contestToGetCallAndSms =>
|
||||
'Davom etish orqali siz Uber va uning hamkorlaridan avtomatlashtirilgan qo‘ng‘iroqlar, WhatsApp yoki SMS xabarlarini olishga rozilik bildirasiz.';
|
||||
|
||||
@override
|
||||
String get continueWithGoogle => 'Google orqali davom etish';
|
||||
|
||||
@override
|
||||
String get or => 'yoki';
|
||||
|
||||
@override
|
||||
String get welcomeBack => 'Xush kelibsiz, null';
|
||||
|
||||
@override
|
||||
String get pleaseEnterYourPassword => 'Iltimos, parolingizni kiriting';
|
||||
|
||||
@override
|
||||
String get iHaveForgotPassword => 'Parolimni unutdim';
|
||||
|
||||
@override
|
||||
String get iCantSignIn => 'Kirishda muammo bor';
|
||||
|
||||
@override
|
||||
String enter4DigitCodeSentYou(String phone) {
|
||||
return 'Sizga $phone raqamiga yuborilgan 4 xonali kodni kiriting';
|
||||
}
|
||||
|
||||
@override
|
||||
String iHavenRecievedCode(String time) {
|
||||
return 'Men hali kodni olmabman (\$$time)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get delivery => 'Yetkazib berish';
|
||||
|
||||
@override
|
||||
String get pickUp => 'Olib ketish';
|
||||
|
||||
@override
|
||||
String get dineIn => 'Joyida';
|
||||
|
||||
@override
|
||||
String get allCategories => 'Barcha toifalar';
|
||||
|
||||
@override
|
||||
String get convenience => 'Do‘kon';
|
||||
|
||||
@override
|
||||
String get alcohol => 'Alkogol';
|
||||
|
||||
@override
|
||||
String get petSupplies => 'Uy hayvoni uchun';
|
||||
|
||||
@override
|
||||
String get flowers => 'Gullar';
|
||||
|
||||
@override
|
||||
String get grocery => 'Bozor';
|
||||
|
||||
@override
|
||||
String get american => 'Amerika';
|
||||
|
||||
@override
|
||||
String get speciality => 'Maxsus';
|
||||
|
||||
@override
|
||||
String get takeout => 'Olib ketish';
|
||||
|
||||
@override
|
||||
String get asian => 'Osiyo';
|
||||
|
||||
@override
|
||||
String get iceCream => 'Muzqaymoq';
|
||||
|
||||
@override
|
||||
String get halal => 'Halol';
|
||||
|
||||
@override
|
||||
String get retails => 'Do‘konlar';
|
||||
|
||||
@override
|
||||
String get caribbean => 'Karib';
|
||||
|
||||
@override
|
||||
String get indian => 'Hind';
|
||||
|
||||
@override
|
||||
String get french => 'Fransuz';
|
||||
|
||||
@override
|
||||
String get fastFoods => 'Fast-fud';
|
||||
|
||||
@override
|
||||
String get burger => 'Burger';
|
||||
|
||||
@override
|
||||
String get ride => 'Yo‘l';
|
||||
|
||||
@override
|
||||
String get chinese => 'Xitoy';
|
||||
|
||||
@override
|
||||
String get dessert => 'Desert';
|
||||
|
||||
@override
|
||||
String get more => 'Ko\'proq';
|
||||
}
|
||||
27
lib/core/router/app_routes.dart
Normal file
27
lib/core/router/app_routes.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:food_delivery_client/feature/home/presentation/pages/categories_page/categories_page.dart';
|
||||
import 'package:food_delivery_client/feature/on_boarding/presentation/pages/splash_page/splash_page.dart';
|
||||
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey();
|
||||
|
||||
@singleton
|
||||
class AppRoutes {
|
||||
final GoRouter router = GoRouter(
|
||||
navigatorKey: navigatorKey,
|
||||
initialLocation: Routes.splash,
|
||||
|
||||
routes: [
|
||||
GoRoute(path: Routes.splash, builder: (context, state) => SplashPage()),
|
||||
GoRoute(
|
||||
path: Routes.main,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: MainPage()),
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.categories,
|
||||
pageBuilder: (context, state) => CupertinoPage(child: CategoriesPage()),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
8
lib/core/router/routes_name.dart
Normal file
8
lib/core/router/routes_name.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
abstract class Routes {
|
||||
static const String splash = '/splash';
|
||||
static const String login = '/login';
|
||||
static const String register = '/register';
|
||||
static const String main = '/main';
|
||||
static const String categories = '/categories';
|
||||
|
||||
}
|
||||
1
lib/core/services/services.dart
Normal file
1
lib/core/services/services.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'storage_service.dart';
|
||||
32
lib/core/services/storage_service.dart
Normal file
32
lib/core/services/storage_service.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
@singleton
|
||||
class StorageService {
|
||||
static late SharedPreferences _sharedPreference;
|
||||
|
||||
Future<void> initialize() async {
|
||||
_sharedPreference = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
void setString({required String key, required String value}) {
|
||||
_sharedPreference.setString(key, value);
|
||||
}
|
||||
|
||||
String? getString({required String key}) {
|
||||
return _sharedPreference.getString(key);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static StorageService? _instance;
|
||||
|
||||
const StorageService._();
|
||||
|
||||
static Future<StorageService> initialize() async {
|
||||
if (_instance == null) {
|
||||
_sharedPreference = await SharedPreferences.getInstance();
|
||||
_instance = StorageService._();
|
||||
}
|
||||
return _instance!;
|
||||
}
|
||||
*/
|
||||
23
lib/core/theme/app_colors.dart
Normal file
23
lib/core/theme/app_colors.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
abstract class AppColors {
|
||||
static const Color cTransparent = Colors.transparent;
|
||||
static const Color cRed = Colors.red;
|
||||
|
||||
static const Color cFFFFFF = Color(0xFFFFFFFF);
|
||||
static const Color c000000 = Color(0xFF000000);
|
||||
static const Color cB5B5B5 = Color(0xFFB5B5B5);
|
||||
static const Color c142328 = Color(0xFF142328);
|
||||
static const Color cE6E6E6 = Color(0xFFE6E6E6);
|
||||
static const Color cF6F6F6 = Color(0xFFF6F6F6);
|
||||
static const Color cEEEEEE = Color(0xFFEEEEEE);
|
||||
static const Color c6B6B6B = Color(0xFF6B6B6B);
|
||||
static const Color c34A853 = Color(0xFF34A853);
|
||||
static const Color cD2D7F0 = Color(0xFFD2D7F0);
|
||||
static const Color c9EE2B8 = Color(0xFF9EE2B8);
|
||||
static const Color cE2CC9E = Color(0xFFE2CC9E);
|
||||
static const Color cC99EE2 = Color(0xFFC99EE2);
|
||||
static const Color cE29EC7 = Color(0xFFE29EC7);
|
||||
static const Color c545454 = Color(0xFF545454);
|
||||
|
||||
}
|
||||
27
lib/core/theme/app_icons.dart
Normal file
27
lib/core/theme/app_icons.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
abstract class AppIcons {
|
||||
//baseurl
|
||||
static const String baseUrl = 'assets/icons';
|
||||
|
||||
//icons
|
||||
static const String icHome = "$baseUrl/ic_home.svg";
|
||||
static const String icBrowse = "$baseUrl/ic_browse.svg";
|
||||
static const String icBasket = "$baseUrl/ic_basket.svg";
|
||||
static const String icAccount = "$baseUrl/ic_account.svg";
|
||||
static const String icHomeActive = "$baseUrl/ic_home_active.svg";
|
||||
static const String icBrowseActive = "$baseUrl/ic_browse_active.svg";
|
||||
static const String icBasketActive = "$baseUrl/ic_basket_active.svg";
|
||||
static const String icAccountActive = "$baseUrl/ic_account_active.svg";
|
||||
static const String icBack = "$baseUrl/ic_back.svg";
|
||||
static const String icDislike = "$baseUrl/ic_dislike.svg";
|
||||
static const String icEat = "$baseUrl/ic_eat.svg";
|
||||
static const String icEye = "$baseUrl/ic_eye.svg";
|
||||
static const String icFilter = "$baseUrl/ic_filter.svg";
|
||||
static const String icNext = "$baseUrl/ic_next.svg";
|
||||
static const String icNextGrey = "$baseUrl/ic_next_grey.svg";
|
||||
static const String icOval = "$baseUrl/ic_oval.svg";
|
||||
static const String icUber = "$baseUrl/ic_uber.svg";
|
||||
static const String icLocation = "$baseUrl/ic_location.svg";
|
||||
static const String icArrowBottom = "$baseUrl/ic_arrow_btm.svg";
|
||||
|
||||
///.png icons
|
||||
}
|
||||
27
lib/core/theme/app_images.dart
Normal file
27
lib/core/theme/app_images.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
abstract class AppImages {
|
||||
static const String baseUrl = "assets/images";
|
||||
|
||||
static const String imgConvenience = "$baseUrl/img_convenience.png";
|
||||
static const String imgAlcohol = "$baseUrl/img_alcohol.png";
|
||||
static const String imgPetSupplies = "$baseUrl/img_pet_supplies.png";
|
||||
static const String imgFlowers = "$baseUrl/img_flowers.png";
|
||||
static const String imgGrocery = "$baseUrl/img_grocery.png";
|
||||
static const String imgAmerican = "$baseUrl/img_american.png";
|
||||
static const String imgSpeciality = "$baseUrl/img_speciality.jpg";
|
||||
static const String imgTakeout = "$baseUrl/img_takeout.png";
|
||||
static const String imgAsian = "$baseUrl/img_asian.png";
|
||||
static const String imgIceCream = "$baseUrl/img_ice_cream.png";
|
||||
static const String imgHalal= "$baseUrl/img_halal.png";
|
||||
static const String imgRetails= "$baseUrl/img_retails.png";
|
||||
static const String imgCarribean= "$baseUrl/img_carribean.png";
|
||||
static const String imgIndian= "$baseUrl/img_indian.png";
|
||||
static const String imgFrench = "$baseUrl/img_french.png";
|
||||
static const String imgFastFoods = "$baseUrl/img_fast_food.png";
|
||||
static const String imgBurger = "$baseUrl/img_burger.png";
|
||||
static const String imgRide = "$baseUrl/img_ride.png";
|
||||
static const String imgChinese= "$baseUrl/img_chinese.png";
|
||||
static const String imgDesert = "$baseUrl/img_desert.png";
|
||||
static const String imgPickUp= "$baseUrl/img_pick_up.png";
|
||||
|
||||
|
||||
}
|
||||
87
lib/core/theme/app_textstyles.dart
Normal file
87
lib/core/theme/app_textstyles.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
abstract class AppTextStyles {
|
||||
static const Color _defaultColor = AppColors.c000000;
|
||||
static const String _fontRegular = AppLocaleKeys.fontRegular;
|
||||
static const String _fontMedium = AppLocaleKeys.fontMedium;
|
||||
static const String _fontBold = AppLocaleKeys.fontBold;
|
||||
static const String _fontLight = AppLocaleKeys.fontLight;
|
||||
|
||||
static const TextStyle size10Regular = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_10,
|
||||
fontFamily: _fontRegular,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
|
||||
static const TextStyle size12Regular = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_12,
|
||||
fontFamily: _fontRegular,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
|
||||
static const TextStyle size14Regular = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_14,
|
||||
fontFamily: _fontRegular,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
|
||||
static const TextStyle size20Regular = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_20,
|
||||
fontFamily: _fontRegular,
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
|
||||
static const TextStyle size14Medium = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_14,
|
||||
fontFamily: _fontMedium,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
|
||||
static const TextStyle size15Medium = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_15,
|
||||
fontFamily: _fontMedium,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
|
||||
static const TextStyle size16Medium = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_16,
|
||||
fontFamily: _fontMedium,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
|
||||
static const TextStyle size18Medium = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_18,
|
||||
fontFamily: _fontMedium,
|
||||
fontWeight: FontWeight.w500,
|
||||
);
|
||||
|
||||
static const TextStyle size17Bold = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_17,
|
||||
fontFamily: _fontBold,
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
|
||||
static const TextStyle size24Bold = TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_24,
|
||||
fontFamily: _fontBold,
|
||||
fontWeight: FontWeight.w700,
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
TextStyle(
|
||||
color: _defaultColor,
|
||||
fontSize: SizesCons.size_10,
|
||||
fontFamily: _fontRegular,
|
||||
);
|
||||
*/
|
||||
64
lib/core/theme/app_theme.dart
Normal file
64
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
abstract class AppTheme {
|
||||
static ThemeData get lightTheme => ThemeData.light().copyWith(
|
||||
brightness: Brightness.light,
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
foregroundColor: AppColors.cFFFFFF,
|
||||
surfaceTintColor: AppColors.cTransparent,
|
||||
),
|
||||
scaffoldBackgroundColor: AppColors.cFFFFFF,
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
elevation:0,
|
||||
showSelectedLabels: true,
|
||||
showUnselectedLabels: true,
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
unselectedItemColor: AppColors.cB5B5B5,
|
||||
selectedItemColor:AppColors.c000000,
|
||||
selectedLabelStyle: AppTextStyles.size10Regular.copyWith(
|
||||
color: Colors.red,
|
||||
),
|
||||
unselectedLabelStyle: AppTextStyles.size10Regular.copyWith(
|
||||
color: AppColors.c000000,
|
||||
),
|
||||
// unselectedLabelStyle: AppTextStyles.size14Medium.copyWith(
|
||||
// color: AppColors.c888888,
|
||||
// fontFamily: "fontNorms",
|
||||
// ),
|
||||
),
|
||||
// inputDecorationTheme: InputDecorationTheme(
|
||||
// filled: true,
|
||||
// fillColor: AppColors.cMainBg,
|
||||
// hintStyle: AppTextStyles.size15Medium.copyWith(color: AppColors.c888888),
|
||||
// contentPadding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
|
||||
// errorStyle: AppTextStyles.size12Medium.copyWith(color: AppColors.cRed),
|
||||
// errorBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cRed, width: 1.5.r),
|
||||
// ),
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cFF9914, width: 1.5.r),
|
||||
// ),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// focusedErrorBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cRed, width: 1.5.r),
|
||||
// ),
|
||||
// disabledBorder: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// border: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(12.sp),
|
||||
// borderSide: BorderSide(color: AppColors.cEDEDED, width: 1.5.r),
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
5
lib/core/theme/theme.dart
Normal file
5
lib/core/theme/theme.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
export 'app_icons.dart';
|
||||
export 'app_images.dart';
|
||||
export 'app_textstyles.dart';
|
||||
export 'app_theme.dart';
|
||||
export 'app_colors.dart';
|
||||
90
lib/core/utils/app_utils.dart
Normal file
90
lib/core/utils/app_utils.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import '../../food_delivery_client.dart';
|
||||
|
||||
abstract class AppUtils {
|
||||
static const Radius kRadius = Radius.zero;
|
||||
static const Radius kRadius8 = Radius.circular(8);
|
||||
static const Radius kRadius12 = Radius.circular(12);
|
||||
static const Radius kRadius14 = Radius.circular(14);
|
||||
static const Radius kRadius15 = Radius.circular(15);
|
||||
static const Radius kRadius16 = Radius.circular(16);
|
||||
static const Radius kRadius20 = Radius.circular(20);
|
||||
static const Radius kRadius22 = Radius.circular(22);
|
||||
static const Radius kRadius24 = Radius.circular(24);
|
||||
static const Radius kRadius25 = Radius.circular(25);
|
||||
static const BorderRadius kBorderRadius = BorderRadius.zero;
|
||||
static const BorderRadius kBorderRadius2 = BorderRadius.all(
|
||||
Radius.circular(2),
|
||||
);
|
||||
static const BorderRadius kBorderRadius4 = BorderRadius.all(
|
||||
Radius.circular(4),
|
||||
);
|
||||
static const BorderRadius kBorderRadius6 = BorderRadius.all(
|
||||
Radius.circular(6),
|
||||
);
|
||||
static const BorderRadius kBorderRadius8 = BorderRadius.all(
|
||||
Radius.circular(8),
|
||||
);
|
||||
static const BorderRadius kBorderRadius9 = BorderRadius.all(
|
||||
Radius.circular(9),
|
||||
);
|
||||
static const BorderRadius kBorderRadius10 = BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
);
|
||||
static const BorderRadius kBorderRadius12 = BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
);
|
||||
static const BorderRadius kBorderRadius14 = BorderRadius.all(
|
||||
Radius.circular(14),
|
||||
);
|
||||
static const BorderRadius kBorderRadius16 = BorderRadius.all(
|
||||
Radius.circular(16),
|
||||
);
|
||||
static const BorderRadius kBorderRadius18 = BorderRadius.all(
|
||||
Radius.circular(18),
|
||||
);
|
||||
static const BorderRadius kBorderRadius20 = BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
);
|
||||
static const BorderRadius kBorderRadius22 = BorderRadius.all(
|
||||
Radius.circular(22),
|
||||
);
|
||||
static const BorderRadius kBorderRadius24 = BorderRadius.all(
|
||||
Radius.circular(24),
|
||||
);
|
||||
|
||||
static const BorderRadius kBorderRadius25 = BorderRadius.all(
|
||||
Radius.circular(25),
|
||||
);
|
||||
static const BorderRadius kBorderRadius26 = BorderRadius.all(
|
||||
Radius.circular(26),
|
||||
);
|
||||
static const BorderRadius kBorderRadius28 = BorderRadius.all(
|
||||
Radius.circular(28),
|
||||
);
|
||||
static const BorderRadius kBorderRadius30 = BorderRadius.all(
|
||||
Radius.circular(30),
|
||||
);
|
||||
static const BorderRadius kBorderRadius32 = BorderRadius.all(
|
||||
Radius.circular(32),
|
||||
);
|
||||
static const BorderRadius kBorderRadius34 = BorderRadius.all(
|
||||
Radius.circular(34),
|
||||
);
|
||||
static const BorderRadius kBorderRadius36 = BorderRadius.all(
|
||||
Radius.circular(36),
|
||||
);
|
||||
static const BorderRadius kBorderRadius38 = BorderRadius.all(
|
||||
Radius.circular(38),
|
||||
);
|
||||
static const BorderRadius kBorderRadius40 = BorderRadius.all(
|
||||
Radius.circular(40),
|
||||
);
|
||||
static const BorderRadius kBorderRadiusTop20Bottom20 = BorderRadius.only(
|
||||
bottomRight: kRadius20,
|
||||
topRight: kRadius20,
|
||||
);
|
||||
static const BorderRadius kBorderRadiusTop15Bottom15 = BorderRadius.only(
|
||||
bottomRight: kRadius15,
|
||||
topRight: kRadius15,
|
||||
);
|
||||
}
|
||||
1
lib/feature/account/account.dart
Normal file
1
lib/feature/account/account.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'presentation/pages/account_page/account_page.dart';
|
||||
@@ -0,0 +1,42 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class AccountPage extends StatelessWidget {
|
||||
const AccountPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<LanguageBloc, LanguageState>(
|
||||
builder: (context, state) {
|
||||
return WLayout(
|
||||
child: Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(context.loc.iCantSignIn),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (state.currentLocale == Locale("uz")) {
|
||||
context.read<LanguageBloc>().add(
|
||||
LanguageEvent.changed(Locale('ru')),
|
||||
);
|
||||
} else if (state.currentLocale == Locale("ru")) {
|
||||
context.read<LanguageBloc>().add(
|
||||
LanguageEvent.changed(Locale('en')),
|
||||
);
|
||||
} else {
|
||||
context.read<LanguageBloc>().add(
|
||||
LanguageEvent.changed(Locale('uz')),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text("changelang"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
1
lib/feature/basket/basket.dart
Normal file
1
lib/feature/basket/basket.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'presentation/pages/basket_page/basket_page.dart';
|
||||
@@ -0,0 +1,12 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class BasketPage extends StatelessWidget {
|
||||
const BasketPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(
|
||||
child: Scaffold(body: Center(child: Text(context.loc.useYourTAxiAccount))),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
lib/feature/browse/browse.dart
Normal file
1
lib/feature/browse/browse.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'presentation/pages/browse_page/browse_page.dart';
|
||||
@@ -0,0 +1,12 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class BrowsePage extends StatelessWidget {
|
||||
const BrowsePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLayout(
|
||||
child: Scaffold(body: Center(child: Text(context.loc.mobileNumber))),
|
||||
);
|
||||
}
|
||||
}
|
||||
2
lib/feature/common/common.dart
Normal file
2
lib/feature/common/common.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'presentation/widgets/widgets.dart';
|
||||
export 'presentation/blocs/language_bloc/language_bloc.dart';
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
part 'language_event.dart';
|
||||
|
||||
part 'language_state.dart';
|
||||
|
||||
part 'language_bloc.freezed.dart';
|
||||
@injectable
|
||||
class LanguageBloc extends Bloc<LanguageEvent, LanguageState> {
|
||||
final StorageService _storageService;
|
||||
|
||||
LanguageBloc(this._storageService) : super(const LanguageState()) {
|
||||
on<_Started>(_onStarted);
|
||||
|
||||
on<_Changeded>(_onChanged);
|
||||
}
|
||||
|
||||
Future<void> _onStarted(_Started event, Emitter<LanguageState> emit) async {
|
||||
final lang = _storageService.getString(key: AppLocaleKeys.language);
|
||||
|
||||
if (lang != null) {
|
||||
emit(state.copyWith(currentLocale: Locale(lang)));
|
||||
} else {
|
||||
emit(state.copyWith(currentLocale: Locale("en")));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onChanged(_Changeded event, Emitter<LanguageState> emit) async {
|
||||
_storageService.setString(
|
||||
key: AppLocaleKeys.language,
|
||||
value: event.locale.languageCode,
|
||||
);
|
||||
emit(state.copyWith(currentLocale: event.locale));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$LanguageEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LanguageEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $LanguageEventCopyWith<$Res> {
|
||||
$LanguageEventCopyWith(LanguageEvent _, $Res Function(LanguageEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LanguageEvent].
|
||||
extension LanguageEventPatterns on LanguageEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Changeded value)? changed,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changeded() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Changeded value) changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Changeded():
|
||||
return changed(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Changeded value)? changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changeded() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( Locale locale)? changed,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changeded() when changed != null:
|
||||
return changed(_that.locale);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( Locale locale) changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Changeded():
|
||||
return changed(_that.locale);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( Locale locale)? changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changeded() when changed != null:
|
||||
return changed(_that.locale);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements LanguageEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Changeded implements LanguageEvent {
|
||||
const _Changeded(this.locale);
|
||||
|
||||
|
||||
final Locale locale;
|
||||
|
||||
/// Create a copy of LanguageEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ChangededCopyWith<_Changeded> get copyWith => __$ChangededCopyWithImpl<_Changeded>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Changeded&&(identical(other.locale, locale) || other.locale == locale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,locale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageEvent.changed(locale: $locale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ChangededCopyWith<$Res> implements $LanguageEventCopyWith<$Res> {
|
||||
factory _$ChangededCopyWith(_Changeded value, $Res Function(_Changeded) _then) = __$ChangededCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
Locale locale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ChangededCopyWithImpl<$Res>
|
||||
implements _$ChangededCopyWith<$Res> {
|
||||
__$ChangededCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Changeded _self;
|
||||
final $Res Function(_Changeded) _then;
|
||||
|
||||
/// Create a copy of LanguageEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? locale = null,}) {
|
||||
return _then(_Changeded(
|
||||
null == locale ? _self.locale : locale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LanguageState {
|
||||
|
||||
Locale get currentLocale;
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LanguageStateCopyWith<LanguageState> get copyWith => _$LanguageStateCopyWithImpl<LanguageState>(this as LanguageState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LanguageState&&(identical(other.currentLocale, currentLocale) || other.currentLocale == currentLocale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentLocale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageState(currentLocale: $currentLocale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LanguageStateCopyWith<$Res> {
|
||||
factory $LanguageStateCopyWith(LanguageState value, $Res Function(LanguageState) _then) = _$LanguageStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
Locale currentLocale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LanguageStateCopyWithImpl<$Res>
|
||||
implements $LanguageStateCopyWith<$Res> {
|
||||
_$LanguageStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LanguageState _self;
|
||||
final $Res Function(LanguageState) _then;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentLocale = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentLocale: null == currentLocale ? _self.currentLocale : currentLocale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [LanguageState].
|
||||
extension LanguageStatePatterns on LanguageState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LanguageState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LanguageState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LanguageState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Locale currentLocale)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that.currentLocale);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Locale currentLocale) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState():
|
||||
return $default(_that.currentLocale);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Locale currentLocale)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _LanguageState() when $default != null:
|
||||
return $default(_that.currentLocale);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _LanguageState implements LanguageState {
|
||||
const _LanguageState({this.currentLocale = const Locale('en')});
|
||||
|
||||
|
||||
@override@JsonKey() final Locale currentLocale;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LanguageStateCopyWith<_LanguageState> get copyWith => __$LanguageStateCopyWithImpl<_LanguageState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LanguageState&&(identical(other.currentLocale, currentLocale) || other.currentLocale == currentLocale));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentLocale);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LanguageState(currentLocale: $currentLocale)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LanguageStateCopyWith<$Res> implements $LanguageStateCopyWith<$Res> {
|
||||
factory _$LanguageStateCopyWith(_LanguageState value, $Res Function(_LanguageState) _then) = __$LanguageStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
Locale currentLocale
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LanguageStateCopyWithImpl<$Res>
|
||||
implements _$LanguageStateCopyWith<$Res> {
|
||||
__$LanguageStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LanguageState _self;
|
||||
final $Res Function(_LanguageState) _then;
|
||||
|
||||
/// Create a copy of LanguageState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentLocale = null,}) {
|
||||
return _then(_LanguageState(
|
||||
currentLocale: null == currentLocale ? _self.currentLocale : currentLocale // ignore: cast_nullable_to_non_nullable
|
||||
as Locale,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class LanguageEvent with _$LanguageEvent {
|
||||
const factory LanguageEvent.started() = _Started;
|
||||
|
||||
const factory LanguageEvent.changed(Locale locale) = _Changeded;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
part of 'language_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LanguageState with _$LanguageState {
|
||||
const factory LanguageState({@Default(Locale('en')) Locale currentLocale}) =
|
||||
_LanguageState;
|
||||
}
|
||||
25
lib/feature/common/presentation/widgets/w_divider.dart
Normal file
25
lib/feature/common/presentation/widgets/w_divider.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WDivider extends StatelessWidget {
|
||||
const WDivider({
|
||||
super.key,
|
||||
this.height = 10,
|
||||
this.endIndent = 0,
|
||||
this.indent = 0,
|
||||
});
|
||||
|
||||
final double height;
|
||||
final double endIndent;
|
||||
final double indent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Divider(
|
||||
color: AppColors.cF6F6F6,
|
||||
height: height,
|
||||
thickness: height,
|
||||
endIndent: 0,
|
||||
indent: 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
144
lib/feature/common/presentation/widgets/w_food_item.dart
Normal file
144
lib/feature/common/presentation/widgets/w_food_item.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_bounceable/flutter_bounceable.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WFoodItem extends StatelessWidget {
|
||||
const WFoodItem({
|
||||
super.key,
|
||||
this.imageHeight,
|
||||
this.textStyle1,
|
||||
this.textStyle2,
|
||||
this.enableTag = false,
|
||||
});
|
||||
|
||||
final double? imageHeight;
|
||||
final TextStyle? textStyle1;
|
||||
final TextStyle? textStyle2;
|
||||
final bool enableTag;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Bounceable(
|
||||
onTap: () {},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// CachedNetworkImage(
|
||||
// imageUrl: AppLocaleKeys.imageUrl,
|
||||
// width: 200,
|
||||
// height: 155,
|
||||
// fit: BoxFit.cover,
|
||||
// placeholder: (context, url) => CircularProgressIndicator(),
|
||||
// errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
//
|
||||
// ),
|
||||
SizedBox(
|
||||
height: imageHeight ?? 155,
|
||||
width: context.w,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
width: 200,
|
||||
height: 155,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) =>
|
||||
Center(child: CircularProgressIndicator.adaptive()),
|
||||
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 8,
|
||||
left: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
if (enableTag)
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.c34A853,
|
||||
borderRadius: AppUtils.kBorderRadiusTop20Bottom20,
|
||||
),
|
||||
child: Text(
|
||||
"5 orders until \$8 reward",
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
).paddingOnly(top: 2, bottom: 2, left: 20, right: 40),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: SvgPicture.asset(AppIcons.icDislike),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
8.verticalSpace,
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Adenine Kitchen",
|
||||
style: textStyle1 ?? AppTextStyles.size16Medium,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cEEEEEE,
|
||||
borderRadius: AppUtils.kBorderRadius28,
|
||||
),
|
||||
child: Center(
|
||||
child: Text("4.4", style: AppTextStyles.size12Regular),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// RichText(
|
||||
// text: TextSpan(
|
||||
// text: "\$0.29 Delivery Fee",
|
||||
// children: [TextSpan(text: "10-25 min")],
|
||||
// style: AppTextStyles.size14Regular.copyWith(
|
||||
// color: AppColors.c6B6B6B,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"\$0.29 Delivery Fee",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
5.horizontalSpace,
|
||||
Icon(Icons.circle, size: 5, color: AppColors.c6B6B6B),
|
||||
5.horizontalSpace,
|
||||
Text(
|
||||
"10-25 min",
|
||||
style:
|
||||
textStyle2 ??
|
||||
AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
);
|
||||
}
|
||||
}
|
||||
24
lib/feature/common/presentation/widgets/w_layout.dart
Normal file
24
lib/feature/common/presentation/widgets/w_layout.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WLayout extends StatelessWidget {
|
||||
const WLayout({
|
||||
super.key,
|
||||
this.bgColor = AppColors.cFFFFFF,
|
||||
this.bottom = true,
|
||||
this.top = true,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final Color bgColor;
|
||||
final bool bottom;
|
||||
final bool top;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: bgColor,
|
||||
child: SafeArea(top: top, bottom: bottom, child: child),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/feature/common/presentation/widgets/w_see_all_raw.dart
Normal file
21
lib/feature/common/presentation/widgets/w_see_all_raw.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WSeeAllRaw extends StatelessWidget {
|
||||
const WSeeAllRaw({super.key, required this.title, required this.onPressed});
|
||||
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: Text(title, style: AppTextStyles.size24Bold)),
|
||||
TextButton(
|
||||
onPressed: onPressed,
|
||||
child: Text("see all", style: AppTextStyles.size16Medium),
|
||||
),
|
||||
],
|
||||
).paddingOnly(left: 15, right: 8);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WStoriesListItem extends StatelessWidget {
|
||||
const WStoriesListItem({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 200,
|
||||
width: 155,
|
||||
child: ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: AppLocaleKeys.imageUrl,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
5
lib/feature/common/presentation/widgets/widgets.dart
Normal file
5
lib/feature/common/presentation/widgets/widgets.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
export 'w_layout.dart';
|
||||
export 'w_food_item.dart';
|
||||
export 'w_divider.dart';
|
||||
export 'w_see_all_raw.dart';
|
||||
export 'w_stories_list_item.dart';
|
||||
11
lib/feature/home/home.dart
Normal file
11
lib/feature/home/home.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
export 'presentation/pages/home_page/home_page.dart';
|
||||
export 'presentation/blocs/home_bloc/home_bloc.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_home_headers.dart';
|
||||
export 'presentation/widgets/w_category_item.dart';
|
||||
export "presentation/pages/home_page/widgets/w_categories_header_item.dart";
|
||||
export 'presentation/pages/home_page/widgets/w_delivery_header.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_discount_part.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_offers_carouseL_slider.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_popular_near_you.dart';
|
||||
export 'presentation/pages/home_page/widgets/w_todays_offers.dart';
|
||||
export 'package:food_delivery_client/feature/home/presentation/pages/home_page/widgets/pick_it_for_free.dart';
|
||||
17
lib/feature/home/presentation/blocs/home_bloc/home_bloc.dart
Normal file
17
lib/feature/home/presentation/blocs/home_bloc/home_bloc.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'home_event.dart';
|
||||
|
||||
part 'home_state.dart';
|
||||
|
||||
part 'home_bloc.freezed.dart';
|
||||
@injectable
|
||||
class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
HomeBloc() : super(const HomeState()) {
|
||||
on<_Changed>(_onChanged);
|
||||
}
|
||||
|
||||
void _onChanged(_Changed event, Emitter<HomeState> emit) {
|
||||
emit(state.copyWith(currentIndex: event.index));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$HomeEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $HomeEventCopyWith<$Res> {
|
||||
$HomeEventCopyWith(HomeEvent _, $Res Function(HomeEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [HomeEvent].
|
||||
extension HomeEventPatterns on HomeEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Changed value)? changed,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changed() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Changed value) changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Changed():
|
||||
return changed(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Changed value)? changed,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Changed() when changed != null:
|
||||
return changed(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( int index)? changed,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changed() when changed != null:
|
||||
return changed(_that.index);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( int index) changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Changed():
|
||||
return changed(_that.index);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( int index)? changed,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Changed() when changed != null:
|
||||
return changed(_that.index);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements HomeEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Changed implements HomeEvent {
|
||||
const _Changed(this.index);
|
||||
|
||||
|
||||
final int index;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ChangedCopyWith<_Changed> get copyWith => __$ChangedCopyWithImpl<_Changed>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Changed&&(identical(other.index, index) || other.index == index));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,index);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeEvent.changed(index: $index)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ChangedCopyWith<$Res> implements $HomeEventCopyWith<$Res> {
|
||||
factory _$ChangedCopyWith(_Changed value, $Res Function(_Changed) _then) = __$ChangedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int index
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ChangedCopyWithImpl<$Res>
|
||||
implements _$ChangedCopyWith<$Res> {
|
||||
__$ChangedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Changed _self;
|
||||
final $Res Function(_Changed) _then;
|
||||
|
||||
/// Create a copy of HomeEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? index = null,}) {
|
||||
return _then(_Changed(
|
||||
null == index ? _self.index : index // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$HomeState {
|
||||
|
||||
int get currentIndex;
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$HomeStateCopyWith<HomeState> get copyWith => _$HomeStateCopyWithImpl<HomeState>(this as HomeState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeState(currentIndex: $currentIndex)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $HomeStateCopyWith<$Res> {
|
||||
factory $HomeStateCopyWith(HomeState value, $Res Function(HomeState) _then) = _$HomeStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int currentIndex
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$HomeStateCopyWithImpl<$Res>
|
||||
implements $HomeStateCopyWith<$Res> {
|
||||
_$HomeStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final HomeState _self;
|
||||
final $Res Function(HomeState) _then;
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? currentIndex = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [HomeState].
|
||||
extension HomeStatePatterns on HomeState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _HomeState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _HomeState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _HomeState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int currentIndex)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that.currentIndex);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int currentIndex) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState():
|
||||
return $default(_that.currentIndex);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int currentIndex)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _HomeState() when $default != null:
|
||||
return $default(_that.currentIndex);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _HomeState implements HomeState {
|
||||
const _HomeState({this.currentIndex = 0});
|
||||
|
||||
|
||||
@override@JsonKey() final int currentIndex;
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$HomeStateCopyWith<_HomeState> get copyWith => __$HomeStateCopyWithImpl<_HomeState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HomeState&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,currentIndex);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HomeState(currentIndex: $currentIndex)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$HomeStateCopyWith<$Res> implements $HomeStateCopyWith<$Res> {
|
||||
factory _$HomeStateCopyWith(_HomeState value, $Res Function(_HomeState) _then) = __$HomeStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int currentIndex
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$HomeStateCopyWithImpl<$Res>
|
||||
implements _$HomeStateCopyWith<$Res> {
|
||||
__$HomeStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _HomeState _self;
|
||||
final $Res Function(_HomeState) _then;
|
||||
|
||||
/// Create a copy of HomeState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? currentIndex = null,}) {
|
||||
return _then(_HomeState(
|
||||
currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class HomeEvent with _$HomeEvent {
|
||||
const factory HomeEvent.started() = _Started;
|
||||
const factory HomeEvent.changed(int index) = _Changed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'home_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class HomeState with _$HomeState {
|
||||
const factory HomeState({
|
||||
@Default(0) int currentIndex
|
||||
}) = _HomeState;
|
||||
}
|
||||
26
lib/feature/home/presentation/mixins/categories_mixin.dart
Normal file
26
lib/feature/home/presentation/mixins/categories_mixin.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:food_delivery_client/core/core.dart';
|
||||
|
||||
mixin CategoriesMixin {
|
||||
List<String> images = [
|
||||
AppImages.imgConvenience,
|
||||
AppImages.imgAlcohol,
|
||||
AppImages.imgPetSupplies,
|
||||
AppImages.imgFlowers,
|
||||
AppImages.imgGrocery,
|
||||
AppImages.imgAmerican,
|
||||
AppImages.imgSpeciality,
|
||||
AppImages.imgTakeout,
|
||||
AppImages.imgAsian,
|
||||
AppImages.imgIceCream,
|
||||
AppImages.imgHalal,
|
||||
AppImages.imgRetails,
|
||||
AppImages.imgCarribean,
|
||||
AppImages.imgIndian,
|
||||
AppImages.imgFrench,
|
||||
AppImages.imgFastFoods,
|
||||
AppImages.imgBurger,
|
||||
AppImages.imgRide,
|
||||
AppImages.imgChinese,
|
||||
AppImages.imgDesert,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
mixin HomePageMixins {
|
||||
static const headers = [];
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import 'package:food_delivery_client/feature/home/presentation/mixins/categories_mixin.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class CategoriesPage extends StatelessWidget with CategoriesMixin {
|
||||
CategoriesPage({super.key});
|
||||
|
||||
show(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
|
||||
builder: (context) => Wrap(children: [this]),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> _titles = [
|
||||
context.loc.convenience,
|
||||
context.loc.alcohol,
|
||||
context.loc.petSupplies,
|
||||
context.loc.flowers,
|
||||
context.loc.grocery,
|
||||
context.loc.american,
|
||||
context.loc.speciality,
|
||||
context.loc.takeout,
|
||||
context.loc.asian,
|
||||
context.loc.iceCream,
|
||||
context.loc.halal,
|
||||
context.loc.retails,
|
||||
context.loc.caribbean,
|
||||
context.loc.indian,
|
||||
context.loc.french,
|
||||
context.loc.fastFoods,
|
||||
context.loc.burger,
|
||||
context.loc.ride,
|
||||
context.loc.chinese,
|
||||
context.loc.dessert,
|
||||
];
|
||||
return Material(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadius20,
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
24.verticalSpace,
|
||||
Text(context.loc.allCategories, style: AppTextStyles.size20Regular),
|
||||
30.verticalSpace,
|
||||
GridView.builder(
|
||||
itemCount: images.length,
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 78 / 100,
|
||||
),
|
||||
itemBuilder: (context, index) => WCategoryItem(
|
||||
onTap: () {},
|
||||
imgUrl: images[index],
|
||||
text: _titles[index],
|
||||
),
|
||||
),
|
||||
40.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/feature/home/presentation/pages/home_page/home_page.dart
Normal file
34
lib/feature/home/presentation/pages/home_page/home_page.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<HomeBloc>(),
|
||||
child: BlocBuilder<HomeBloc, HomeState>(
|
||||
builder: (context, state) {
|
||||
return WLayout(
|
||||
child: Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(child: WHomeHeader()),
|
||||
SliverToBoxAdapter(child: Column(children: [
|
||||
WDeliveryHeader(),
|
||||
WDiscountPart(),
|
||||
WOffersCarouselSlider(),
|
||||
WDiscountPart(),
|
||||
WPopularNearYou(),
|
||||
WTodayOffers(),
|
||||
WPickItUpForFree()
|
||||
])),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WPickItUpForFree extends StatelessWidget {
|
||||
const WPickItUpForFree({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment:MainAxisAlignment.start,
|
||||
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
12.verticalSpace,
|
||||
Column(
|
||||
mainAxisAlignment:MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Pick it up for free', style: AppTextStyles.size24Bold),
|
||||
Text(
|
||||
"Skip the fees when you order pick-up",
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.c545454,
|
||||
),
|
||||
),
|
||||
7.verticalSpace,
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
Container(
|
||||
height: 210,
|
||||
width: context.w,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(AppImages.imgPickUp),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentGeometry.topCenter,
|
||||
child: CarouselSlider.builder(
|
||||
options: CarouselOptions(
|
||||
height: 100.0,
|
||||
reverse: false,
|
||||
viewportFraction: 0.9,
|
||||
animateToClosest: true,
|
||||
autoPlay: true,
|
||||
autoPlayCurve: Curves.easeIn,
|
||||
initialPage: 0,
|
||||
padEnds: false,
|
||||
enableInfiniteScroll: true,
|
||||
scrollPhysics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
),
|
||||
itemCount: 5,
|
||||
itemBuilder: (context, index, realIndex) {
|
||||
return Builder(
|
||||
builder: (BuildContext context) {
|
||||
return PickItUpItem().paddingOnly(left: 15);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
10.verticalSpace,
|
||||
WFoodItem(),
|
||||
40.verticalSpace
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PickItUpItem extends StatelessWidget {
|
||||
const PickItUpItem({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: AppColors.cTransparent,
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFFFFFF,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.c000000.newWithOpacity(.25),
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
spacing: 6,
|
||||
children: [
|
||||
Image.network(
|
||||
AppLocaleKeys.imageUrl,
|
||||
height: 88,
|
||||
width: 96,
|
||||
fit: BoxFit.cover,
|
||||
).paddingAll(4),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Island Takeway", style: AppTextStyles.size17Bold),
|
||||
Text(
|
||||
"10-20 min",
|
||||
style: AppTextStyles.size14Medium.copyWith(
|
||||
color: AppColors.c6B6B6B,
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingOnly(top: 4, bottom: 4, right: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter_bounceable/flutter_bounceable.dart';
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WCategoriesHeaderItem extends StatelessWidget {
|
||||
const WCategoriesHeaderItem({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.imageUrl,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final String imageUrl;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
child: Ink(
|
||||
height: 88,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
color: AppColors.cE6E6E6.newWithOpacity(.4),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
alignment: AlignmentGeometry.topRight,
|
||||
child: Image.asset(imageUrl).paddingOnly(top: 5, right: 5),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: AppTextStyles.size18Medium,
|
||||
).paddingOnly(left: 12, bottom: 6),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'package:food_delivery_client/feature/home/presentation/pages/categories_page/categories_page.dart';
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WDeliveryHeader extends StatelessWidget {
|
||||
const WDeliveryHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> _titles = [
|
||||
context.loc.convenience,
|
||||
context.loc.alcohol,
|
||||
context.loc.petSupplies,
|
||||
context.loc.more,
|
||||
];
|
||||
return Column(
|
||||
children: [
|
||||
15.verticalSpace,
|
||||
Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
WCategoriesHeaderItem(
|
||||
onTap: () {},
|
||||
text: context.loc.american,
|
||||
imageUrl: AppImages.imgAmerican,
|
||||
),
|
||||
WCategoriesHeaderItem(
|
||||
onTap: () {},
|
||||
text: context.loc.grocery,
|
||||
imageUrl: AppImages.imgGrocery,
|
||||
),
|
||||
],
|
||||
),
|
||||
8.verticalSpace,
|
||||
GridView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: _titles.length,
|
||||
padding: EdgeInsets.zero,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 78 / 100,
|
||||
),
|
||||
itemBuilder: (context, index) => WCategoryItem(
|
||||
onTap: () {
|
||||
if (index == 3) {
|
||||
CategoriesPage().show(context);
|
||||
}
|
||||
},
|
||||
imgUrl: index != 3 ? _images[index] : null,
|
||||
text: _titles[index],
|
||||
child: index == 3
|
||||
? SizedBox(height: 55, width: 55, child: Icon(Icons.more_horiz))
|
||||
: null,
|
||||
),
|
||||
),
|
||||
8.verticalSpace,
|
||||
WDivider()
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15);
|
||||
}
|
||||
}
|
||||
|
||||
List _images = [
|
||||
AppImages.imgConvenience,
|
||||
AppImages.imgAlcohol,
|
||||
AppImages.imgPetSupplies,
|
||||
];
|
||||
@@ -0,0 +1,25 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WDiscountPart extends StatelessWidget {
|
||||
const WDiscountPart({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
scrollDirection: Axis.vertical,
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => WFoodItem(enableTag: true),
|
||||
separatorBuilder: (context, index) => 20.verticalSpace,
|
||||
itemCount: 3,
|
||||
),
|
||||
WDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WHomeHeader extends StatelessWidget {
|
||||
const WHomeHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<HomeBloc, HomeState>(
|
||||
builder: (context, state) {
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(color: AppColors.cFFFFFF),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
15.verticalSpace,
|
||||
Stack(
|
||||
alignment: AlignmentGeometry.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SvgPicture.asset(AppIcons.icLocation, height: 20),
|
||||
8.horizontalSpace,
|
||||
Text("London Hall", style: AppTextStyles.size18Medium),
|
||||
5.horizontalSpace,
|
||||
SvgPicture.asset(AppIcons.icArrowBottom),
|
||||
],
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentGeometry.topRight,
|
||||
child: IconButton(
|
||||
onPressed: () {},
|
||||
icon: SvgPicture.asset(
|
||||
AppIcons.icFilter,
|
||||
height: 36,
|
||||
width: 36,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WOffersCarouselSlider extends StatelessWidget {
|
||||
WOffersCarouselSlider({super.key});
|
||||
|
||||
List _colors = [
|
||||
AppColors.cD2D7F0,
|
||||
AppColors.c9EE2B8,
|
||||
AppColors.cE2CC9E,
|
||||
AppColors.cC99EE2,
|
||||
AppColors.cE29EC7,
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
16.verticalSpace,
|
||||
CarouselSlider.builder(
|
||||
options: CarouselOptions(
|
||||
height: 170.0,
|
||||
reverse: false,
|
||||
viewportFraction: 0.9,
|
||||
animateToClosest: true,
|
||||
autoPlay: true,
|
||||
autoPlayCurve: Curves.easeIn,
|
||||
initialPage: 0,
|
||||
padEnds: false,
|
||||
enableInfiniteScroll: true,
|
||||
scrollPhysics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
),
|
||||
itemBuilder: (context, index, realIndex) => Builder(
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
margin: EdgeInsets.only(left: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: _colors[index],
|
||||
borderRadius: AppUtils.kBorderRadius16,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Order from these restaurants and save",
|
||||
style: AppTextStyles.size17Bold,
|
||||
),
|
||||
const Spacer(),
|
||||
Material(
|
||||
color: AppColors.cTransparent,
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
borderRadius: AppUtils.kBorderRadius30,
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cFFFFFF,
|
||||
borderRadius: AppUtils.kBorderRadius30,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [Text('Browse offer')],
|
||||
).paddingSymmetric(horizontal: 8, vertical: 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 15, vertical: 15),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: AppUtils.kBorderRadiusTop15Bottom15,
|
||||
child: Image.network(
|
||||
AppLocaleKeys.imageUrl,
|
||||
height: 170,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
itemCount: _colors.length,
|
||||
),
|
||||
8.verticalSpace,
|
||||
WDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WPopularNearYou extends StatelessWidget {
|
||||
const WPopularNearYou({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
10.verticalSpace,
|
||||
WSeeAllRaw(title: "Popular near you", onPressed: () {}),
|
||||
10.verticalSpace,
|
||||
CarouselSlider.builder(
|
||||
options: CarouselOptions(
|
||||
height: 180.0,
|
||||
reverse: false,
|
||||
viewportFraction: 0.9,
|
||||
animateToClosest: true,
|
||||
autoPlay: true,
|
||||
autoPlayCurve: Curves.easeIn,
|
||||
initialPage: 0,
|
||||
padEnds: false,
|
||||
enableInfiniteScroll: true,
|
||||
scrollPhysics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
),
|
||||
itemCount: 5,
|
||||
itemBuilder: (context, index, realIndex) {
|
||||
return Builder(
|
||||
builder: (BuildContext context) {
|
||||
return WFoodItem(
|
||||
imageHeight: 130,
|
||||
textStyle1: AppTextStyles.size14Medium,
|
||||
textStyle2: AppTextStyles.size12Regular,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
13.verticalSpace,
|
||||
WDivider(),
|
||||
10.verticalSpace,
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
scrollDirection: Axis.vertical,
|
||||
itemBuilder: (context, index) => WFoodItem(),
|
||||
separatorBuilder: (context, index) => 25.verticalSpace,
|
||||
itemCount: 5,
|
||||
),
|
||||
25.verticalSpace,
|
||||
WDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import '../../../../../../food_delivery_client.dart';
|
||||
|
||||
class WTodayOffers extends StatelessWidget {
|
||||
const WTodayOffers({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
12.verticalSpace,
|
||||
WSeeAllRaw(
|
||||
title: "Today's offers",
|
||||
onPressed: () {},
|
||||
),
|
||||
10.verticalSpace,
|
||||
CarouselSlider.builder(
|
||||
options: CarouselOptions(
|
||||
height: 180.0,
|
||||
reverse: false,
|
||||
viewportFraction: 0.9,
|
||||
animateToClosest: true,
|
||||
autoPlay: true,
|
||||
autoPlayCurve: Curves.easeIn,
|
||||
initialPage: 0,
|
||||
padEnds: false,
|
||||
enableInfiniteScroll: true,
|
||||
scrollPhysics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
),
|
||||
itemCount: 5,
|
||||
itemBuilder: (context, index, realIndex) {
|
||||
return Builder(
|
||||
builder: (BuildContext context) {
|
||||
return WFoodItem(
|
||||
imageHeight: 130,
|
||||
enableTag: true,
|
||||
textStyle1: AppTextStyles.size14Medium,
|
||||
textStyle2: AppTextStyles.size12Regular,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
10.verticalSpace,
|
||||
WDivider(),
|
||||
10.verticalSpace,
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
scrollDirection: Axis.vertical,
|
||||
itemBuilder: (context, index) => WFoodItem(),
|
||||
separatorBuilder: (context, index) => 25.verticalSpace,
|
||||
itemCount: 3,
|
||||
),
|
||||
25.verticalSpace,
|
||||
WDivider()
|
||||
|
||||
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
47
lib/feature/home/presentation/widgets/w_category_item.dart
Normal file
47
lib/feature/home/presentation/widgets/w_category_item.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WCategoryItem extends StatelessWidget {
|
||||
const WCategoryItem({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
this.text,
|
||||
this.imgUrl,
|
||||
this.child,
|
||||
});
|
||||
|
||||
final VoidCallback onTap;
|
||||
final String? text;
|
||||
final String? imgUrl;
|
||||
final Widget? child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius10,
|
||||
color: AppColors.cE6E6E6.newWithOpacity(.4),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 55,
|
||||
width: 55,
|
||||
child: child ?? Image.asset(imgUrl!, fit: BoxFit.cover),
|
||||
).paddingSymmetric(vertical: 8, horizontal: 12),
|
||||
),
|
||||
),
|
||||
3.verticalSpace,
|
||||
if (text != null)
|
||||
Text(
|
||||
text!,
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.size14Medium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
3
lib/feature/main/main.dart
Normal file
3
lib/feature/main/main.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
export 'package:food_delivery_client/feature/main/presentation/pages/main_page/main_page.dart';
|
||||
export 'presentation/mixins/main_page_mixin.dart';
|
||||
export 'package:food_delivery_client/feature/main/presentation/blocs/main_bloc/main_bloc.dart';
|
||||
18
lib/feature/main/presentation/blocs/main_bloc/main_bloc.dart
Normal file
18
lib/feature/main/presentation/blocs/main_bloc/main_bloc.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'main_event.dart';
|
||||
|
||||
part 'main_state.dart';
|
||||
|
||||
part 'main_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class MainBloc extends Bloc<MainEvent, MainState> {
|
||||
MainBloc() : super(const MainState()) {
|
||||
on<_Loaded>((event, emit) {
|
||||
emit(state.copyWith(currentIndex: event.index));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,538 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'main_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$MainEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is MainEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $MainEventCopyWith<$Res> {
|
||||
$MainEventCopyWith(MainEvent _, $Res Function(MainEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [MainEvent].
|
||||
extension MainEventPatterns on MainEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,TResult Function( _Loaded value)? loaded,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,required TResult Function( _Loaded value) loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _Loaded():
|
||||
return loaded(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,TResult? Function( _Loaded value)? loaded,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _Loaded() when loaded != null:
|
||||
return loaded(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,TResult Function( int index)? loaded,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.index);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,required TResult Function( int index) loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _Loaded():
|
||||
return loaded(_that.index);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,TResult? Function( int index)? loaded,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _Loaded() when loaded != null:
|
||||
return loaded(_that.index);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements MainEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Loaded implements MainEvent {
|
||||
const _Loaded(this.index);
|
||||
|
||||
|
||||
final int index;
|
||||
|
||||
/// Create a copy of MainEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoadedCopyWith<_Loaded> get copyWith => __$LoadedCopyWithImpl<_Loaded>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Loaded&&(identical(other.index, index) || other.index == index));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,index);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainEvent.loaded(index: $index)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoadedCopyWith<$Res> implements $MainEventCopyWith<$Res> {
|
||||
factory _$LoadedCopyWith(_Loaded value, $Res Function(_Loaded) _then) = __$LoadedCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int index
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoadedCopyWithImpl<$Res>
|
||||
implements _$LoadedCopyWith<$Res> {
|
||||
__$LoadedCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Loaded _self;
|
||||
final $Res Function(_Loaded) _then;
|
||||
|
||||
/// Create a copy of MainEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') $Res call({Object? index = null,}) {
|
||||
return _then(_Loaded(
|
||||
null == index ? _self.index : index // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MainState {
|
||||
|
||||
RequestStatus get status; int get currentIndex;
|
||||
/// Create a copy of MainState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$MainStateCopyWith<MainState> get copyWith => _$MainStateCopyWithImpl<MainState>(this as MainState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is MainState&&(identical(other.status, status) || other.status == status)&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,currentIndex);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainState(status: $status, currentIndex: $currentIndex)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $MainStateCopyWith<$Res> {
|
||||
factory $MainStateCopyWith(MainState value, $Res Function(MainState) _then) = _$MainStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status, int currentIndex
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$MainStateCopyWithImpl<$Res>
|
||||
implements $MainStateCopyWith<$Res> {
|
||||
_$MainStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final MainState _self;
|
||||
final $Res Function(MainState) _then;
|
||||
|
||||
/// Create a copy of MainState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,Object? currentIndex = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [MainState].
|
||||
extension MainStatePatterns on MainState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MainState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MainState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MainState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status, int currentIndex)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState() when $default != null:
|
||||
return $default(_that.status,_that.currentIndex);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status, int currentIndex) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState():
|
||||
return $default(_that.status,_that.currentIndex);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status, int currentIndex)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainState() when $default != null:
|
||||
return $default(_that.status,_that.currentIndex);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _MainState implements MainState {
|
||||
const _MainState({this.status = RequestStatus.initial, this.currentIndex = 0});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
@override@JsonKey() final int currentIndex;
|
||||
|
||||
/// Create a copy of MainState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$MainStateCopyWith<_MainState> get copyWith => __$MainStateCopyWithImpl<_MainState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MainState&&(identical(other.status, status) || other.status == status)&&(identical(other.currentIndex, currentIndex) || other.currentIndex == currentIndex));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status,currentIndex);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainState(status: $status, currentIndex: $currentIndex)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$MainStateCopyWith<$Res> implements $MainStateCopyWith<$Res> {
|
||||
factory _$MainStateCopyWith(_MainState value, $Res Function(_MainState) _then) = __$MainStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status, int currentIndex
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$MainStateCopyWithImpl<$Res>
|
||||
implements _$MainStateCopyWith<$Res> {
|
||||
__$MainStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _MainState _self;
|
||||
final $Res Function(_MainState) _then;
|
||||
|
||||
/// Create a copy of MainState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,Object? currentIndex = null,}) {
|
||||
return _then(_MainState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,currentIndex: null == currentIndex ? _self.currentIndex : currentIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'main_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class MainEvent with _$MainEvent {
|
||||
const factory MainEvent.started() = _Started;
|
||||
const factory MainEvent.loaded(int index) = _Loaded;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'main_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class MainState with _$MainState {
|
||||
const factory MainState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
@Default(0) int currentIndex,
|
||||
|
||||
}) = _MainState;
|
||||
}
|
||||
28
lib/feature/main/presentation/mixins/main_page_mixin.dart
Normal file
28
lib/feature/main/presentation/mixins/main_page_mixin.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
mixin MainPageMixin {
|
||||
final List<Widget> pages = [
|
||||
HomePage(),
|
||||
BrowsePage(),
|
||||
BasketPage(),
|
||||
AccountPage(),
|
||||
];
|
||||
|
||||
final List<Widget> defaultIcons = [
|
||||
SvgPicture.asset(AppIcons.icHome),
|
||||
SvgPicture.asset(AppIcons.icBrowse),
|
||||
SvgPicture.asset(AppIcons.icBasket),
|
||||
SvgPicture.asset(AppIcons.icAccount),
|
||||
];
|
||||
|
||||
final List<Widget> activeIcons = [
|
||||
SvgPicture.asset(AppIcons.icHomeActive),
|
||||
SvgPicture.asset(AppIcons.icBrowseActive),
|
||||
SvgPicture.asset(AppIcons.icBasketActive),
|
||||
SvgPicture.asset(AppIcons.icAccountActive),
|
||||
];
|
||||
|
||||
final List<String> labels = ["Home", "Browse", "Baskets", 'Account'];
|
||||
}
|
||||
40
lib/feature/main/presentation/pages/main_page/main_page.dart
Normal file
40
lib/feature/main/presentation/pages/main_page/main_page.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class MainPage extends StatelessWidget with MainPageMixin {
|
||||
MainPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<MainBloc>(),
|
||||
child: BlocBuilder<MainBloc, MainState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
index: state.currentIndex,
|
||||
sizing: StackFit.expand,
|
||||
alignment: AlignmentGeometry.center,
|
||||
children: pages,
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
onTap: (value) {
|
||||
context.read<MainBloc>().add(MainEvent.loaded(value));
|
||||
},
|
||||
currentIndex: state.currentIndex,
|
||||
items: List.generate(
|
||||
defaultIcons.length,
|
||||
(index) => BottomNavigationBarItem(
|
||||
icon: defaultIcons[index].paddingOnly(bottom: 4.85),
|
||||
activeIcon: activeIcons[index].paddingOnly(bottom: 4.85),
|
||||
label: labels[index],
|
||||
tooltip: labels[index],
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
0
lib/feature/on_boarding/on_boarding.dart
Normal file
0
lib/feature/on_boarding/on_boarding.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:food_delivery_client/food_delivery_client.dart';
|
||||
|
||||
part 'splash_event.dart';
|
||||
|
||||
part 'splash_state.dart';
|
||||
|
||||
part 'splash_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class SplashBloc extends Bloc<SplashEvent, SplashState> {
|
||||
SplashBloc() : super(const SplashState()) {
|
||||
on<_Started>(_onStarted);
|
||||
}
|
||||
|
||||
Future<void> _onStarted(_Started event, Emitter<SplashState> emit) async {
|
||||
await Future.delayed(TimeDelayConst.duration3);
|
||||
emit(state.copyWith(status: RequestStatus.loaded));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'splash_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$SplashEvent {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SplashEvent);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SplashEvent()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class $SplashEventCopyWith<$Res> {
|
||||
$SplashEventCopyWith(SplashEvent _, $Res Function(SplashEvent) __);
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [SplashEvent].
|
||||
extension SplashEventPatterns on SplashEvent {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>({TResult Function( _Started value)? started,required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>({required TResult Function( _Started value) started,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( _Started value)? started,}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function()? started,required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function() started,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started():
|
||||
return started();case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function()? started,}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _Started() when started != null:
|
||||
return started();case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _Started implements SplashEvent {
|
||||
const _Started();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Started);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SplashEvent.started()';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SplashState {
|
||||
|
||||
RequestStatus get status;
|
||||
/// Create a copy of SplashState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$SplashStateCopyWith<SplashState> get copyWith => _$SplashStateCopyWithImpl<SplashState>(this as SplashState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is SplashState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SplashState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $SplashStateCopyWith<$Res> {
|
||||
factory $SplashStateCopyWith(SplashState value, $Res Function(SplashState) _then) = _$SplashStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$SplashStateCopyWithImpl<$Res>
|
||||
implements $SplashStateCopyWith<$Res> {
|
||||
_$SplashStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final SplashState _self;
|
||||
final $Res Function(SplashState) _then;
|
||||
|
||||
/// Create a copy of SplashState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? status = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [SplashState].
|
||||
extension SplashStatePatterns on SplashState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SplashState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SplashState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SplashState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( RequestStatus status)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( RequestStatus status) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState():
|
||||
return $default(_that.status);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( RequestStatus status)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _SplashState() when $default != null:
|
||||
return $default(_that.status);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _SplashState implements SplashState {
|
||||
const _SplashState({this.status = RequestStatus.initial});
|
||||
|
||||
|
||||
@override@JsonKey() final RequestStatus status;
|
||||
|
||||
/// Create a copy of SplashState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$SplashStateCopyWith<_SplashState> get copyWith => __$SplashStateCopyWithImpl<_SplashState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SplashState&&(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,status);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SplashState(status: $status)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$SplashStateCopyWith<$Res> implements $SplashStateCopyWith<$Res> {
|
||||
factory _$SplashStateCopyWith(_SplashState value, $Res Function(_SplashState) _then) = __$SplashStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
RequestStatus status
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$SplashStateCopyWithImpl<$Res>
|
||||
implements _$SplashStateCopyWith<$Res> {
|
||||
__$SplashStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _SplashState _self;
|
||||
final $Res Function(_SplashState) _then;
|
||||
|
||||
/// Create a copy of SplashState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? status = null,}) {
|
||||
return _then(_SplashState(
|
||||
status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||
as RequestStatus,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,6 @@
|
||||
part of 'splash_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SplashEvent with _$SplashEvent {
|
||||
const factory SplashEvent.started() = _Started;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
part of 'splash_bloc.dart';
|
||||
|
||||
@freezed
|
||||
abstract class SplashState with _$SplashState {
|
||||
const factory SplashState({
|
||||
@Default(RequestStatus.initial) RequestStatus status,
|
||||
}) = _SplashState;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:food_delivery_client/feature/on_boarding/presentation/blocs/splash_bloc/splash_bloc.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class SplashPage extends StatelessWidget {
|
||||
const SplashPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => sl<SplashBloc>()..add(SplashEvent.started()),
|
||||
child: BlocListener<SplashBloc, SplashState>(
|
||||
listener: (context, state) {
|
||||
if (state.status.isLoaded()) {
|
||||
context.go(Routes.main);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.c142328,
|
||||
body: Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(AppIcons.icUber),
|
||||
SvgPicture.asset(AppIcons.icEat),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/food_delivery_client.dart
Normal file
21
lib/food_delivery_client.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
export 'feature/main/main.dart';
|
||||
export 'package:flutter/material.dart';
|
||||
export 'package:get_it/get_it.dart';
|
||||
export 'package:injectable/injectable.dart';
|
||||
export 'package:food_delivery_client/core/router/routes_name.dart';
|
||||
export 'package:go_router/go_router.dart';
|
||||
export 'core/core.dart';
|
||||
export 'feature/common/common.dart';
|
||||
export 'feature/home/home.dart';
|
||||
export 'feature/browse/browse.dart';
|
||||
export 'feature/basket/basket.dart';
|
||||
export 'feature/account/account.dart';
|
||||
export 'package:flutter_bloc/flutter_bloc.dart';
|
||||
export 'package:flutter_localizations/flutter_localizations.dart';
|
||||
export 'package:flutter/services.dart';
|
||||
export 'dart:async';
|
||||
export 'dart:developer' show log;
|
||||
export 'package:freezed_annotation/freezed_annotation.dart';
|
||||
export 'package:shared_preferences/shared_preferences.dart';
|
||||
export 'package:cached_network_image/cached_network_image.dart';
|
||||
export 'package:carousel_slider/carousel_slider.dart';
|
||||
75
lib/main.dart
Normal file
75
lib/main.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
import 'package:food_delivery_client/feature/common/presentation/blocs/language_bloc/language_bloc.dart';
|
||||
|
||||
import 'food_delivery_client.dart';
|
||||
|
||||
void main() {
|
||||
runZonedGuarded(
|
||||
() async{
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
FlutterError.onError = (details) {
|
||||
FlutterError.presentError(details);
|
||||
log("Flutter.onError $details");
|
||||
};
|
||||
Bloc.observer = AppBlocObserver();
|
||||
await configureDependencies();
|
||||
runApp(
|
||||
BlocProvider(create: (context) => sl<LanguageBloc>(), child: MyApp()),
|
||||
);
|
||||
},
|
||||
(error, stack) {
|
||||
log("RunZoneGuard Error $error");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<LanguageBloc, LanguageState>(
|
||||
bloc: context.read<LanguageBloc>()..add(LanguageEvent.started()),
|
||||
builder: (context, state) {
|
||||
return MaterialApp.router(
|
||||
title: "Uber Eats",
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme,
|
||||
routerConfig: sl<AppRoutes>().router,
|
||||
locale: state.currentLocale,
|
||||
supportedLocales: L10n.locales,
|
||||
localizationsDelegates: [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
builder: (context, child) => GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: const TextScaler.linear(1)),
|
||||
child: child!,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user