From 112995f3442d04bf1b57dbdbb2c75e268afa361c Mon Sep 17 00:00:00 2001 From: Jordy Hershel <49708438+JordyHers@users.noreply.github.com> Date: Mon, 1 May 2023 10:02:46 +0200 Subject: [PATCH 1/6] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 64d2e2a..ef7db75 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,5 @@ # These are supported funding model platforms github: [jordyhers] -patreon: patreon.com/user?u=91968185 +patreon: 91968185 custom: https://paypal.me/JordyHershelIGONDJO?country.x=DE&locale.x=en_US From 0ac3e192aef0eb95d51ac519e7448d65bcf77823 Mon Sep 17 00:00:00 2001 From: Jordy Hershel <49708438+JordyHers@users.noreply.github.com> Date: Mon, 1 May 2023 10:04:28 +0200 Subject: [PATCH 2/6] Update FUNDING.yml --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index ef7db75..602e90e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,3 @@ github: [jordyhers] patreon: 91968185 -custom: https://paypal.me/JordyHershelIGONDJO?country.x=DE&locale.x=en_US From a8f93c85ff5135eb2a605ed3b7b30d79990d17a7 Mon Sep 17 00:00:00 2001 From: Jordy Hershel <49708438+JordyHers@users.noreply.github.com> Date: Mon, 1 May 2023 10:05:31 +0200 Subject: [PATCH 3/6] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 64d2e2a..ef7db75 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,5 @@ # These are supported funding model platforms github: [jordyhers] -patreon: patreon.com/user?u=91968185 +patreon: 91968185 custom: https://paypal.me/JordyHershelIGONDJO?country.x=DE&locale.x=en_US From 09e17f4f549ea139d93897fc2c4b7be67d501daa Mon Sep 17 00:00:00 2001 From: Jordy Hershel <49708438+JordyHers@users.noreply.github.com> Date: Mon, 1 May 2023 10:18:32 +0200 Subject: [PATCH 4/6] Update FUNDING.yml --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1ffd6d7..3c834c3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,6 +2,5 @@ github: [jordyhers] patreon: 91968185 -custom: https://paypal.me/JordyHershelIGONDJO?country.x=DE&locale.x=en_US From c9b0a4884803482dfd83db52be2387cd15ea3f6d Mon Sep 17 00:00:00 2001 From: jordyhers Date: Sun, 7 May 2023 21:02:54 +0200 Subject: [PATCH 5/6] refactor app structure ; improve tests ; implement more logic --- example/pubspec.lock | 16 +++++++++ lib/src/layout/layout_classic.dart | 16 +++++---- lib/src/layout/layout_modern.dart | 26 +++++++------- lib/src/layout/layout_technical.dart | 35 ++++++++++--------- lib/src/utils/helper.dart | 6 ++++ lib/src/utils/strings.dart | 30 ++++++++-------- pubspec.yaml | 12 ++++--- test/src/app.dart | 2 +- .../component/section_bio_container_test.dart | 2 +- test/src/component/section_rating_test.dart | 4 +-- test/src/component/section_shaking_test.dart | 2 +- test/src/layout/layout_business_test.dart | 6 ++-- test/src/layout/layout_classic_test.dart | 29 +++++++++++++-- test/src/layout/layout_modern_test.dart | 29 +++++++++++++-- test/src/layout/layout_technical_test.dart | 29 +++++++++++++-- test/src/mocks/mock_data.dart | 2 +- 16 files changed, 173 insertions(+), 73 deletions(-) create mode 100644 lib/src/utils/helper.dart diff --git a/example/pubspec.lock b/example/pubspec.lock index 78ce66b..8513b45 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -97,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + dio: + dependency: transitive + description: + name: dio + sha256: "0894a098594263fe1caaba3520e3016d8a855caeb010a882273189cca10f11e9" + url: "https://pub.dev" + source: hosted + version: "5.1.1" fake_async: dependency: transitive description: @@ -170,6 +178,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.13.5" + http_mock_adapter: + dependency: transitive + description: + name: http_mock_adapter + sha256: "00f48d69f31d79e389f7a8544b266a214020a8b79d9f376f54e84ae13d3e2965" + url: "https://pub.dev" + source: hosted + version: "0.4.4" http_parser: dependency: transitive description: diff --git a/lib/src/layout/layout_classic.dart b/lib/src/layout/layout_classic.dart index e87e7f2..087ca5a 100644 --- a/lib/src/layout/layout_classic.dart +++ b/lib/src/layout/layout_classic.dart @@ -3,6 +3,7 @@ import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_resume_template/src/components/section_bottom_buttons.dart'; import 'package:flutter_resume_template/src/components/section_rating_widget.dart'; import 'package:flutter_resume_template/src/components/section_shaking.dart'; +import 'package:flutter_resume_template/src/utils/helper.dart'; import 'package:flutter_resume_template/src/utils/strings.dart'; import 'package:flutter_resume_template/src/utils/typedef_utils.dart'; @@ -107,15 +108,16 @@ class _LayoutClassicState extends State { key: globalKey, child: Wrap( children: [ - Container( - height: Config.smallHeight, - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage(Str.backgroundImage), - fit: BoxFit.cover, + if (Helper.isTestMode) + Container( + height: Config.smallHeight, + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(Str.backgroundImage), + fit: BoxFit.cover, + ), ), ), - ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/src/layout/layout_modern.dart b/lib/src/layout/layout_modern.dart index 2896220..f9cf13c 100644 --- a/lib/src/layout/layout_modern.dart +++ b/lib/src/layout/layout_modern.dart @@ -3,6 +3,7 @@ import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_resume_template/src/components/section_bottom_buttons.dart'; import 'package:flutter_resume_template/src/components/section_rating_widget.dart'; import 'package:flutter_resume_template/src/components/section_shaking.dart'; +import 'package:flutter_resume_template/src/utils/helper.dart'; import 'package:flutter_resume_template/src/utils/strings.dart'; import 'package:flutter_resume_template/src/utils/typedef_utils.dart'; @@ -112,18 +113,19 @@ class _LayoutModernState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Config.spaceBox(Config.largeSpacer), - AnimatedShakingBuilder( - autoPlay: isDragged, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network( - widget.data.image ?? Str.resumeHeader, - height: 100, - width: 90, - fit: BoxFit.fitWidth, + if (Helper.isTestMode) + AnimatedShakingBuilder( + autoPlay: isDragged, + child: ClipRRect( + borderRadius: BorderRadius.circular(100.0), + child: Image.network( + widget.data.image ?? Str.resumeHeader, + height: 100, + width: 90, + fit: BoxFit.fitWidth, + ), ), ), - ), Config.spaceBox(Config.smallSpacer), AnimatedShakingBuilder( autoPlay: isDragged, @@ -539,7 +541,7 @@ class _LayoutModernState extends State { ?.copyWith( fontSize: 13, letterSpacing: 0.8, - color: Colors.deepOrange), + color: Colors.grey), )), ), Config.spaceBox(Config.eightPx), @@ -556,7 +558,7 @@ class _LayoutModernState extends State { ?.copyWith( fontSize: 13, letterSpacing: 0.8, - color: Colors.deepOrange), + color: Colors.grey), ), ), ), diff --git a/lib/src/layout/layout_technical.dart b/lib/src/layout/layout_technical.dart index 8bba83b..802565a 100644 --- a/lib/src/layout/layout_technical.dart +++ b/lib/src/layout/layout_technical.dart @@ -3,6 +3,7 @@ import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_resume_template/src/components/section_bottom_buttons.dart'; import 'package:flutter_resume_template/src/components/section_rating_widget.dart'; import 'package:flutter_resume_template/src/components/section_shaking.dart'; +import 'package:flutter_resume_template/src/utils/helper.dart'; import 'package:flutter_resume_template/src/utils/strings.dart'; import 'package:flutter_resume_template/src/utils/typedef_utils.dart'; @@ -110,26 +111,28 @@ class _LayoutTechnicalState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage(Str.backgroundImage), - fit: BoxFit.cover, + if (Helper.isTestMode) + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage(Str.backgroundImage), + fit: BoxFit.cover, + ), ), - ), - child: SizedBox( - width: double.infinity, - height: 400, - child: Container( - alignment: const Alignment(0.0, 1.3), - child: CircleAvatar( - backgroundImage: NetworkImage( - widget.data.image ?? Str.resumeHeader), - radius: 70.0, + child: SizedBox( + width: double.infinity, + height: 400, + child: Container( + alignment: const Alignment(0.0, 1.3), + child: CircleAvatar( + backgroundImage: NetworkImage( + widget.data.image ?? + Str.resumeHeader), + radius: 70.0, + ), ), ), ), - ), Config.spaceBox(60.0), Center( child: AnimatedShakingBuilder( diff --git a/lib/src/utils/helper.dart b/lib/src/utils/helper.dart new file mode 100644 index 0000000..c2bf347 --- /dev/null +++ b/lib/src/utils/helper.dart @@ -0,0 +1,6 @@ +import 'dart:io'; + +class Helper { + static bool get isTestMode => + !Platform.environment.containsKey('FLUTTER_TEST'); +} diff --git a/lib/src/utils/strings.dart b/lib/src/utils/strings.dart index 1e177bf..f309016 100644 --- a/lib/src/utils/strings.dart +++ b/lib/src/utils/strings.dart @@ -8,21 +8,21 @@ class Str { 'My role was to take care of customer related design, improve the quality of the product and be ready to adapt if needed.'; static TemplateData mockData = TemplateData( - fullName: 'Matthew Smith', - currentPosition: 'Service Designer', - street: '63 Fall Street', - address: 'Toronto, ST 12874', - country: 'Canada', - email: 'matthewsmith@join.com', - phoneNumber: '+ 1 (246)869 453 00', - bio: Str.bioText, - experienceTitle: 'Creative Director', - experiencePlace: 'at Uber', - experiencePeriod: 'Sep 2018 - Jan 2020', - experienceLocation: 'New york City', - experienceDescription: Str.myRoleText, - education: 'Yale Gala University', - ); + fullName: 'Matthew Smith', + currentPosition: 'Service Designer', + street: '63 Fall Street', + address: 'Toronto, ST 12874', + country: 'Canada', + email: 'matthewsmith@join.com', + phoneNumber: '+ 1 (246)869 453 00', + bio: Str.bioText, + experienceTitle: 'Creative Director', + experiencePlace: 'at Uber', + experiencePeriod: 'Sep 2018 - Jan 2020', + experienceLocation: 'New york City', + experienceDescription: Str.myRoleText, + education: 'Yale Gala University', + image: resumeHeader); static String backgroundImage = 'https://images.pexels.com/photos/10319780/pexels-photo-10319780.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2'; static String resumeHeader = diff --git a/pubspec.yaml b/pubspec.yaml index 5a50d1e..335ea52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,10 +2,11 @@ name: flutter_resume_template #description of the package description: >- - The flutter_resume_template plugin provides a customizable resume template that can be easily - integrated into a Flutter application. This plugin provides a FlutterResumeTemplate widget that - takes four parameters, withButtons, TemplateData, OnEmpty(), and style, to customize the - template according to your needs. + The flutter_resume_template plugin provides a customizable resume template + that can be easily integrated into a Flutter application. + This plugin provides a FlutterResumeTemplate widget that takes the parameters, + TemplateMode, TemplateTheme, onSaveResume, TemplateData and onEmpty(), + to customize the template according to your needs. #Version to be released version: 1.0.0 @@ -17,7 +18,7 @@ homepage: https://github.com/JordyHers/flutter_resume_template repository: https://github.com/JordyHers/flutter_resume_template #remove that when the package is ready to be published -publish_to: none +#publish_to: none #funding url funding: @@ -43,6 +44,7 @@ dependencies: google_fonts: ^4.0.3 auto_size_text: ^3.0.0 flutter_shake_animated: ^0.0.5 + http_mock_adapter: ^0.4.4 #logic package pdf: ^3.10.1 diff --git a/test/src/app.dart b/test/src/app.dart index 7df8121..74443a8 100644 --- a/test/src/app.dart +++ b/test/src/app.dart @@ -26,7 +26,7 @@ class Launch { ), ); - static pumpWidget(Widget child) => MaterialApp( + static Future pumpWidget(Widget child) async => MaterialApp( home: Scaffold(body: child), ); } diff --git a/test/src/component/section_bio_container_test.dart b/test/src/component/section_bio_container_test.dart index 37e9c08..6c49ee0 100644 --- a/test/src/component/section_bio_container_test.dart +++ b/test/src/component/section_bio_container_test.dart @@ -11,7 +11,7 @@ void main() { child: Text('child'), ); // Create a test widget that has SbContainer with a Text widget as its child - final widget = Launch.pumpWidget(passedChild); + final widget = await Launch.pumpWidget(passedChild); // Build the widget tree await tester.pumpWidget(widget); diff --git a/test/src/component/section_rating_test.dart b/test/src/component/section_rating_test.dart index 2df5669..6f41e28 100644 --- a/test/src/component/section_rating_test.dart +++ b/test/src/component/section_rating_test.dart @@ -8,8 +8,8 @@ void main() { testWidgets('RatingWidget displays correct number of filled stars', (WidgetTester tester) async { // Build the RatingWidget with a rating of 3 - await tester.pumpWidget( - Launch.pumpWidget(const RatingWidget(rating: 3, title: 'English'))); + await tester.pumpWidget(await Launch.pumpWidget( + const RatingWidget(rating: 3, title: 'English'))); // Verify that the RatingWidget contains 3 filled stars and 2 empty stars expect(find.byIcon(Icons.star), findsNWidgets(3)); diff --git a/test/src/component/section_shaking_test.dart b/test/src/component/section_shaking_test.dart index eeb7022..59cd53e 100644 --- a/test/src/component/section_shaking_test.dart +++ b/test/src/component/section_shaking_test.dart @@ -10,7 +10,7 @@ void main() { testWidgets('AnimatedShakingBuilder applies ShakeWidget to child', (WidgetTester tester) async { // Build the AnimatedShakingBuilder with autoPlay set to true - await tester.pumpWidget(Launch.pumpWidget( + await tester.pumpWidget(await Launch.pumpWidget( const AnimatedShakingBuilder( autoPlay: true, child: Text('Hello, world!'), diff --git a/test/src/layout/layout_business_test.dart b/test/src/layout/layout_business_test.dart index f5bc570..85c35de 100644 --- a/test/src/layout/layout_business_test.dart +++ b/test/src/layout/layout_business_test.dart @@ -1,8 +1,8 @@ import 'package:flutter_resume_template/flutter_resume_template.dart'; -import 'package:flutter_resume_template/src/utils/strings.dart'; import 'package:flutter_test/flutter_test.dart'; import '../app.dart'; +import '../mocks/mock_data.dart'; void main() { testWidgets('Test launching widget and shaking children widgets', @@ -10,12 +10,12 @@ void main() { // Create the widget that contains the button to test final testWidget = Launch.pumpWidget(LayoutBusiness( mode: TemplateMode.shakeEditAndSaveMode, - data: Str.mockData, + data: MockData.data, h: 1000, w: 1000)); // Launch the widget - await tester.pumpWidget(testWidget); + await tester.pumpWidget(await testWidget); // Verify that the widget is displayed on the screen expect(find.text('Animate'), findsOneWidget); diff --git a/test/src/layout/layout_classic_test.dart b/test/src/layout/layout_classic_test.dart index 49b6825..659f041 100644 --- a/test/src/layout/layout_classic_test.dart +++ b/test/src/layout/layout_classic_test.dart @@ -1,8 +1,31 @@ +import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../app.dart'; +import '../mocks/mock_data.dart'; + void main() { - test('This test will always pass', () { - // This test doesn't actually test anything, but it will always pass - expect(1 + 1, equals(2)); + testWidgets('Test launching widget and shaking children widgets', + (WidgetTester tester) async { + // Create the widget that contains the button to test + final testWidget = Launch.pumpWidget(LayoutClassic( + mode: TemplateMode.shakeEditAndSaveMode, + data: MockData.data, + h: 1000, + w: 1000)); + + // Launch the widget + await tester.pumpWidget(await testWidget); + + // Verify that the widget is displayed on the screen + expectLater(find.text('Animate'), findsOneWidget); + + // Pan the widget to the right + final gesture = await tester.startGesture(Offset.zero); + await gesture.moveBy(const Offset(200, 0)); + await gesture.up(); + + // Tap the button + await tester.tap(find.text('Animate')); }); } diff --git a/test/src/layout/layout_modern_test.dart b/test/src/layout/layout_modern_test.dart index 49b6825..f20f19a 100644 --- a/test/src/layout/layout_modern_test.dart +++ b/test/src/layout/layout_modern_test.dart @@ -1,8 +1,31 @@ +import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../app.dart'; +import '../mocks/mock_data.dart'; + void main() { - test('This test will always pass', () { - // This test doesn't actually test anything, but it will always pass - expect(1 + 1, equals(2)); + testWidgets('Test launching widget and shaking children widgets', + (WidgetTester tester) async { + // Create the widget that contains the button to test + final testWidget = Launch.pumpWidget(LayoutModern( + mode: TemplateMode.shakeEditAndSaveMode, + data: MockData.data, + h: 1000, + w: 1000)); + + // Launch the widget + await tester.pumpWidget(await testWidget); + + // Verify that the widget is displayed on the screen + expectLater(find.text('Animate'), findsOneWidget); + + // Pan the widget to the right + final gesture = await tester.startGesture(Offset.zero); + await gesture.moveBy(const Offset(200, 0)); + await gesture.up(); + + // Tap the button + await tester.tap(find.text('Animate')); }); } diff --git a/test/src/layout/layout_technical_test.dart b/test/src/layout/layout_technical_test.dart index 49b6825..5a7674a 100644 --- a/test/src/layout/layout_technical_test.dart +++ b/test/src/layout/layout_technical_test.dart @@ -1,8 +1,31 @@ +import 'package:flutter_resume_template/flutter_resume_template.dart'; import 'package:flutter_test/flutter_test.dart'; +import '../app.dart'; +import '../mocks/mock_data.dart'; + void main() { - test('This test will always pass', () { - // This test doesn't actually test anything, but it will always pass - expect(1 + 1, equals(2)); + testWidgets('Test launching widget and shaking children widgets', + (WidgetTester tester) async { + // Create the widget that contains the button to test + final testWidget = Launch.pumpWidget(LayoutTechnical( + mode: TemplateMode.shakeEditAndSaveMode, + data: MockData.data, + h: 1000, + w: 1000)); + + // Launch the widget + await tester.pumpWidget(await testWidget); + + // Verify that the widget is displayed on the screen + expectLater(find.text('Animate'), findsOneWidget); + + // Pan the widget to the right + final gesture = await tester.startGesture(Offset.zero); + await gesture.moveBy(const Offset(200, 0)); + await gesture.up(); + + // Tap the button + await tester.tap(find.text('Animate')); }); } diff --git a/test/src/mocks/mock_data.dart b/test/src/mocks/mock_data.dart index 27675d3..977655b 100644 --- a/test/src/mocks/mock_data.dart +++ b/test/src/mocks/mock_data.dart @@ -1,7 +1,7 @@ import 'package:flutter_resume_template/flutter_resume_template.dart'; class MockData { - TemplateData data = TemplateData( + static TemplateData data = TemplateData( fullName: 'Jordy Hershel Igondjo', currentPosition: 'Flutter Developer', street: 'Curvy Str. 53', From ea3d5e34e4b29878b1f33149654cd2ea89b9cdac Mon Sep 17 00:00:00 2001 From: jordyhers Date: Sun, 7 May 2023 21:04:17 +0200 Subject: [PATCH 6/6] documentation: set up CHANGELOG.md --- CHANGELOG.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41cc7d8..ee0fa29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ -## 0.0.1 +## 1.0.0 + +* Initial release of the project +* Added basic project structure and files +* Implemented core functionality of the application +* Created user interface for the application + + + -* TODO: Describe initial release.