Initial commit

This commit is contained in:
jahongireshonqulov
2025-10-18 09:40:06 +05:00
commit 1bf3e41abe
352 changed files with 16315 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import '../../router/app_routes.dart';
import '../entity/name/name_entity.dart';
import '../models/name.dart';
class Functions {
static String getTranslatedItem(NameEntity? name, BuildContext context) {
var local = Localizations.localeOf(context);
switch (local.languageCode) {
case 'uz':
{
return name?.uz ?? " ";
}
case "ru":
{
return name?.ru ?? " ";
}
case "zh":
{
return name?.zh ?? " ";
}
default:
{
return name?.uz ?? " ";
}
}
}
static String getTranslatedNameModel(Name? name, BuildContext context) {
var local = Localizations.localeOf(context);
switch (local.languageCode) {
case 'uz':
{
return name?.uz ?? " ";
}
case "ru":
{
return name?.ru ?? " ";
}
case "zh":
{
return name?.zh ?? " ";
}
default:
{
return name?.uz ?? " ";
}
}
}
static void showErrorSnackBar(String message) {
final snackBar = SnackBar(
backgroundColor: Colors.red,
content: Row(
children: [
const Icon(Icons.error, color: Colors.white),
const SizedBox(width: 8),
Expanded(
child: Text(
message,
style: const TextStyle(color: Colors.white),
),
),
],
),
behavior: SnackBarBehavior.floating,
duration: const Duration(seconds: 3),
);
ScaffoldMessenger.of(
rootNavigatorKey.currentContext!,
).showSnackBar(snackBar);
}
}

View File

@@ -0,0 +1,13 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
class Debouncer {
static Timer? _timer;
static run(VoidCallback action) {
if (null != _timer) {
_timer?.cancel();
}
_timer = Timer(const Duration(milliseconds: 600), action);
}
}