Skip to content

Commit

Permalink
loader update
Browse files Browse the repository at this point in the history
  • Loading branch information
mirmoktadir committed Feb 2, 2023
1 parent c0bad0c commit 17b1475
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 43 deletions.
2 changes: 1 addition & 1 deletion animations/error.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions animations/loader.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PODS:
- awesome_notifications (0.0.5):
- Flutter
- IosAwnCore (= 0.7.3)
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
Expand Down Expand Up @@ -104,6 +107,7 @@ PODS:
- Flutter
- FlutterMacOS
- PromisesObjC (2.1.1)
- ReachabilitySwift (5.0.0)
- SDWebImage (5.15.0):
- SDWebImage/Core (= 5.15.0)
- SDWebImage/Core (5.15.0)
Expand All @@ -114,6 +118,7 @@ PODS:

DEPENDENCIES:
- awesome_notifications (from `.symlinks/plugins/awesome_notifications/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
Expand All @@ -137,12 +142,15 @@ SPEC REPOS:
- IosAwnCore
- nanopb
- PromisesObjC
- ReachabilitySwift
- SDWebImage
- SwiftyGif

EXTERNAL SOURCES:
awesome_notifications:
:path: ".symlinks/plugins/awesome_notifications/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
firebase_core:
Expand All @@ -162,6 +170,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
awesome_notifications: d63d9a25f126860f9a600850d99772237895b3ba
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Expand All @@ -181,6 +190,7 @@ SPEC CHECKSUMS:
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: 9bec4c5cdd9579e1f57104735ee0c37df274d593
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Expand Down
42 changes: 30 additions & 12 deletions lib/app/components/empty_widget.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:iconly/iconly.dart';
import 'package:iconsax/iconsax.dart';
import 'package:ionicons/ionicons.dart';
import 'package:lottie/lottie.dart';

class EmptyWidget extends StatelessWidget {
const EmptyWidget({
Key? key,
}) : super(key: key);

const EmptyWidget({Key? key, required this.onPressed}) : super(key: key);
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
Expand All @@ -18,20 +19,37 @@ class EmptyWidget extends StatelessWidget {
children: [
Lottie.asset(
'animations/error.json',
height: 180.h,
height: 170.h,
repeat: true,
reverse: true,
fit: BoxFit.cover,
),
Center(
child: Text(
"Empty or No data !",
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w400,
color: theme.hintColor,
child: Text(
"Empty or No data !",
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w400,
color: theme.hintColor,
),
),
))
),
SizedBox(height: 40.h),
SizedBox(
height: 52.h,
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey.shade50,
elevation: 4,
shadowColor: theme.primaryColor,
),
child: Icon(
Ionicons.refresh,
size: 32,
color: theme.primaryColor,
)),
)
],
),
);
Expand Down
59 changes: 32 additions & 27 deletions lib/app/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,38 @@ class HomeView extends GetView<HomeController> {
centerTitle: true,
),
body: Obx(() => controller.postList.isEmpty
? const EmptyWidget()
: Padding(
padding: const EdgeInsets.all(18.0),
child: RawScrollbar(
thumbColor: theme.primaryColor,
radius: const Radius.circular(100),
thickness: 5,
interactive: true,
child: ListView.separated(
itemCount: controller.postList.length,
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.zero,
separatorBuilder: (_, __) => SizedBox(
height: 20.h,
),
itemBuilder: (ctx, index) => Container(
padding: const EdgeInsets.all(5),
width: double.infinity,
color: theme.canvasColor,
child: Center(
child: Text(
controller.postList[index].title ?? "",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: MyFonts.headline6TextSize,
fontWeight: FontWeight.w500,
color: theme.primaryColor,
? EmptyWidget(
onPressed: () async => await controller.getPostList(),
)
: RefreshIndicator(
onRefresh: () async => await controller.getPostList(),
child: Padding(
padding: const EdgeInsets.all(18.0),
child: RawScrollbar(
thumbColor: theme.primaryColor,
radius: const Radius.circular(100),
thickness: 5,
interactive: true,
child: ListView.separated(
itemCount: controller.postList.length,
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.zero,
separatorBuilder: (_, __) => SizedBox(
height: 20.h,
),
itemBuilder: (ctx, index) => Container(
padding: const EdgeInsets.all(5),
width: double.infinity,
color: theme.canvasColor,
child: Center(
child: Text(
controller.postList[index].title ?? "",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: MyFonts.headline6TextSize,
fontWeight: FontWeight.w500,
color: theme.primaryColor,
),
),
),
),
Expand Down
12 changes: 9 additions & 3 deletions lib/app/service/helper/dialog_helper.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';

class DialogHelper {
//show error dialog
Expand Down Expand Up @@ -44,9 +46,13 @@ class DialogHelper {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const CircularProgressIndicator(),
const SizedBox(height: 8),
Text(message ?? 'Loading...'),
Lottie.asset(
'animations/loader.json',
height: 170.h,
repeat: true,
reverse: true,
fit: BoxFit.cover,
),
],
),
),
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
ionicons:
dependency: "direct main"
description:
name: ionicons
sha256: "5496bc65a16115ecf05b15b78f494ee4a8869504357668f0a11d689e970523cf"
url: "https://pub.dev"
source: hosted
version: "0.2.2"
js:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ dependencies:

flutter:
sdk: flutter
ionicons: ^0.2.2


dev_dependencies:
mockito:
Expand Down

0 comments on commit 17b1475

Please sign in to comment.