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

Dev #17

Merged
merged 5 commits into from
Apr 29, 2023
Merged

Dev #17

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
Binary file added assets/fashion/adidas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/balenciaga.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/calvinklein.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/chanel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/diesel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/dior.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/dolce&gabbana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/emporioArmani.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/esteeLauder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/gap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/giorgioArmani.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/givenchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/gucci.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/h&m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/jeanpaulgauthier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/jordan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/lacoste.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/levis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/loreal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/mango.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/maybelline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/michaelKors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/nike.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/prada.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fashion/puma.png
Binary file added assets/fashion/timberland.png
Binary file added assets/fashion/tommyHilfiger.png
Binary file added assets/fashion/vans.png
Binary file added assets/fashion/versace.png
Binary file added assets/fashion/zara.png
38 changes: 32 additions & 6 deletions lib/src/abstract/abstract.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,38 @@ class AssetPath {
abstract class SportsInterface {}

abstract class FashionInterface {
// Loreal,
// lVMH, JeanPaul Gauthier - Dior - Armani -
// Balenciaga,
// H&M,
// Zara,
// etc...
// adidas,
// calvinKlein,
// diesel,
// dolceGabbana,
// emporioArmani,
// gap,
// giorgioArmani,
// givenchy,
// hm,
// jeanPaulGauthier,
// jordan,
// lacoste,
// levis,
// mango,
// michaelKors,
// nike,
// puma,
// timberland,
// tommyHilfiger,
// vans,
// balenciaga,
// chanel,
// dior,
// gucci,
// louisVuitton,
// prada,
// versace,
// esteeLauder,
// loreal,
// maybelline,
// mac,
// zara,
}

abstract class TechInterface {
Expand Down
93 changes: 77 additions & 16 deletions lib/src/model/fashion/fashion.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import 'package:flutter/material.dart';
import 'package:flutter_any_logo/src/abstract/abstract.dart';

//TODO : Implement all png images
//TODO : Update all list in abstract class
//TODO : Implement values and image builder
//TODO : Set them inn alphabetical order

class Fashion extends FashionInterface {
static List<AssetImage> get values => <AssetImage>[
adidas,
calvinKlein,
diesel,
dolceGabbana,
emporioArmani,
gap,
giorgioArmani,
givenchy,
hm,
jeanPaulGauthier,
jordan,
lacoste,
levis,
mango,
michaelKors,
nike,
puma,
timberland,
tommyHilfiger,
vans,
balenciaga,
chanel,
dior,
Expand All @@ -17,7 +32,6 @@ class Fashion extends FashionInterface {
versace,
esteeLauder,
loreal,
lVMH,
maybelline,
mac,
zara,
Expand All @@ -29,35 +43,82 @@ class Fashion extends FashionInterface {
);
}).toList();

static AssetImage adidas = const AssetImage('${AssetPath.fashion}adidas.png');

static AssetImage balenciaga =
const AssetImage('${AssetPath.fashion}balenciaga.png');

static AssetImage calvinKlein =
const AssetImage('${AssetPath.fashion}calvinklein.png');

static AssetImage chanel = const AssetImage('${AssetPath.fashion}chanel.png');

static AssetImage diesel = const AssetImage('${AssetPath.fashion}diesel.png');

static AssetImage dior = const AssetImage('${AssetPath.fashion}dior.png');

static AssetImage dolceGabbana =
const AssetImage('${AssetPath.fashion}dolce&gabbana.png');

static AssetImage emporioArmani =
const AssetImage('${AssetPath.fashion}emporioArmani.png');

static AssetImage esteeLauder =
const AssetImage('${AssetPath.fashion}esteeLauder.png');

static AssetImage gap = const AssetImage('${AssetPath.fashion}gap.png');

static AssetImage giorgioArmani =
const AssetImage('${AssetPath.fashion}giorgioArmani.png');

static AssetImage givenchy =
const AssetImage('${AssetPath.fashion}givenchy.png');

static AssetImage gucci = const AssetImage('${AssetPath.fashion}gucci.png');

static AssetImage louisVuitton =
const AssetImage('${AssetPath.fashion}louisVuitton.png');
static AssetImage hm = const AssetImage('${AssetPath.fashion}h&m.png');

static AssetImage prada = const AssetImage('${AssetPath.fashion}prada.png');
static AssetImage jeanPaulGauthier =
const AssetImage('${AssetPath.fashion}jeanpaulgauthier.png');

static AssetImage versace =
const AssetImage('${AssetPath.fashion}versace.png');
static AssetImage jordan = const AssetImage('${AssetPath.fashion}jordan.png');

static AssetImage esteeLauder =
const AssetImage('${AssetPath.fashion}esteeLauder.png');
static AssetImage lacoste =
const AssetImage('${AssetPath.fashion}lacoste.png');

static AssetImage levis = const AssetImage('${AssetPath.fashion}levis.png');

static AssetImage loreal = const AssetImage('${AssetPath.fashion}loreal.png');

static AssetImage lVMH =
static AssetImage louisVuitton =
const AssetImage('${AssetPath.fashion}louisVuitton.png');

static AssetImage mac = const AssetImage('${AssetPath.fashion}mac.png');

static AssetImage mango = const AssetImage('${AssetPath.fashion}mango.png');

static AssetImage maybelline =
const AssetImage('${AssetPath.fashion}maybelline.png');

static AssetImage mac = const AssetImage('${AssetPath.fashion}mac.png');
static AssetImage michaelKors =
const AssetImage('${AssetPath.fashion}michaelKors.png');

static AssetImage nike = const AssetImage('${AssetPath.fashion}nike.png');

static AssetImage prada = const AssetImage('${AssetPath.fashion}prada.png');

static AssetImage puma = const AssetImage('${AssetPath.fashion}puma.png');

static AssetImage timberland =
const AssetImage('${AssetPath.fashion}timberland.png');

static AssetImage tommyHilfiger =
const AssetImage('${AssetPath.fashion}tommyHilfiger.png');

static AssetImage vans = const AssetImage('${AssetPath.fashion}vans.png');

static AssetImage versace =
const AssetImage('${AssetPath.fashion}versace.png');

static AssetImage zara = const AssetImage('${AssetPath.fashion}mac.png');
static AssetImage zara = const AssetImage('${AssetPath.fashion}zara.png');
}
2 changes: 1 addition & 1 deletion lib/src/model/sports/football.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ class UEFA extends Football {
marseille,
rbLeipzig,
toulouse,
watford,
valencia,
galatasaray,
fenerbahce,
shalke04,
watford,
];

static List<Widget> get images => values.map((AssetImage index) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/model/tech/tech.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter_any_logo/src/abstract/abstract.dart';

class Tech extends TechInterface {
static List<AssetImage> get values => <AssetImage>[
xiaomi,
xbox,
microsoft,
meta,
Expand All @@ -16,7 +15,8 @@ class Tech extends TechInterface {
apple,
samsung,
lenovo,
paypal
paypal,
xiaomi,
];

static List<Widget> get images => values.map((AssetImage index) {
Expand Down
30 changes: 30 additions & 0 deletions test/categories/fashion_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:flutter_any_logo/flutter_logo.dart';
import 'package:flutter_test/flutter_test.dart';

import '../helpers/constants.dart';
import '../helpers/helpers.dart';
import '../helpers/pump_widget.dart';

void main() {
group('Fashion List Tests', () {
testWidgets('Verify All Logos Should load', (WidgetTester tester) async {
await tester.pumpWidget(PumpWidget.fashion);
// Verify that all logo launch
final int number = LogoTest.numberOfLogos(Const.fashion);
expect(find.byType(Image, skipOffstage: false), findsNWidgets(number));
});

testWidgets('Verify no exception is thrown', (WidgetTester tester) async {
await tester.pumpWidget(PumpWidget.fashion);
LogoTest.testException(tester);
});

testWidgets(
'Verify the last item displayed is the same as the last in the list',
(WidgetTester tester) async {
await tester.pumpWidget(PumpWidget.fashion);
LogoTest.testDisplayedLogos(tester, Fashion.values);
});
});
}
14 changes: 10 additions & 4 deletions test/helpers/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,23 @@ class LogoTest {
expect(tester.takeException(), isNull);

// Scroll up
await tester.fling(find.byType(ListView), const Offset(0, -12000), 3000);
await tester.fling(find.byType(ListView), const Offset(0, -102000), 3000);
await tester.pumpAndSettle();
await tester.fling(find.byType(ListView), const Offset(0, -12000), 3000);

final Finder listViewFinder = find.byType(ListView);
expect(listViewFinder, findsOneWidget);

await tester.pumpAndSettle();

// Verify that the last item displayed after scrolling up is the same as t
// he item at the last index
final Finder lastItemFinder = find.byType(Image).last;

final Finder lastItemFinder = find.byType(Image, skipOffstage: false).last;
final ImageProvider<Object> lastItem =
tester.widget<Image>(lastItemFinder).image;
final AssetImage lastImage = items.last;
items.sort(
(AssetImage a, AssetImage b) => b.assetName.compareTo(a.assetName));
final AssetImage lastImage = items.first;
expectLater(lastItem.toString(), equals(lastImage.toString()));
}
}