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

update packages #78

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 0 additions & 3 deletions .fvm/fvm_config.json

This file was deleted.

2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.16.5"
"flutter": "3.27.1"
}
18 changes: 8 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,24 @@ jobs:
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}

- name: Install DCM
uses: CQLabs/setup-dcm@v1
uses: CQLabs/setup-dcm@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: 1.24.2
github-token: ${{ secrets.GITHUB_TOKEN }}
version: 1.26.2

- uses: bluefireteam/melos-action@v2
- uses: bluefireteam/melos-action@v3

- name: Dart Analyze
run: melos run lint:dart

- name: Run DCM
uses: CQLabs/dcm-action@v1
uses: CQLabs/dcm-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
ci_key: ${{ secrets.DCM_KEY }}
github-token: ${{ secrets.GITHUB_TOKEN }}
ci-key: ${{ secrets.DCM_KEY }}
email: ${{ secrets.DCM_EMAIL }}
folders: .
fatal_style: true
fatal_performance: true
fatal_warnings: true
fatal-found: true

- name: Test
run: melos run test
4 changes: 2 additions & 2 deletions .github/workflows/storybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}

- uses: bluefireteam/melos-action@v2
- uses: bluefireteam/melos-action@v3

- name: Setup
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
run: flutter build web --base-href "/glade_forms/"

- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.16.5",
"dart.flutterSdkPath": ".fvm/versions/3.27.1",
"dart.lineLength": 120,
"yaml.schemaStore.enable": false
}
2 changes: 1 addition & 1 deletion dcm_global.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: "1.24.2"
version: "1.26.2"
3 changes: 3 additions & 0 deletions glade_forms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.1.0
- updated dependencies

