Skip to content

Commit

Permalink
feat: rich text and Resource update (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmeral authored Nov 20, 2024
1 parent b245a89 commit f6b4eb5
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 12 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@ concurrency:
cancel-in-progress: true

jobs:

quality:
name: Quality Checks
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v1

- name: Format, Lint, Publishability
run: melos run lint:all
- name: Run Tests
run: melos run test:coverage:all
- name: Archive Golden failures
if: failure()
uses: actions/upload-artifact@v3
with:
name: Golden failures
retention-days: 2
path: |
**/test/**/failures/**/*.*
- name: Zweidenker Heinzelmen Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1
with:
Expand Down
6 changes: 5 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ packages:

scripts:

setup:
run: |
echo "no setup needed, skipping"
lint:all:
run: |
melos run lint:analyze && melos run lint:pub --no-select && melos run lint:format
Expand All @@ -17,7 +21,7 @@ scripts:
lint:pub:
run: |
melos exec -c 5 -- \
"dart pub publish --dry-run"
"flutter pub publish --dry-run"
packageFilters:
ignore: "*example*"
no-private: true
Expand Down
4 changes: 4 additions & 0 deletions packages/apptive_grid_heinzelmen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.1

- **FEAT**: Adding RichText and basic Resource type support

## 3.0.0

> Note: This release has breaking changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ class DataWidget extends StatelessWidget {
emptyBuilder: emptyBuilder,
linkLauncher: linkLauncher,
),
ResourceDataEntity() => Text(
data.value.name,
style: textStyle,
),
};
}
}
Expand Down
15 changes: 9 additions & 6 deletions packages/apptive_grid_heinzelmen/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: apptive_grid_heinzelmen
description: A collection of little helpers for Flutter Apps that use ApptiveGrid.
version: 3.0.0
version: 3.0.1
homepage: https://www.apptivegrid.de
repository: https://github.com/zweidenker/flutter-heinzelmen/packages/apptive_grid_heinzelmen

Expand All @@ -9,18 +9,21 @@ environment:
flutter: ">=1.17.0"

dependencies:
apptive_grid_core: ^2.0.0
apptive_grid_user_management: ^2.0.0
apptive_grid_theme: ^1.2.1
apptive_grid_core: ^2.1.5
apptive_grid_user_management: ^2.0.3
apptive_grid_theme: ^1.3.0
flutter:
sdk: flutter
flutter_svg: ^2.0.7
flutter_svg: ^2.0.14
http: '>=0.13.0 <2.0.0'
intl: ^0.18.1
intl: ^0.19.0
provider: ^6.0.5
universal_file: ^1.0.0
zweidenker_heinzelmen: ^2.0.0

dependency_overrides:
intl: ^0.19.0

dev_dependencies:
alchemist:
git:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) async {
tolerance: 0.001,
),
ciGoldensConfig: const CiGoldensConfig(
tolerance: 0.001,
tolerance: 0.003,
),
),
run: testMain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class _MockHttpClient extends Mock implements HttpClient {
_MockHttpClient() {
registerFallbackValue((List<int> _) {});
registerFallbackValue(Uri());
registerFallbackValue(Stream<List<int>>.fromIterable([]));
}

@override
Expand All @@ -184,7 +185,7 @@ class _MockHttpHeaders extends Mock implements HttpHeaders {}

HttpClient _createHttpClient(Map<Uri, Uint8List>? images) {
final fallbackImage = base64Decode(
'''iVBORw0KGgoAAAANSUhEUgAAAToAAAE6CAYAAACGQp5cAAAACXBIWXMAACxKAAAsSgF3enRNAAAWmElEQVR4nO3dT2xW15nH8ROUhNAITAqNRokjmFoiKhub1SRZ1K5Qu0qFpYky0swCs3o1K1NlV1Wq0VTdofBupvJmsBcz0qBUY0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AntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5BkdkGd0QJ7RAXlGB+QZHZBndECe0QF5RgfkGR2QZ3RAntEBeUYH5F1/OwBd+wELkAhH4gq5YgAAAABJRU5ErkJggg==''',
);

final client = _MockHttpClient();
Expand Down Expand Up @@ -221,5 +222,69 @@ HttpClient _createHttpClient(Map<Uri, Uint8List>? images) {

return request;
});

HttpClientResponse createResponse(Uri uri) {
final response = _MockHttpClientResponse();
final headers = _MockHttpHeaders();
final data = images?[uri] ?? fallbackImage;

when(() => response.headers).thenReturn(headers);
when(() => response.contentLength).thenReturn(data.length);
when(() => response.statusCode).thenReturn(HttpStatus.ok);
when(() => response.isRedirect).thenReturn(false);
when(() => response.redirects).thenReturn([]);
when(() => response.persistentConnection).thenReturn(false);
when(() => response.reasonPhrase).thenReturn('OK');
when(
() => response.compressionState,
).thenReturn(HttpClientResponseCompressionState.notCompressed);
when(
() => response.handleError(any(), test: any(named: 'test')),
).thenAnswer((_) => Stream<List<int>>.value(data));
when(
() => response.listen(
any(),
onDone: any(named: 'onDone'),
onError: any(named: 'onError'),
cancelOnError: any(named: 'cancelOnError'),
),
).thenAnswer((invocation) {
final onData =
invocation.positionalArguments.first as void Function(List<int>);
final onDone = invocation.namedArguments[#onDone] as void Function()?;
return Stream<List<int>>.fromIterable(
<List<int>>[data],
).listen(onData, onDone: onDone);
});
return response;
}

HttpClientRequest createRequest(Uri uri) {
final request = _MockHttpClientRequest();
final headers = _MockHttpHeaders();

when(() => request.headers).thenReturn(headers);
when(
() => request.addStream(any()),
).thenAnswer((invocation) {
final stream = invocation.positionalArguments.first as Stream<List<int>>;
return stream.fold<List<int>>(
<int>[],
(previous, element) => previous..addAll(element),
);
});
when(
request.close,
).thenAnswer((_) async => createResponse(uri));

return request;
}

when(() => client.openUrl(any(), any())).thenAnswer(
(invokation) async => createRequest(
invokation.positionalArguments.last as Uri,
),
);

return client;
}
14 changes: 13 additions & 1 deletion packages/apptive_grid_heinzelmen/test/src/data_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ void main() {
children: DataType.values.map<Widget>((type) {
final data = switch (type) {
DataType.text => StringDataEntity('String'),
DataType.richText => StringDataEntity('Rich String'),
DataType.dateTime ||
DataType.createdAt =>
DateTimeDataEntity(DateTime(2022, 7, 28, 10, 17)),
Expand Down Expand Up @@ -347,7 +348,18 @@ void main() {
DataType.reducedLookUp =>
ReducedLookUpDataEntity(IntegerDataEntity(3)),
DataType.formula =>
FormulaDataEntity(value: IntegerDataEntity(3))
FormulaDataEntity(value: IntegerDataEntity(3)),
DataType.resource => ResourceDataEntity(
DataResource(
href: ApptiveLink(
uri: Uri.parse('test/uri'),
method: 'GET',
),
type: DataResourceType.spreadsheetView,
name: 'testResource',
metaType: DataResourceMetaType.view,
),
)
} as DataEntity;

return GoldenTestScenario(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f6b4eb5

Please sign in to comment.