Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test implementation. Signed-off-by: Alex Manoel Ferreira Silva <alex@legytma.com.br>
- Loading branch information
Alex Manoel Ferreira Silva
committed
Aug 12, 2020
1 parent
7c2aafd
commit 9e9b058
Showing
5 changed files
with
270 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,110 @@ | ||
# google_maps_schema_parser | ||
A google_maps_flutter Schema Parser. | ||
[![GitHub issues](https://img.shields.io/github/issues/Legytma/google_maps_schema_parser)](https://github.com/Legytma/google_maps_schema_parser/issues "GitHub issues") | ||
[![GitHub forks](https://img.shields.io/github/forks/Legytma/google_maps_schema_parser)](https://github.com/Legytma/google_maps_schema_parser/network "GitHub forks") | ||
[![GitHub stars](https://img.shields.io/github/stars/Legytma/google_maps_schema_parser)](https://github.com/Legytma/google_maps_schema_parser/stargazers "GitHub stars") | ||
[![GitHub license](https://img.shields.io/github/license/Legytma/google_maps_schema_parser)](https://github.com/Legytma/google_maps_schema_parser/blob/master/LICENSE "GitHub license") | ||
[![Pub](https://img.shields.io/pub/v/google_maps_schema_parser)](https://pub.dev/packages/google_maps_schema_parser "Pub") | ||
[![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart "style: effective dart") | ||
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Legytma/google_maps_schema_parser "GitHub tag (latest SemVer)") | ||
![GitHub top language](https://img.shields.io/github/languages/top/Legytma/google_maps_schema_parser "GitHub top language") | ||
![GitHub contributors](https://img.shields.io/github/contributors/Legytma/google_maps_schema_parser "GitHub contributors") | ||
![GitHub last commit](https://img.shields.io/github/last-commit/Legytma/google_maps_schema_parser "GitHub last commit") | ||
![Flutter CI](https://github.com/Legytma/google_maps_schema_parser/workflows/Flutter%20CI/badge.svg "Flutter CI") | ||
|
||
# Convert JSON to Widget validating with JSON Schema for Flutter apps | ||
|
||
* [What is it](#what-is-it "What is it") | ||
* [TYPE SCHEMA PARSER SUPPORT](TYPE_SCHEMA_PARSER_SUPPORT.md "TYPE SCHEMA PARSER SUPPORT") | ||
* [Getting Started](#getting-started "Getting Started") | ||
* [Installation](#installation "Installation") | ||
* [Usage](#usage "Usage") | ||
* [CHANGELOG](CHANGELOG.md "CHANGELOG") | ||
* [Next steps](#next-steps "Next steps") | ||
* [LICENSE](LICENSE "LICENSE") | ||
|
||
## What is it | ||
|
||
The [google_maps_schema_parser](https://pub.dev/packages/google_maps_schema_parser "google_maps_schema_parser") is a parser implementation to [google_maps_flutter](https://pub.dev/packages/google_maps_flutter "google_maps_flutter") Flutter package implemented with base on [schema_widget](https://pub.dev/packages/schema_widget "schema_widget") package that produces widgets dynamically interpreting JSON objects. | ||
|
||
### Installation | ||
|
||
* Add this to your package's pubspec.yaml file: | ||
```yaml | ||
dependencies: | ||
get_it: | ||
schema_widget: | ||
google_maps_schema_parser: ^1.1.0-0 | ||
``` | ||
* Install packages from the command line: | ||
with Flutter: | ||
```shell script | ||
$ flutter packages get | ||
``` | ||
* Import it into the code file: | ||
```dart | ||
import 'package:google_maps_schema_parser/google_maps_schema_parser.dart'; | ||
``` | ||
|
||
### Usage | ||
|
||
```dart | ||
import 'package:flutter/material.dart'; | ||
import 'package:get_it/get_it.dart'; | ||
import 'package:schema_widget/schema_widget.dart'; | ||
import 'package:google_maps_schema_parser/google_maps_schema_parser.dart'; | ||
void main() { | ||
runApp(MyApp()); | ||
} | ||
class MyApp extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Google Maps Demo', | ||
theme: ThemeData( | ||
primarySwatch: Colors.blue, | ||
visualDensity: VisualDensity.adaptivePlatformDensity, | ||
), | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: Text(widget.title), | ||
), | ||
body: Center( | ||
child: FutureBuilder( | ||
future: GetIt.I.allReady(ignorePendingAsyncCreation: false), | ||
builder: (buildContext, snapshot) { | ||
if (snapshot.hasData) { | ||
return SchemaWidget.parse<Widget>(context, { | ||
"type": "GoogleMap", | ||
"initialCameraPosition": { | ||
"target": { | ||
"latitude": 0.0, | ||
"longitude": 0.0 | ||
} | ||
} | ||
}); | ||
} | ||
return Container(); | ||
}, | ||
), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: _incrementCounter, | ||
tooltip: 'Increment', | ||
child: Icon(Icons.add), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
## Next steps | ||
|
||
- [x] Publish Package; | ||
- [x] Make MVP; | ||
- [x] Minimal documentation; | ||
- [x] Add list of default supported Widgets; | ||
- [x] Add list of default supported Types; | ||
- [ ] Create content about; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-06/schema#", | ||
"$id": "http://json-schema.org/draft-06/schema#", | ||
"title": "Core schema meta-schema", | ||
"definitions": { | ||
"schemaArray": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { "$ref": "#" } | ||
}, | ||
"nonNegativeInteger": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"nonNegativeIntegerDefault0": { | ||
"allOf": [ | ||
{ "$ref": "#/definitions/nonNegativeInteger" }, | ||
{ "default": 0 } | ||
] | ||
}, | ||
"simpleTypes": { | ||
"enum": [ | ||
"array", | ||
"boolean", | ||
"integer", | ||
"null", | ||
"number", | ||
"object", | ||
"string" | ||
] | ||
}, | ||
"stringArray": { | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true, | ||
"default": [] | ||
} | ||
}, | ||
"type": ["object", "boolean"], | ||
"properties": { | ||
"$id": { | ||
"type": "string", | ||
"format": "uri-reference" | ||
}, | ||
"$schema": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"$ref": { | ||
"type": "string", | ||
"format": "uri-reference" | ||
}, | ||
"title": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"type": "string" | ||
}, | ||
"default": {}, | ||
"examples": { | ||
"type": "array", | ||
"items": {} | ||
}, | ||
"multipleOf": { | ||
"type": "number", | ||
"exclusiveMinimum": 0 | ||
}, | ||
"maximum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMaximum": { | ||
"type": "number" | ||
}, | ||
"minimum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMinimum": { | ||
"type": "number" | ||
}, | ||
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"pattern": { | ||
"type": "string", | ||
"format": "regex" | ||
}, | ||
"additionalItems": { "$ref": "#" }, | ||
"items": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/schemaArray" } | ||
], | ||
"default": {} | ||
}, | ||
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"uniqueItems": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"contains": { "$ref": "#" }, | ||
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, | ||
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, | ||
"required": { "$ref": "#/definitions/stringArray" }, | ||
"additionalProperties": { "$ref": "#" }, | ||
"definitions": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"properties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"patternProperties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"dependencies": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/stringArray" } | ||
] | ||
} | ||
}, | ||
"propertyNames": { "$ref": "#" }, | ||
"const": {}, | ||
"enum": { | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true | ||
}, | ||
"type": { | ||
"anyOf": [ | ||
{ "$ref": "#/definitions/simpleTypes" }, | ||
{ | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/simpleTypes" }, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
] | ||
}, | ||
"format": { "type": "string" }, | ||
"allOf": { "$ref": "#/definitions/schemaArray" }, | ||
"anyOf": { "$ref": "#/definitions/schemaArray" }, | ||
"oneOf": { "$ref": "#/definitions/schemaArray" }, | ||
"not": { "$ref": "#" } | ||
}, | ||
"default": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters