Skip to content
Merged
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Changelog

## 0.0.12
* Updated dependencies
* Added test_util: catch presentation event helper, DeviceSizes
* Added typedef for single bool methods.
* Updated formatting
* exported more files

## 0.0.11
Added optional secondary, secondaryFill, tertiary and tertiaryFill ColorGroups to the Kleurplaat

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Dutch Coding Company B.V.
Copyright (c) 2025 Dutch Coding Company B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
include: package:very_good_analysis/analysis_options.yaml

formatter:
page_width: 120

linter:
rules:
lines_longer_than_80_chars: false
require_trailing_commas: false
analyzer:
errors:
missing_return: error
Expand Down
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
14 changes: 6 additions & 8 deletions example/lib/core/modules/chopper_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import 'package:injectable/injectable.dart';
abstract class ChopperModule {
@lazySingleton
ChopperClient chopper() => ChopperClient(
converter: const JsonSerializableConverter(_factories),
interceptors: [
// We want to disable logging in release mode because it could leak sensitive information
if (kDebugMode) ...[
HttpLoggingInterceptor(),
],
],
);
converter: const JsonSerializableConverter(_factories),
interceptors: [
// We want to disable logging in release mode because it could leak sensitive information
if (kDebugMode) ...[HttpLoggingInterceptor()],
],
);
}

const _factories = {
Expand Down
34 changes: 20 additions & 14 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,31 @@ class MyHomePage extends StatelessWidget {
child: Column(
children: [
ElevatedButton(
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => UserPage(
onCreateCubit: (context) =>
getIt<UserCubit>()..getRandomUser(),
onPressed:
() => Navigator.of(context).push(
MaterialPageRoute(
builder:
(context) => UserPage(
onCreateCubit:
(context) =>
getIt<UserCubit>()..getRandomUser(),
),
),
),
),
),
child: const Text('Get user succesfully'),
),
ElevatedButton(
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => UserPage(
onCreateCubit: (context) =>
getIt<UserCubit>()..getRandomUserFails(),
onPressed:
() => Navigator.of(context).push(
MaterialPageRoute(
builder:
(context) => UserPage(
onCreateCubit:
(context) =>
getIt<UserCubit>()..getRandomUserFails(),
),
),
),
),
),
child: const Text('Get user fails'),
),
],
Expand Down
7 changes: 3 additions & 4 deletions example/lib/profile/data/model/api_user_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ part 'api_user_response.freezed.dart';
part 'api_user_response.g.dart';

@freezed
class ApiUserResponse with _$ApiUserResponse {
const factory ApiUserResponse({
required List<User> results,
}) = _ApiUserResponse;
sealed class ApiUserResponse with _$ApiUserResponse {
const factory ApiUserResponse({required List<User> results}) =
_ApiUserResponse;

factory ApiUserResponse.fromJson(Map<String, dynamic> json) =>
_$ApiUserResponseFromJson(json);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/profile/data/model/location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ part 'location.freezed.dart';
part 'location.g.dart';

@freezed
class Location with _$Location {
sealed class Location with _$Location {
const factory Location({
required Street street,
required String city,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/profile/data/model/name.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part 'name.freezed.dart';
part 'name.g.dart';

@freezed
class Name with _$Name {
sealed class Name with _$Name {
const factory Name({
required String title,
required String first,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/profile/data/model/picture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part 'picture.freezed.dart';
part 'picture.g.dart';

@freezed
class Picture with _$Picture {
sealed class Picture with _$Picture {
const factory Picture({
required String large,
required String medium,
Expand Down
7 changes: 2 additions & 5 deletions example/lib/profile/data/model/street.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ part 'street.freezed.dart';
part 'street.g.dart';

@freezed
class Street with _$Street {
const factory Street({
required int number,
required String name,
}) = _Street;
sealed class Street with _$Street {
const factory Street({required int number, required String name}) = _Street;

factory Street.fromJson(Map<String, dynamic> json) => _$StreetFromJson(json);
}
2 changes: 1 addition & 1 deletion example/lib/profile/data/model/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ part 'user.freezed.dart';
part 'user.g.dart';

@freezed
class User with _$User {
sealed class User with _$User {
const factory User({
required String gender,
required Name name,
Expand Down
4 changes: 2 additions & 2 deletions example/lib/profile/data/user_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ part 'user_service.chopper.dart';
@ChopperApi(baseUrl: 'https://randomuser.me/api/')
@singleton
abstract class UserService extends ChopperService {
@Get()
@GET()
Future<ApiUserResponse> getRandomUser();

@Get()
@GET()
Future<ApiUserResponse> getRandomUserFails() {
throw CheckedFromJsonException({}, null, '', '');
}
Expand Down
6 changes: 2 additions & 4 deletions example/lib/profile/presentation/cubit/user_state.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
part of 'user_cubit.dart';

@freezed
class UserState with _$UserState {
const factory UserState({
User? user,
}) = _UserState;
sealed class UserState with _$UserState {
const factory UserState({User? user}) = _UserState;
}
22 changes: 12 additions & 10 deletions example/lib/profile/presentation/user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ import 'package:flutter/material.dart';

class UserPage extends BlocfulWidget<UserCubit, UserState, UserEvent> {
const UserPage({required this.onCreateCubit, super.key})
: super(onCreateBloc: onCreateCubit);
: super(onCreateBloc: onCreateCubit);

final UserCubit Function(BuildContext)? onCreateCubit;

@override
void onPresentationEvent(BuildContext context, UserEvent event) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(event.reason)));
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text(event.reason)));
}

@override
Widget builder(BuildContext context, UserCubit bloc, UserState state) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(state.user?.email ?? ''),
Text(state.user?.phone ?? ''),
],
)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(state.user?.email ?? ''),
Text(state.user?.phone ?? ''),
],
),
),
),
);
}
Expand Down
Loading