Skip to content

Instantly share code, notes, and snippets.

View saturov's full-sized avatar

Eugene Saturov saturov

View GitHub Profile
void _applyTemplateData(
Map<Organization, List<Account>> organizationsToAccountsMap,
) {
if (_templateBuy != null) {
_applyTemplateDataBuy(organizationsToAccountsMap, _templateBuy);
} else if (_templateSell != null) {
_applyTemplateDataSell(organizationsToAccountsMap, _templateSell);
}
}
/// Помощник с логикой пагинации
class PaginationHelper<T> {
static const double _defaultPaginationOffset = 50;
/// Смещение от конца прокрутки после которого начинать пагинацию
double paginationOffset;
/// Контроллер прокрутки
ScrollController scrollController;
/// Билдер [WidgetModel] для экрана Дэшборда [DashboardScreen]
DashboardWidgetModel createDashboardScreenWm(BuildContext context) {
final component = Injector.of<DashboardScreenComponent>(context).component;
final dependencies = WidgetModelDependencies(
errorHandler: StandardErrorHandler(
component.messageController,
component.dialogController,
component.sessionInteractor,
component.authInteractor,
///Базовый класс для обработки ошибок, связанных с сервисным слоем
abstract class NetworkErrorHandler implements ErrorHandler {
@override
void handleError(Object error) {
Object e;
bool isSilent = false;
bool isOverlayed = false;
if (error is SilentException) {
e = error.originalError;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// виджет для настройки статус-бара
/// [child] - дочерний виджет для вёрстки всего остального экрана
///
/// [statusBarColor] - цвет статус-бара (по-умолчанию прозрачный)
///
/// [iconTone] - тон иконок в статус-баре (светлые/тёмные)
///
/**
* Виджет "звездного" прогресс-бара.
*
* Для корректной работы необходимо в рантайме задать значение [@see totalProgress], а затем задать
* актуальное значение [@see currentProgress].
*
* Четыре цвета градиента задаются через XML-атрибуты:
* * [@see ProgressStarView_psv_color_start]
* * [@see ProgressStarView_psv_color_middle_1]
* * [@see ProgressStarView_psv_color_middle_2]
if (rateViewInRecyclerView != null) {
val offset: Float
if (rateViewInRecyclerView.top < post_rate_container.top) {
offset = (rateViewInRecyclerView.top - post_rate_container.top).toFloat()
post_rate_container.animate().yBy(offset).setDuration(0)?.start()
}
}
post_content_rv.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
val rateViewInRecyclerView: View? =
postAdapter.stickyLayoutManager.findViewByPosition(postItems.indexOf(rateBaseItem))
if (rateViewInRecyclerView != null) {
if (rateViewInRecyclerView.yLocationInWindow() != 0 &&
(rateViewInRecyclerView.yLocationInWindow() < initialRateViewYPosition)) {
<vector ...>
<path android:name="long-shadow"
android:pathData="...">
<aapt:attr name="android:fillColor">
<gradient
android:type="radial"
android:centerX="54"
android:centerY="54"
android:gradientRadius="76.37">
<!-- 15% black from center to 32% stop -->
{
"data": [
{
"file_source_identifier": null,
"file_creator_id": null,
"workorder_id": 952,
"file_mime": null,
"campaign_uid": "AAAA-BBBB-CCCC",
"file_name": null,
"campaign_state": "campaign_state/open",