Skip to content

Commit

Permalink
Make input mutable, add gallery project
Browse files Browse the repository at this point in the history
  • Loading branch information
petrnymsa committed Oct 2, 2023
1 parent 9f3b568 commit 03d60d2
Show file tree
Hide file tree
Showing 70 changed files with 1,552 additions and 882 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"dart.lineLength": 120,
}
91 changes: 66 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,80 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
<a href="https://github.com/netglade">
<img alt="netglade" height='120px' src="https://raw.githubusercontent.com/netglade/auto_mappr/main/packages/auto_mappr/doc/badge_dark.png">
</a>

For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
Developed with 💚 by [netglade][netglade_link]

For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
[![ci][ci_badge]][ci_badge_link]
[![glade_forms][glade_forms_pub_badge]][glade_forms_pub_badge_link]
[![license: MIT][license_badge]][license_badge_link]
[![style: netglade analysis][style_badge]][style_badge_link]
[![Discord][discord_badge]][discord_badge_link]

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
---

## Features
A universal way to define form validators with support of translations.

TODO: List what your package can do. Maybe include images, gifs, or videos.
- [👀 What is this?](#-what-is-this)
- [Why should I use it?](#why-should-i-use-it)
- [🚀 Getting started](#-getting-started)
- [Mutable or immutable model](#mutable-or-immutable-model)
- [Quickstart example](#quickstart-example)
- [Existing validators](#existing-validators)
- [Creating own reusable ValidatorPart](#creating-own-reusable-validatorpart)
- [Adding translation support](#adding-translation-support)
- [Debugging validators](#debugging-validators)
- [👏 Contributing](#-contributing)

## Getting started
## 👀 What is this?

TODO: List prerequisites and provide or point to information on how to
start using the package.
Glade forms offer unified way to define reusable
and fluent API to define Form fields input's validators with support of translation on top of that.

## Usage
### Why should I use it?

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

## 🚀 Getting started

Quicstart example:

```dart
const like = 'sample';
```

## Additional information
### Mutable or immutable model


### Quickstart example

TBD

### Existing validators


### Creating own reusable ValidatorPart

### Adding translation support


### Debugging validators





## 👏 Contributing

Your contributions are always welcome! Feel free to open pull request.

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
[netglade_link]: https://netglade.com/en
[ci_badge]: https://github.com/netglade/glade_forms/actions/workflows/ci.yaml/badge.svg
[ci_badge_link]: https://github.com/netglade/glade_forms/actions
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license_badge_link]: https://opensource.org/licenses/MIT
[style_badge]: https://img.shields.io/badge/style-netglade_analysis-26D07C.svg
[style_badge_link]: https://pub.dev/packages/netglade_analysis
[glade_forms_pub_badge]: https://img.shields.io/pub/v/glade_forms.svg
[glade_forms_pub_badge_link]: https://pub.dartlang.org/packages/glade_forms
[discord_badge]: https://img.shields.io/discord/1091460081054400532.svg?logo=discord&color=blue
[discord_badge_link]: https://discord.gg/sJfBBuDZy4
7 changes: 7 additions & 0 deletions examples/gallery/assets/translations/cs-CZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ageRestriction": {
"under18": "Musí vám být alespoň 18 let pro vstup",
"ageFormat": "Věk musí být číslo"
},
"empty": "Povinná hodnota"
}
7 changes: 7 additions & 0 deletions examples/gallery/assets/translations/en-US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ageRestriction": {
"under18": "You must be at least 18 years old for entry",
"ageFormat": "Age has to be number"
},
"empty": "You must fill in value"
}
1 change: 1 addition & 0 deletions examples/gallery/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions examples/gallery/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions examples/gallery/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
2 changes: 1 addition & 1 deletion examples/gallery/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
99 changes: 52 additions & 47 deletions examples/gallery/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,51 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>cs</string>
</array>
</dict>
</plist>
32 changes: 0 additions & 32 deletions examples/gallery/lib/core/widget_example.dart

This file was deleted.

Empty file.
8 changes: 8 additions & 0 deletions examples/gallery/lib/generated/locale_keys.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart

abstract class LocaleKeys {
static const ageRestriction_under18 = 'ageRestriction.under18';
static const ageRestriction_ageFormat = 'ageRestriction.ageFormat';
static const empty = 'empty';

}
32 changes: 32 additions & 0 deletions examples/gallery/lib/generated/locale_loader.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart

// ignore_for_file: prefer_single_quotes

import 'dart:ui';

import 'package:easy_localization/easy_localization.dart' show AssetLoader;

class CodegenLoader extends AssetLoader{
const CodegenLoader();

@override
Future<Map<String, dynamic>?> load(String path, Locale locale) {
return Future.value(mapLocales[locale.toString()]);
}

static const Map<String,dynamic> cs_CZ = {
"ageRestriction": {
"under18": "Musí vám být alespoň 18 let pro vstup",
"ageFormat": "Věk musí být číslo"
},
"empty": "Povinná hodnota"
};
static const Map<String,dynamic> en_US = {
"ageRestriction": {
"under18": "You must be at least 18 years old for entry",
"ageFormat": "Age has to be number"
},
"empty": "You must fill in value"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"cs_CZ": cs_CZ, "en_US": en_US};
}
Loading

0 comments on commit 03d60d2

Please sign in to comment.