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 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
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
14 changes: 14 additions & 0 deletions glade_forms/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,17 @@ dart_code_metrics:
- package:netglade_analysis/dcm.yaml
pubspec-rules:
prefer-publish-to-none: false
rules:
avoid-commented-out-code: false # code examples in comments
prefer-boolean-prefixes: false # # TODO: release new major version (breaking change)
prefer-named-parameters: false # TODO: release new major version (breaking change)
dispose-class-fields: false # callback parameters are better without named
avoid-undisposed-instances:
ignored-invocations:
- WithAutoDispose
prefer-single-declaration-per-file:
exclude:
- build/unit_test_assets/**
prefer-abstract-final-static-class:
exclude:
- build/unit_test_assets/**
7 changes: 6 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 All @@ -29,6 +32,7 @@ class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GladeFormBuilder.create(
// ignore: avoid-undisposed-instances, handled by GladeFormBuilder
create: (context) => _Model(),
builder: (context, model, _) => Padding(
padding: const EdgeInsets.all(32),
Expand Down Expand Up @@ -58,6 +62,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
2 changes: 1 addition & 1 deletion glade_forms/lib/src/core/glade_error_keys.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class GladeErrorKeys {
abstract final class GladeErrorKeys {
static const String conversionError = 'value-cant-be-converted';
static const String stringEmpty = 'string-empty-error';
static const String stringNotUrl = 'string-not-url';
Expand Down
6 changes: 1 addition & 5 deletions glade_forms/lib/src/core/input_dependencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:collection/collection.dart';
import 'package:glade_forms/src/core/core.dart';
import 'package:glade_forms/src/core/object_ex.dart';

typedef InputDependencies = List<GladeInput<Object?>>;
typedef InputDependenciesFactory = InputDependencies Function();
Expand All @@ -13,8 +14,3 @@ extension InputDependenciesFunctions on InputDependencies {
/// Finds input by its key or returns null.
GladeInput<T>? byKeyOrNull<T>(String key) => firstWhereOrNull((x) => x.inputKey == key).castOrNull();
}

extension ObjectEx on Object? {
T? castOrNull<T>() => this is T ? this as T : null;
T cast<T>() => this as T;
}
5 changes: 5 additions & 0 deletions glade_forms/lib/src/core/object_ex.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extension ObjectEx on Object? {
T? castOrNull<T>() => this is T ? this as T : null;

T cast<T>() => this as T;
}
2 changes: 1 addition & 1 deletion glade_forms/lib/src/core/type_helper.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TypeHelper {
abstract final class TypeHelper {
static bool typesEqual<T1, T2>() => T1 == T2;

static bool typeIsNullable<T>() => null is T;
Expand Down
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: 1 addition & 1 deletion glade_forms/lib/src/validator/regex_patterns.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class RegexPatterns {
abstract final class RegexPatterns {
static const email = r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$';
static const urlWithOptionalHttp = r'^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&\(\)\*\+,;=.]+$';
static const urlWithHttp =
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);
}
}
34 changes: 16 additions & 18 deletions glade_forms/lib/src/widgets/glade_model_debug_info.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:glade_forms/src/model/glade_model.dart';
import 'package:glade_forms/src/widgets/glade_form_builder.dart';
Expand Down Expand Up @@ -196,7 +195,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,8 +211,8 @@ class _Table extends StatelessWidget {
if (showControllerText) const _ColumnHeader('controller.text'),
],
),
...inputs.mapIndexed(
(index, x) => TableRow(
for (final (index, x) in inputs.indexed)
TableRow(
decoration: BoxDecoration(color: index.isEven ? Colors.white : const Color.fromARGB(255, 235, 234, 234)),
children: [
Padding(
Expand All @@ -229,7 +228,6 @@ class _Table extends StatelessWidget {
if (showControllerText) _RowValue(value: x.controller?.text, colorizedValue: true),
],
),
),
],
);
}
Expand Down Expand Up @@ -365,6 +363,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 +389,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 @@ -3,8 +3,9 @@ import 'package:glade_forms/src/model/glade_model.dart';
import 'package:glade_forms/src/widgets/glade_model_debug_info.dart';
import 'package:glade_forms/src/widgets/glade_model_provider.dart';

class GladeModelDebugInfoModal {
abstract final 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.

Loading
Loading