home screen developed

This commit is contained in:
Komek Hayytnazarov 2023-05-10 09:58:40 +05:00
parent 0ad4fa8dee
commit 5a58640510
4 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,10 @@ class CategoryApi {
static List<CategoryModel> get categories => [..._categories];
static void clearCategories() {
_categories.clear();
}
static Future<List<CategoryModel>> getDescendantCategories(Map<String, dynamic> params) async {
if (_categories.length == 0) {
try {

View File

@ -173,4 +173,5 @@ class OrderApi {
return null;
}
}
}

View File

@ -65,6 +65,7 @@ class _CarouselWidgetState extends State<CarouselWidget> {
onTap: () {
if (slider.path.trim().length != 0) {
debugPrint('slider path: ${slider.path}');
debugPrint('slider id: ${slider.id}');
final params = slider.path.split('=');
final args = {
'type': params.first,

View File

@ -1,5 +1,7 @@
import 'package:elektronika/app/pages/category/controller.dart';
import 'package:get/get.dart';
import '../../../../app.dart';
import '../../../home/controller.dart';
class LanguageController extends GetxController {
List<LanguageModel> languages = [...LocalizationService.langs];
@ -16,10 +18,20 @@ class LanguageController extends GetxController {
groupValue.value = newValue.id;
LocalizationService().changeLocale(newValue.code);
setLocale(newValue.code);
resetLocaleSavedData();
}
Future<void> getCurrentLocale() async {
final locale = await getLocale();
groupValue.value = locale == 'tm' ? 1 : 2;
}
Future<void> resetLocaleSavedData() async {
await Get.delete<SettingsController>();
SliderApi.sliders.clear();
CategoryApi.categories.clear();
CategoryApi.clearCategories();
}
}