Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add empty view/no data widget #339

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/images/undraw_no_data.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions lib/core/widgets/components/empty_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class EmptyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: [
Spacer(),
SvgPicture.asset(
'images/undraw_no_data.svg',
height: 200,
width: 200,
),
SizedBox(
height: 20,
),
Text(
"No Data Found",
style: TextStyle(
color: Colors.blue,
fontSize: 25
),
),
Spacer()
],
),
);
}
}
3 changes: 2 additions & 1 deletion lib/features/devboard/devs/devs_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:devs/core/constant/colors.dart';
import 'package:devs/core/constant/string.dart';
import 'package:devs/core/models/dev.dart';
import 'package:devs/core/widgets/components/empty_widget.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
Expand All @@ -17,7 +18,7 @@ class DevsList extends StatelessWidget {
Widget build(BuildContext context) {
var itemSizeWidth = MediaQuery.of(context).size.width;
if (devs.isEmpty) {
return Text('No devs found');
return EmptyWidget();
}

/// Sort dev's ascending
Expand Down
37 changes: 36 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.20.0-nullsafety.3"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -170,6 +177,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0-nullsafety.0"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0-nullsafety.0"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -212,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0-nullsafety.1"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -364,6 +392,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0-nullsafety.1"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0"
flutter: ">=1.24.0-7.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
provider: ^4.3.3
font_awesome_flutter: ^8.11.0
url_launcher: ^5.7.10
flutter_svg: ^0.20.0-nullsafety.3

dev_dependencies:
flutter_test:
Expand Down