# 3.0.1
- **[Fix]**: GladeFormProvider is missing key property [Fix 73](https://github.com/netglade/glade_forms/issues/73)
- **[Fix]**: enable value transform with text editing controller [Fix 72](https://github.com/netglade/glade_forms/issues/72)
Expand Down
8 changes: 8 additions & 0 deletions glade_forms/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ dart_code_metrics:
- package:netglade_analysis/dcm.yaml
pubspec-rules:
prefer-publish-to-none: false
rules:
prefer-single-declaration-per-file: false
avoid-commented-out-code: false # code examples in comments
prefer-boolean-prefixes: false # TODO
prefer-abstract-final-static-class: false # TODO
prefer-named-parameters: false # TODO
dispose-class-fields: false # TODO
avoid-undisposed-instances: false # TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will finish these TODO?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • avoid-undisposed-instances: ignored-invocations settings https://dcm.dev/docs/rules/flutter/avoid-undisposed-instances
  • dispose-class-fields: ignore comment, i would type there something like that "callback parameters are better without named"
  • prefer-abstract-final-static-class: fix
  • prefer-boolean-prefixes: ok to disable (breaks API), or maybe just ignore comments on line/file?
  • avoid-commented-out-code: above the comment add "// TODO(alternative): you can also do this" or something like that, to disable the warning
  • prefer-single-declaration-per-file: add ignore for the one case

6 changes: 5 additions & 1 deletion glade_forms/example/lib/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class _Model extends GladeModel {
age = GladeInput.intInput(value: 0, inputKey: 'age');
email = GladeInput.stringInput(validator: (validator) => (validator..isEmail()).build(), inputKey: 'email');
income = GladeInput.intInput(
value: 10000, validator: (validator) => (validator..isMin(min: 1000)).build(), inputKey: 'income');
value: 10000,
validator: (validator) => (validator..isMin(min: 1000)).build(),
inputKey: 'income',
);

super.initialize();
}
Expand Down Expand Up @@ -58,6 +61,7 @@ class Example extends StatelessWidget {
),
const SizedBox(height: 10),
ElevatedButton(
// ignore: no-empty-block, empty function, just for example
onPressed: model.isValid ? () {} : null,
child: const Text('Save'),
),
Expand Down
7 changes: 5 additions & 2 deletions glade_forms/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ version: 1.0.1
publish_to: none

environment:
sdk: ">=2.18.7 <4.0.0"
sdk: ">=3.5.0 <4.0.0"
resolution: workspace

dependencies:
glade_forms: ^1.1.0
flutter:
sdk: flutter
glade_forms: ^3.1.0
1 change: 1 addition & 0 deletions glade_forms/lib/src/core/input_dependencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ extension InputDependenciesFunctions on InputDependencies {

extension ObjectEx on Object? {
T? castOrNull<T>() => this is T ? this as T : null;

T cast<T>() => this as T;
}
2 changes: 0 additions & 2 deletions glade_forms/lib/src/validator/int_validator.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:glade_forms/src/src.dart';

class IntValidator extends GladeValidator<int> {
IntValidator();

/// Compares given value with [min] and [max] values. With [inclusiveInterval] set to true(default), the comparison is inclusive.
void isBetween({
required int min,
Expand Down
2 changes: 0 additions & 2 deletions glade_forms/lib/src/validator/string_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import 'package:glade_forms/src/core/glade_error_keys.dart';
import 'package:glade_forms/src/validator/validator.dart';

class StringValidator extends GladeValidator<String> {
StringValidator();

/// Given value can't be empty string (or null).
void notEmpty({
OnValidateError<String>? devError,
Expand Down
10 changes: 5 additions & 5 deletions glade_forms/lib/src/widgets/glade_form_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class _GladeFormListenerState<M extends GladeModel> extends State<GladeFormListe
super.didChangeDependencies();
}

void _onModelUpdate() {
final m = context.read<M>();
widget.listener(context, m, m.lastUpdatedInputKeys);
}

@override
Widget build(BuildContext context) {
return widget.child;
}

void _onModelUpdate() {
final m = context.read<M>();
widget.listener(context, m, m.lastUpdatedInputKeys);
}
}
29 changes: 15 additions & 14 deletions glade_forms/lib/src/widgets/glade_model_debug_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class _Table extends StatelessWidget {

return Table(
defaultColumnWidth: scrollable ? const IntrinsicColumnWidth() : const FlexColumnWidth(),
border: TableBorder.symmetric(outside: const BorderSide()),
border: const TableBorder.symmetric(outside: BorderSide()),
children: [
// Columns header.
TableRow(
Expand All @@ -212,6 +212,7 @@ class _Table extends StatelessWidget {
if (showControllerText) const _ColumnHeader('controller.text'),
],
),
// ignore: avoid-slow-collection-methods, necessary for now
mathew65 marked this conversation as resolved.
Show resolved Hide resolved
...inputs.mapIndexed(
(index, x) => TableRow(
decoration: BoxDecoration(color: index.isEven ? Colors.white : const Color.fromARGB(255, 235, 234, 234)),
Expand Down Expand Up @@ -365,6 +366,19 @@ class _DangerStrips extends StatelessWidget {
required this.gap,
});

@override
Widget build(BuildContext context) {
return SizedBox(
height: 5,
width: double.infinity,
child: LayoutBuilder(
builder: (context, constraints) {
return Stack(children: _getListOfStripes((constraints.maxWidth / 2).ceil()));
},
),
);
}

List<Widget> _getListOfStripes(int count) {
final stripes = <Widget>[];
for (var i = 0; i < count; i++) {
Expand All @@ -378,17 +392,4 @@ class _DangerStrips extends StatelessWidget {

return stripes;
}

@override
Widget build(BuildContext context) {
return SizedBox(
height: 5,
width: double.infinity,
child: LayoutBuilder(
builder: (context, constraints) {
return Stack(children: _getListOfStripes((constraints.maxWidth / 2).ceil()));
},
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:glade_forms/src/widgets/glade_model_provider.dart';

class GladeModelDebugInfoModal {
const GladeModelDebugInfoModal();

static void showDebugInfoModel<M extends GladeModel>(BuildContext context, M model) {
final _ = showModalBottomSheet<void>(
context: context,
Expand Down
9 changes: 5 additions & 4 deletions glade_forms/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: glade_forms
description: A universal way to define form validators with support of translations.
version: 3.0.1
version: 3.1.0
repository: https://github.com/netglade/glade_forms
issue_tracker: https://github.com/netglade/glade_forms/issues
screenshots:
- description: The glade_forms package logo.
path: doc/icon.png

environment:
sdk: ^3.0.0
sdk: ^3.5.0
resolution: workspace

# Add regular dependencies here.
dependencies:
Expand All @@ -20,5 +21,5 @@ dependencies:
provider: ^6.0.5

dev_dependencies:
netglade_analysis: ^7.0.0
test: ^1.24.6
netglade_analysis: ^15.0.0
test: ^1.25.8
60 changes: 0 additions & 60 deletions melos.yaml

This file was deleted.

61 changes: 59 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,64 @@ name: glade_forms_workspace
publish_to: "none"

environment:
sdk: ">=2.18.0 <4.0.0"
sdk: ">=3.6.0 <4.0.0"

workspace:
- glade_forms
- glade_forms/example
- storybook

dev_dependencies:
melos: ^3.0.0
melos: ^7.0.0-dev.3
easy_localization: ^3.0.7

melos:
scripts:
setup:
description: Completely setups project
run: |
melos exec -- fvm flutter pub get
melos run gallery_setup

setup:win:
description: Completely setups project
run: |
melos exec -- fvm flutter pub get ^
melos run gallery_setup:win

# ANALYZING

lint:all:
run: melos run lint:dart && melos run lint:dcm
description: Run all static analysis checks.

lint:dart:
run: melos exec -- dart analyze . --fatal-infos
description: Run Dart static analysis checks.

lint:dcm:
run: melos exec -- dcm analyze . --fatal-style --fatal-performance --fatal-warnings
description: Run DCM static analysis checks.

# TESTING

test:
run: melos exec -- flutter test
packageFilters:
dirExists: test
description: Run all Dart tests.

# Gallery
gallery_setup:
run: |
melos exec -- flutter pub run easy_localization:generate -S "assets/translations" -o locale_loader.g.dart
melos exec -- fvm flutter pub run easy_localization:generate -S "assets/translations" --skip-unnecessary-keys -f keys -o locale_keys.g.dart
packageFilters:
dependsOn: easy_localization

gallery_setup:win:
run: |
melos exec -- flutter pub run easy_localization:generate -S "assets/translations" -o locale_loader.g.dart ^
melos exec -- fvm flutter pub run easy_localization:generate -S "assets/translations" --skip-unnecessary-keys -f keys -o locale_keys.g.dart
packageFilters:
dependsOn: easy_localization
5 changes: 5 additions & 0 deletions storybook/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ analyzer:
dart_code_metrics:
extends:
- package:netglade_analysis/dcm.yaml
rules:
prefer-single-declaration-per-file: false
avoid-commented-out-code: false # code examples in comments
prefer-boolean-prefixes: false # TODO
prefer-abstract-final-static-class: false # TODO
Loading
Loading