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

Test/application: refactoring mock classes #250

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
workflow_dispatch:

env:
flutter_version: "2.10.x"
flutter_version: "3.0.x"
flutter_channel: "stable"
java_version: "12.x"

Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ To generate the OpenSource licenses dart file via [flutter_oss_licenses](https:/

>Note: Run `flutter format .` once [oss_licenses.dart](../lib/presentation/licenses/oss_licenses.dart) is created.
## Running tests and generating Test Report

- Step 1: Just for the 1st time, to make sure that all files are included, run ```./.github/scripts/coverage_gen.sh``` to generate a report for the whole project.
- Step 2: Run ```flutter test --coverage```. This will generate the report locally.
- Step 3: Run ```genhtml coverage/lcov.info -o coverage```.
- Step 4: Run ``` firefox coverage/index.html``` (or run ```coverage/index.html``` to any of your web browser).
#### You should see the coverage of your tests line-wise in Codecov.

## Getting Started with Flutter

A few resources to get you started if this is your first Flutter project:
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/user/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class User with _$User {
@visibleForTesting
// ignore: avoid_positional_boolean_parameters
static Future<String?> getAnonymousIdToken([bool forceRefresh = false]) =>
Future.value(null);
Future.value();

static const User anonymous = User(
id: 'anonymous',
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();
WidgetsBinding.instance?.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
checkAndMaybeShowOnboarding();
});
}
Expand Down
28 changes: 15 additions & 13 deletions lib/presentation/shared_widgets/photo_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,31 @@ class _PhotoSelectorState extends State<PhotoSelector> {

final _compression = 100;
Future<void> _cropImage(XFile image) async {
final File? croppedFile = await ImageCropper.cropImage(
final CroppedFile? croppedFile = await ImageCropper().cropImage(
sourcePath: image.path,
aspectRatio: const CropAspectRatio(ratioX: 1, ratioY: 1),
aspectRatioPresets: [CropAspectRatioPreset.square],
compressFormat: ImageCompressFormat.png,
maxWidth: 1023,
maxHeight: 1023,
compressQuality: _compression,
androidUiSettings: const AndroidUiSettings(
toolbarTitle: 'Profile Photo',
toolbarColor: kAccentColor,
toolbarWidgetColor: Colors.white,
lockAspectRatio: true,
),
iosUiSettings: const IOSUiSettings(
minimumAspectRatio: 1.0,
aspectRatioLockEnabled: true,
title: 'Profile Photo',
),
uiSettings: [
AndroidUiSettings(
toolbarTitle: 'Profile Photo',
toolbarColor: kAccentColor,
toolbarWidgetColor: Colors.white,
lockAspectRatio: true,
),
IOSUiSettings(
minimumAspectRatio: 1.0,
aspectRatioLockEnabled: true,
title: 'Profile Photo',
),
],
);

if (widget.onSelected != null && croppedFile != null) {
widget.onSelected!(croppedFile);
widget.onSelected!(File(croppedFile.path));
}
}

Expand Down
Loading