Skip to content

Commit

Permalink
empty stub ui
Browse files Browse the repository at this point in the history
  • Loading branch information
dinaraparanid committed Jan 15, 2025
1 parent e53e03d commit 0ec7fe0
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 5 deletions.
Binary file added assets/images/anim_bird_empty_stub.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions lib/core/presentation/foundation/app_empty_stub.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:poster/core/presentation/theme/app.dart';
import 'package:poster/core/presentation/theme/images.dart';
import 'package:poster/core/presentation/theme/strings.dart';

final class AppEmptyStub extends StatelessWidget {
static const _stubHeight = 320.0;

const AppEmptyStub({super.key});

@override
Widget build(BuildContext context) {
final theme = context.read<AppTheme>();
final strings = context.strings;

return Column(
children: [
Image.asset(
AppImages.loadGif('anim_bird_empty_stub').value,
height: _stubHeight,
),

SizedBox(height: theme.dimensions.padding.medium),

Text(
strings.stub_empty_title,
style: theme.typography.h.h2.copyWith(
color: theme.colors.text.primary,
fontWeight: FontWeight.w600,
),
),
],
);
}
}
3 changes: 2 additions & 1 deletion lib/core/presentation/post/post_paging_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:poster/core/domain/post/entity/post.dart';
import 'package:poster/core/presentation/foundation/app_empty_stub.dart';
import 'package:poster/core/presentation/post/post_block.dart';
import 'package:poster/core/presentation/theme/app.dart';
import 'package:super_paging/super_paging.dart';
Expand Down Expand Up @@ -37,7 +38,7 @@ final class PostPagingList extends StatelessWidget {
onLike: () => onPostLike(post.id),
);
},
emptyBuilder: (_) => const Text('TODO: empty stub'),
emptyBuilder: (_) => const AppEmptyStub(),
loadingBuilder: (_) => LoadingStub(theme: theme),
errorBuilder: (_, __) => const Text('TODO: error stub'),
);
Expand Down
1 change: 1 addition & 0 deletions lib/core/presentation/theme/images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ class AppImages {
static ImageAsset load(String file) => ImageAsset('assets/images/$file');
static ImageAsset loadPng(String filename) => load('$filename.png');
static ImageAsset loadSvg(String filename) => load('$filename.svg');
static ImageAsset loadGif(String filename) => load('$filename.gif');
}
1 change: 0 additions & 1 deletion lib/data/url.dart

This file was deleted.

3 changes: 3 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"ok": "OK",
"unspecified": "Unspecified",

"stub_empty_title": "No posts yet...",
"stub_error_title": "Something went wrong",

"no_connection_dialog_title": "No internet connection",
"no_connection_dialog_description": "Connect to the network or try again later",

Expand Down
3 changes: 3 additions & 0 deletions lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"ok": "ОК",
"unspecified": "Не указано",

"stub_empty_title": "Здесь пока пусто...",
"stub_error_title": "Что-то пошло не так",

"no_connection_dialog_title": "Нет соединения",
"no_connection_dialog_description": "Подключитесь к сети или попробуйте позже",

Expand Down
4 changes: 2 additions & 2 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -268,7 +268,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1620;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C80D4294CF70F00263BE5 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 0ec7fe0

Please sign in to comment.